PHP Doku:: Returns an object with certain properties - function.cubrid-fetch-field.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenCubridCubrid Funktionencubrid_fetch_field

Ein Service von Reinhard Neidl - Webprogrammierung.

Cubrid Funktionen

<<cubrid_fetch_assoc

cubrid_fetch_lengths>>

cubrid_fetch_field

(PECL CUBRID >= 8.3.0)

cubrid_fetch_fieldReturns an object with certain properties

Beschreibung

object cubrid_fetch_field ( resource $req_identifier [, int $field_offset = 0 ] )

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

Parameter-Liste

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.

Rückgabewerte

Object with certain properties of the specific column, when process is successful.

FALSE on failure.

Beispiele

Beispiel #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($result0);
        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); 
    }
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

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

Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)