(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 "错误\n";
}
cubrid_disconnect($conn);
?>
以上示例将输出
Instance pointed by @0|0|0 doesn't exist.