(PECL CUBRID >= 8.3.0)
cubrid_fetch_field — Returns an object with certain properties
This function returns an object with certain properties of the specific column. The properties of the object are:
column name
name of the table that the column belongs to
default value of the column
maximum length of the column
1 if the column cannot be NULL
1 if the column is an unique key
1 if the column is a non-unique key
1 if the column is numeric
the type of the column
This is the request identifier.
The numerical field offset. If the field offset is not specified, the next field (that was not yet retrieved by this function) is retrieved. The field_offset starts at 0.
Object with certain properties of the specific column, when process is successful.
FALSE on failure.
Example #1 cubrid_fetch_field() example
<?php
$link = cubrid_connect("localhost", 30000, "demodb2", "dba", "");
if (!$link)
{
die('Could not connect.');
}
$query = 'SELECT name, address, salary FROM employees';
$result = cubrid_execute($link, $query);
if ($result)
{
echo "Fetching column 0 fields: ";
$meta = cubrid_fetch_field($result, 0);
if (!$meta)
{
echo "No information available<br />\n";
}
echo "<pre>
max_length: $meta->max_length
multiple_key: $meta->multiple_key
name: $meta->name
not_null: $meta->not_null
numeric: $meta->numeric
table: $meta->table
type: $meta->type
default: $meta->def
unique_key: $meta->unique_key
</pre>";
cubrid_close_request($result);
}
?>
The above example will output:
Result: Fetching column 0 fields: max_length: 13 multiple_key: 1 name: name not_null: 1 numeric: 0 table: employees type: STRING default: [noname] unique_key: 0