array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.cubrid-is-instance.php', 1 => 'cubrid_is_instance', ), 'up' => array ( 0 => 'ref.cubrid.php', 1 => 'CUBRID 函数', ), 'prev' => array ( 0 => 'function.cubrid-insert-id.php', 1 => 'cubrid_insert_id', ), 'next' => array ( 0 => 'function.cubrid-lob-close.php', 1 => 'cubrid_lob_close', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/cubrid/functions/cubrid-is-instance.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL CUBRID >= 8.3.0)
cubrid_is_instance — Check whether the instance pointed by OID exists
The cubrid_is_instance() function is used to check
whether the instance pointed by the given oid
exists or not.
conn_identifier
Connection identifier.
oid
OID of the instance that you want to check the existence.
1, if such instance exists;
0, if such instance does not exist;
-1, in case of error
示例 #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.