(PECL CUBRID >= 8.3.1)
cubrid_fetch_field — Récupère des informations sur une colonne et les retourne sous la forme d'un objet
Cette fonction retourne un objet avec certaines propriétés d'une colonne spécifique. Les propriétés de l'objet sont :
nametabledefmax_lengthnot_nullprimary_keyunique_keymultiple_keynumericblobtypeunsignedzerofillresultresult
provient d'un appel à la fonction cubrid_execute()field_offsetfield_offset commence à zéro.Un objet avec certaines propriétés d'une colonne spécifique, en cas de succès.
false si une erreur survient.
Exemple #1 Exemple avec cubrid_fetch_field()
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$req = cubrid_execute($conn, "SELECT event_code,athlete_code,nation_code,game_date FROM game WHERE host_year=1988 and event_code=20001;");
var_dump(cubrid_fetch_row($req));
cubrid_field_seek($req, 1);
$field = cubrid_fetch_field($req);
printf("\n--- Propriétés des champs ---\n");
printf("%-30s %s\n", "name:", $field->name);
printf("%-30s %s\n", "table:", $field->table);
printf("%-30s \"%s\"\n", "default value:", $field->def);
printf("%-30s %d\n", "max length:", $field->max_length);
printf("%-30s %d\n", "not null:", $field->not_null);
printf("%-30s %d\n", "primary key:", $field->primary_key);
printf("%-30s %d\n", "unique key:", $field->unique_key);
printf("%-30s %d\n", "multiple key:", $field->multiple_key);
printf("%-30s %d\n", "numeric:", $field->numeric);
printf("%-30s %d\n", "blob:", $field->blob);
printf("%-30s %s\n", "type:", $field->type);
printf("%-30s %d\n", "unsigned:", $field->unsigned);
printf("%-30s %d\n", "zerofill:", $field->zerofill);
cubrid_close_request($req);
cubrid_disconnect($conn);
?>L'exemple ci-dessus va afficher :
array(4) {
[0]=>
string(5) "20001"
[1]=>
string(5) "16681"
[2]=>
string(3) "KOR"
[3]=>
string(9) "1988-9-30"
}
--- Propriétés des champs ---
name: athlete_code
table: game
default value: ""
max length: 0
not null: 1
primary key: 1
unique key: 1
multiple key: 0
numeric: 1
blob: 0
type: integer
unsigned: 0
zerofill: 0