Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 | 



cubrid_is_instance

Description

The cubrid_is_instance function checks whether an instance referred to by the OID exists in the database.

Syntax

int cubrid_is_instance (resource $conn_identifier, string $oid)

  • conn_identifier : Connection identifier
  • oid : OID of an instance, for which you want to check whether it exists
Return Value
  • Instance : 1
  •   No instance : 0
  • Error : -1
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. ";

} else if ($res == 0){

    echo "Instance pointed by $oid doesn't exist. ";

} else {

    echo "error ";

}

 

cubrid_disconnect($conn);

?>

 

The above example will output:

 

Instance pointed by @0|0|0 doesn't exist.

See Also