cubrid_fetch_field

(PECL CUBRID >= 8.3.1)

cubrid_fetch_field — 결과에서 열 정보를 가져와 객체로 반환


설명

cubrid_fetch_field(resource $result, int $field_offset = 0): object

이 함수는 특정 열의 특정 속성을 가진 개체를 반환합니다. 개체의 속성은 다음과 같습니다.

name
열 이름
table
컬럼이 속한 테이블의 이름
def
열의 기본값
max_length
열의 최대 길이
not_null
열이 NULL일 수 없는 경우 1
primary_key
열이 기본 키인 경우 1
unique_key
열이 고유 키인 경우 1
multiple_key
열이 고유하지 않은 키인 경우 1
numeric
열이 숫자인 경우 1
blob
열이 BLOB인 경우 1
type
열의 유형
unsigned
열이 서명되지 않은 경우 1
zerofill
열이 0으로 채워진 경우 1

매개변수

result
cubrid_execute()를 호출한 result
field_offset
숫자 필드 오프셋입니다. 필드 오프셋이 지정되지 않은 경우 다음 필드(이 함수로 아직 검색되지 않은)가 검색됩니다. field_offset은 0에서 시작합니다.

반환 값

프로세스가 성공한 경우 특정 열의 특정 속성을 가진 개체입니다.

실패시 false.


Examples

예제 #1 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--- Field Properties ---\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);
?>
                  
                

위의 예는 다음을 출력합니다.

array(4) {
  [0]=>
  string(5) "20001"
  [1]=>
  string(5) "16681"
  [2]=>
  string(3) "KOR"
  [3]=>
  string(9) "1988-9-30"
}

--- Field Properties ---
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