(PECL CUBRID >= 8.3.0)
cubrid_is_instance — 检查 OID 指向的实例是否存在
使用 cubrid_is_instance() 函数检查给定 oid
指向的实例是否存在。
conn_identifier
连接标识符。
oid
要检查存在的实例的 OID。
1,如果该实例存在;
0,如果该实例不存在;
-1,发生错误时
示例 #1 cubrid_is_instance() 示例
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$sql = <<<EOD
SELECT host_year, medal, game_date
FROM game
WHERE athlete_code IN
(SELECT code FROM athlete WHERE name='Thorpe Ian');
EOD;
$req = cubrid_execute($conn, $sql, CUBRID_INCLUDE_OID);
$oid = cubrid_current_oid($req);
$res = cubrid_is_instance ($conn, $oid);
if ($res == 1) {
echo "由 $oid 指向的实例存在。\n";
} else if ($res == 0){
echo "由 $oid 指向的实例不存在。\n";
} else {
echo "error\n";
}
cubrid_disconnect($conn);
?>
上面的示例将输出
Instance pointed by @0|0|0 doesn't exist.