pg_cancel_query

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

pg_cancel_query - 비동기 쿼리 취소


설명

pg_cancel_query(PgSql\Connection $connection): bool

pg_cancel_query()pg_send_query(), pg_send_query_params() 또는 pg_send_execute()로 보낸 비동기 쿼리를 취소합니다. pg_query()를 사용하여 실행된 쿼리를 취소할 수 없습니다.


매개변수

connection
PgSql\Connection 인스턴스입니다.

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


변경 로그

버전 설명
8.1.0 connection 매개변수는 이제 PgSql\Connection 인스턴스를 필요로 합니다. 이전에는 리소스가 필요했습니다.

Examples

예제 #1 pg_cancel_query() 예제

                  
<?php
  $dbconn = pg_connect("dbname=publisher") or die("Could not connect");

  if (!pg_connection_busy($dbconn)) {
      pg_send_query($dbconn, "select * from authors; select count(*) from authors;");
  }

  $res1 = pg_get_result($dbconn);
  echo "First call to pg_get_result(): $res1\n";
  $rows1 = pg_num_rows($res1);
  echo "$res1 has $rows1 records\n\n";

  // Cancel the currently running query.  Will be the second query if it is
  // still running.
  pg_cancel_query($dbconn);
?>
                  
                

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

First call to pg_get_result(): Resource id #3
Resource id #3 has 3 records
                

기타