pg_field_is_null

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

pg_field_is_null — 필드가 SQL NULL인지 테스트


설명

pg_field_is_null(PgSql\Result $result, int $row, mixed $field): int

pg_field_is_null(PgSql\Result $result, mixed $field): int

pg_field_is_null()PgSql\Result 인스턴스의 필드가 SQL NULL인지 여부를 테스트합니다.

메모: 이 함수는 pg_fieldisnull()라고 불렸습니다.


매개변수

result
pg_query(), pg_query_params() 또는 pg_execute()(특히)에 의해 반환된 PgSql\Result 인스턴스.
row
가져올 결과의 행 번호입니다. 행은 0부터 번호가 매겨집니다. 생략하면 현재 행을 가져옵니다.
field
필드 번호(0부터 시작)를 int로 또는 필드 이름을 문자열로.

반환 값

주어진 행의 필드가 SQL NULL이면 1을 반환하고 그렇지 않으면 0을 반환합니다. 행이 범위를 벗어나거나 다른 오류가 발생하면 false가 반환됩니다.


변경 로그

버전 설명
8.1.0 result 매개변수는 이제 PgSql\Result 인스턴스를 예상합니다. 이전에는 resource가 필요했습니다.

Examples

예제 #1 pg_field_is_null() 예제

                  
<?php
  $dbconn = pg_connect("dbname=publisher") or die ("Could not connect");
  $res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
  if ($res) {
      if (pg_field_is_null($res, 0, "year") == 1) {
          echo "The value of the field year is null.\n";
      }
      if (pg_field_is_null($res, 0, "year") == 0) {
          echo "The value of the field year is not null.\n";
    }
 }
?>