pg_result_status
pg_result_status
Get status of query result
**pg_result_status** PgSql\Result $result int $mode
returns the status of the instance,
or the PostgreSQL command completion tag associated with the result
pg_result_status``PgSql\Result
result``mode
Either to return the numeric status
of the , or
to return the command tag of the .
If not specified, is the default.
PGSQL_STATUS_LONG``result``PGSQL_STATUS_STRING``result``PGSQL_STATUS_LONG
Possible return values are ,
, , , ,
, , and
if is
specified. Otherwise, a containing the PostgreSQL command tag is returned.
PGSQL_EMPTY_QUERY``PGSQL_COMMAND_OK``PGSQL_TUPLES_OK``PGSQL_TUPLES_CHUNK``PGSQL_COPY_OUT``PGSQL_COPY_IN``PGSQL_BAD_RESPONSE``PGSQL_NONFATAL_ERROR``PGSQL_FATAL_ERROR``PGSQL_STATUS_LONG``string
Voorbeeld: example
<?php
// Connect to the database
$conn = pg_pconnect("dbname=publisher");
// Execute a COPY
$result = pg_query($conn, "COPY authors FROM STDIN;");
// Get the result status
$status = pg_result_status($result);
// Determine status
if ($status == PGSQL_COPY_IN)
echo "Copy began.";
else
echo "Copy failed.";
?>
Copy began.
pg_connection_status