cubrid_fetch_field
(PECL CUBRID >= 8.3.0)
cubrid_fetch_field — Returns an object with certain properties
Description
This function returns an object with certain properties of the specific column. The properties of the object are:
- name
- 
column name 
- table
- 
name of the table that the column belongs to 
- def
- 
default value of the column 
- max_length
- 
maximum length of the column 
- not_null
- 
1 if the column cannot be NULL 
- unique_key
- 
1 if the column is an unique key 
- multiple_key
- 
1 if the column is a non-unique key 
- numeri
- 
1 if the column is numeric 
- type
- 
the type of the column 
Parameters
- req_identifier
- 
This is the request identifier. 
- field_offset
- 
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. 
Return Values
Object with certain properties of the specific column, when process is successful.
FALSE on failure.
Examples
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