CUBRID Функции
PHP Manual

cubrid_schema

(PECL CUBRID >= 8.3.0)

cubrid_schemaIs used to get the requested schema information

Описание

array cubrid_schema ( resource $conn_identifier , int $schema_type [, string $class_name [, string $attr_name ]] )

The cubrid_schema() function is used to get the requested schema information from database. You have to designate class_name, if you want to get information on certain class, attr_name, if you want to get information on certain attribute (can be used only with CUBRID_ SCH_ATTR_PRIVILEGE).

The result of the cubrid_schema function is returned as a two-dimensional array (column (associative array) * row (numeric array)). The following tables shows types of schema and the column structure of the result array to be returned based on the schema type.

Result Composition of Each Type
Schema Column Number Column Name Value
CUBRID_SCH_CLASS 1 NAME  
  2 TYPE 0:system class 1:vclass 2:class
CUBRID_SCH_VCLASS 1 NAME  
  2 TYPE 1:vclass
CUBRID_SCH_QUERY_SPEC 1 QUERY_SPEC  
CUBRID_SCH_ATTRIBUTE / CUBRID_SCH_CLASS_ATTRIBUTE 1 ATTR_NAME  
  2 DOMAIN  
  3 SCALE  
  4 PRECISION  
  5 INDEXED 1:indexed
  6 NOT NULL 1:not null
  7 SHARED 1:shared
  8 UNIQUE 1:unique
  9 DEFAULT  
  10 ATTR_ORDER base:1
  11 CLASS_NAME  
  12 SOURCE_CLASS  
  13 IS_KEY 1:key
CUBRID_SCH_METHOD 1 NAME  
  2 RET_DOMAIN  
  3 ARG_DOMAIN  
CUBRID_SCH_METHOD_FILE 1 METHOD_FILE  
CUBRID_SCH_SUPERCLASS / CUBRID_SCH_SUBCLASS 1 CLASS_NAME  
  2 TYPE 0:system class 1:vclass 2:class
CUBRID_SCH_CONSTRAINT 1 TYPE 0:unique 1:index 2:reverse unique 3:reverse index
  2 NAME  
  3 ATTR_NAME  
  4 NUM_PAGES  
  5 NUM_KEYS  
  6 PRIMARY_KEY 1:primary key
  7 KEY_ORDER base:1
CUBRID_SCH_TRIGGER 1 NAME  
  2 STATUS  
  3 EVENT  
  4 TARGET_CLASS  
  5 TARGET_ATTR  
  6 ACTION_TIME  
  7 ACTION  
  8 PRIORITY  
  9 CONDITION_TIME  
  10 CONDITION  
CUBRID_SCH_CLASS_PRIVILEGE / CUBRID_SCH_ATTR_PRIVILEGE 1 CLASS_NAME / ATTR_NAME  
  2 PRIVILEGE  
  3 GRANTABLE  
CUBRID_SCH_PRIMARY_KEY 1 CLASS_NAME  
  2 ATTR_NAME  
  3 KEY_SEQ base:1
  4 KEY_NAME  
CUBRID_SCH_IMPORTED_KEYS / CUBRID_SCH_EXPORTED_KEYS / CUBRID_SCH_CROSS_REFERENCE 1 PKTABLE_NAME  
  2 PKCOLUMN_NAME  
  3 FKTABLE_NAME base:1
  4 FKCOLUMN_NAME  
  5 KEY_SEQ base:1
  6 UPDATE_ACTION 0:cascade 1:restrict 2:no action 3:set null
  7 DELETE_ACTION 0:cascade 1:restrict 2:no action 3:set null
  8 FK_NAME  
  9 PK_NAME  

Список параметров

conn_identifier

Connection identifier.

schema_type

Schema data that you want to know.

class_name

Class you want to know the schema of.

attr_name

Attribute you want to know the schema of.

Возвращаемые значения

Array containing the schema information, when process is successful;

FALSE, when process is unsuccessful

Список изменений

Версия Описание
8.3.1 Change return value: when process is unsuccessful, return false, not -1.

Примеры

Пример #1 cubrid_schema() example

<?php
$attrs 
cubrid_schema ($conCUBRID_SCH_ATTRIBUTE"person");
while (list(
$key$value) = each($attrs)) {
   echo 
$value["NAME"];
   echo 
$value["DOMAIN"];
}
?>

CUBRID Функции
PHP Manual