PHP8 cubrid_is_instance
2024-03-28 09:31 更新
(PECL CUBRID >= 8.3.0)
cubrid_is_instance — 检查OID指向的实例是否存在
说明
cubrid_is_instance(resource $conn_identifier, string $oid): int
cubrid_is_instance() 函数用于检查 给定的实例是否存在。oid
参数
conn_identifier
连接标识符。
oid
要检查是否存在的实例的 OID。
返回值
1、如果存在此类实例;
0,如果此类实例不存在;
-1,出错时
示例
示例 #1 cubrid_is_instance() example
<?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 "Instance pointed by $oid exists.\n";
} else if ($res == 0){
echo "Instance pointed by $oid doesn't exist.\n";
} else {
echo "error\n";
}
cubrid_disconnect($conn);
?>
以上示例会输出:
Instance pointed by @0|0|0 doesn't exist.
参见
- cubrid_drop() - 使用 OID 删除实例
- cubrid_get_class_name() - 使用 OID 获取类名
以上内容是否对您有帮助:
更多建议: