(PECL CUBRID >= 8.3.0)
cubrid_field_flags — 傳回指定欄位偏移量的旗標字串
此函式會傳回一個字串,其中包含以空格分隔的指定欄位偏移量的旗標。您可以使用 explode 來分割傳回值。可能的旗標包括:not_null
、primary_key
、unique_key
、foreign_key
、auto_increment
、shared
、reverse_index
、reverse_unique
和 timestamp
。
result
result
參數來自 cubrid_execute() 的呼叫結果。
field_offset
欄位偏移量的數值。 field_offset
從 0 開始。如果 field_offset
不存在,也會發出等級為 E_WARNING
的錯誤。
範例 #1 cubrid_field_flags() 範例
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$result = cubrid_execute($conn, "SELECT * FROM game WHERE host_year=2004 AND nation_code='AUS' AND medal='G'");
$col_num = cubrid_num_cols($result);
printf("%-30s %s\n", "欄位名稱", "欄位標記");
for($i = 0; $i < $col_num; $i++) {
printf("%-30s %s\n", cubrid_field_name($result, $i), cubrid_field_flags($result, $i));
}
cubrid_disconnect($conn);
?>
以上範例將輸出
Field Name Field Flags host_year not_null primary_key unique_key event_code not_null primary_key unique_key foreign_key athlete_code not_null primary_key unique_key foreign_key stadium_code not_null nation_code medal game_date