略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: cubrid_is_instance

2024-12-22

cubrid_is_instance

(PECL CUBRID >= 8.3.0)

cubrid_is_instanceCheck whether the instance pointed by OID exists

说明

cubrid_is_instance(resource $conn_identifier, string $oid): int

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$sqlCUBRID_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.

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.cubrid-is-instance.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3