3 * This is a modern binding to the mature [libpq](http://www.postgresql.org/docs/current/static/libpq.html), the official PostgreSQL C-client library.
7 * * Nearly 100% support for [asynchronous usage](pq/Connection/: Asynchronous Usage).
8 * * Extended [type support by pg_type](pq/Types/: Overview).
9 * * Fetching simple [multi-dimensional array maps](pq/Result/map).
10 * * Working [Gateway implementation](https://bitbucket.org/m6w6/pq-gateway).
15 * Fast import/export using COPY.
19 * Start a COPY operation from STDIN to the PostgreSQL server.
23 * Start a COPY operation from the server to STDOUT.
27 * The connection to the PostgreSQL server.
35 * The expression of the COPY statement used to start the operation.
43 * The drection of the COPY operation (pq\COPY::FROM_STDIN or pq\COPY::TO_STDOUT).
51 * Any additional options used to start the COPY operation.
59 * Start a COPY operation.
61 * @param \pq\Connection $conn The connection to use for the COPY operation.
62 * @param string $expression The expression generating the data to copy.
63 * @param int $direction Data direction (pq\COPY::FROM_STDIN or pq\COPY::TO_STDOUT).
64 * @param string $options Any COPY options (see the [official PostgreSQL documentation](http://www.postgresql.org/docs/current/static/sql-copy.html) for details.
65 * @throws \pq\Exception\InvalidArgumentException
66 * @throws \pq\Exception\BadMethodCallException
67 * @throws \pq\Exception\RuntimeException
69 function __construct(\pq\Connection
$conn, string $expression, int $direction, string $options = NULL) {}
71 * End the COPY operation to the server during pq\Result::COPY_IN state.
73 * @param string $error If set, the COPY operation will abort with provided message.
74 * @throws \pq\Exception\InvalidArgumentException
75 * @throws \pq\Exception\BadMethodCallException
76 * @throws \pq\Exception\RuntimeException
78 function end(string $error = NULL) {}
80 * Receive data from the server during pq\Result::COPY_OUT state.
82 * @param string $data Data read from the server.
83 * @throws \pq\Exception\InvalidArgumentException
84 * @throws \pq\Exception\BadMethodCallException
85 * @throws \pq\Exception\RuntimeException
86 * @return bool success.
88 function get(string &$data) {}
90 * Send data to the server during pq\Result::COPY_IN state.
92 * @param string $data Data to send to the server.
93 * @throws \pq\Exception\InvalidArgumentException
94 * @throws \pq\Exception\BadMethodCallException
95 * @throws \pq\Exception\RuntimeException
97 function put(string $data) {}
100 * Request cancellation of an asynchronous query.
104 * The connection to cancel the query on.
108 * @var \pq\Connection
112 * Create a new cancellation request for an [asynchronous](pq/Connection/: Asynchronous Usage) query.
114 * @param \pq\Connection $conn The connection to request cancellation on.
115 * @throws \pq\Exception\InvalidArgumentException
116 * @throws \pq\Exception\BadMethodCallException
117 * @throws \pq\Exception\RuntimeException
119 function __construct(\pq\Connection
$conn) {}
121 * Perform the cancellation request.
123 * @throws \pq\Exception\InvalidArgumentException
124 * @throws \pq\Exception\BadMethodCallException
125 * @throws \pq\Exception\RuntimeException
130 * The connection to the PostgreSQL server.
132 * See the [General Usage](pq/Connection/: General Usage) page for an introduction on how to use this class.
136 * (Re-)open a persistent connection.
138 const PERSISTENT
= 2;
140 * If the connection is not already open, perform the connection attempt [asynchronously](pq/Connection/: Asynchronous Usage).
144 * Everything well; if a connection has been newly and synchronously created, the connection will always have this status right after creation.
148 * Broken connection; consider pq\Connection::reset() or recreation.
152 * Waiting for connection to be made.
156 * Connection okay; waiting to send.
160 * Waiting for a response from the server.
162 const AWAITING_RESPONSE
= 4;
164 * Received authentication; waiting for backend start-up to finish.
168 * Negotiating SSL encryption.
170 const SSL_STARTUP
= 7;
172 * Negotiating environment-driven parameter settings.
176 * No active transaction.
178 const TRANS_IDLE
= 0;
180 * A transaction command is in progress.
182 const TRANS_ACTIVE
= 1;
184 * Idling in a valid transaction block.
186 const TRANS_INTRANS
= 2;
188 * Idling in a failed transaction block.
190 const TRANS_INERROR
= 3;
194 const TRANS_UNKNOWN
= 4;
196 * The connection procedure has failed.
198 const POLLING_FAILED
= 0;
200 * Select for read-readiness.
202 const POLLING_READING
= 1;
204 * Select for write-readiness.
206 const POLLING_WRITING
= 2;
208 * The connection has been successfully made.
210 const POLLING_OK
= 3;
212 * Register the event handler for notices.
214 const EVENT_NOTICE
= 'notice';
216 * Register the event handler for any created results.
218 const EVENT_RESULT
= 'result';
220 * Register the event handler for connection resets.
222 const EVENT_RESET
= 'reset';
224 * A [connection status constant](pq/Connection#Connection.Status:) value.
232 * A [transaction status constant](pq/Connection#Transaction.Status:) value.
238 public $transactionStatus;
240 * The server socket resource.
248 * Whether the connection is busy with [asynchronous operations](pq/Connection/: Asynchronous Usage).
256 * Any error message on failure.
262 public $errorMessage;
264 * List of registered event handlers.
270 public $eventHandlers;
272 * Connection character set.
277 public $encoding = NULL;
279 * Whether to fetch [asynchronous](pq/Connection/: Asynchronous Usage) results in unbuffered mode, i.e. each row generates a distinct pq\Result.
284 public $unbuffered = FALSE;
286 * Whether to set the underlying socket nonblocking, useful for asynchronous handling of writes. See also pq\Connection::flush().
288 * ### Connection Information:
293 public $nonblocking = FALSE;
295 * The database name of the connection.
303 * The user name of the connection.
311 * The password of the connection.
319 * The server host name of the connection.
327 * The port of the connection.
335 * The command-line options passed in the connection request.
337 * ### Inheritable Defaults:
345 * Default fetch type for future pq\Result instances.
350 public $defaultFetchType = \pq\Result
::FETCH_ARRAY
;
352 * Default conversion bitmask for future pq\Result instances.
357 public $defaultAutoConvert = \pq\Result
::CONV_ALL
;
359 * Default transaction isolation level for future pq\Transaction instances.
364 public $defaultTransactionIsolation = \pq\Transaction
::READ_COMMITTED
;
366 * Default transaction readonlyness for future pq\Transaction instances.
371 public $defaultTransactionReadonly = FALSE;
373 * Default transaction deferrability for future pq\Transaction instances.
378 public $defaultTransactionDeferrable = FALSE;
380 * Create a new PostgreSQL connection.
381 * See also [General Usage](pq/Connection/: General Usage).
383 * @param string $dsn A ***connection string*** as described [in the PostgreSQL documentation](http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING).
384 * @param int $flags See [connection flag constants](pq/Connection#Connection.Flags:).
385 * @throws \pq\Exception\InvalidArgumentException
386 * @throws \pq\Exception\BadMethodCallException
387 * @throws \pq\Exception\RuntimeException
389 function __construct(string $dsn = "", int $flags = 0) {}
391 * Declare a cursor for a query.
393 * @param string $name The identifying name of the cursor.
394 * @param int $flags Any combination of pq\Cursor constants.
395 * @param string $query The query for which to open a cursor.
396 * @throws \pq\Exception\InvalidArgumentException
397 * @throws \pq\Exception\RuntimeException
398 * @throws \pq\Exception\BadMethodCallException
399 * @return \pq\Cursor an open cursor instance.
401 function declare(string $name, int $flags, string $query) {}
403 * [Asynchronously](pq/Connection/: Asynchronous Usage) declare a cursor for a query.
406 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
408 * @param string $name The identifying name of the cursor.
409 * @param int $flags Any combination of pq\Cursor constants.
410 * @param string $query The query for which to open a cursor.
411 * @throws \pq\Exception\InvalidArgumentException
412 * @throws \pq\Exception\RuntimeException
413 * @throws \pq\Exception\BadMethodCallException
414 * @return \pq\Cursor an open cursor instance.
416 function declareAsync(string $name, int $flags, string $query) {}
418 * Escape binary data for use within a query with the type bytea.
421 * The result is not wrapped in single quotes.
423 * @param string $binary The binary data to escape.
424 * @throws \pq\Exception\BadMethodCallException
425 * @return string|FALSE string the escaped binary data.
426 * or FALSE if escaping fails.
428 function escapeBytea(string $binary) {}
430 * [Execute one or multiple SQL queries](pq/Connection/: Executing Queries) on the connection.
433 * > Only the last result will be returned, if the query string contains more than one SQL query.
435 * @param string $query The queries to send to the server, separated by semi-colon.
436 * @throws \pq\Exception\InvalidArgumentException
437 * @throws \pq\Exception\BadMethodCallException
438 * @throws \pq\Exception\RuntimeException
439 * @throws \pq\Exception\DomainException
442 function exec(string $query) {}
444 * [Asynchronously](pq/Connection/: Asynchronous Usage) [execute an SQL query](pq/Connection: Executing Queries) on the connection.
447 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
449 * @param string $query The query to send to the server.
450 * @param callable $callback as function(pq\Result $res)
451 * The callback to execute when the query finishes.
452 * @throws \pq\Exception\InvalidArgumentException
453 * @throws \pq\Exception\BadMethodCallException
454 * @throws \pq\Exception\RuntimeException
456 function execAsync(string $query, callable
$callback = NULL) {}
458 * [Execute an SQL query](pq/Connection: Executing Queries) with properly escaped parameters substituted.
460 * @param string $query The query to execute.
461 * @param array $params The parameter list to substitute.
462 * @param array $types Corresponding list of type OIDs for the parameters.
463 * @throws \pq\Exception\InvalidArgumentException
464 * @throws \pq\Exception\RuntimeException
465 * @throws \pq\Exception\DomainException
468 function execParams(string $query, array $params, array $types = NULL) {}
470 * [Asynchronously](pq/Connection/: Asynchronous Usage) [execute an SQL query](pq/Connection: Executing Queries) with properly escaped parameters substituted.
473 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
475 * @param string $query The query to execute.
476 * @param array $params The parameter list to substitute.
477 * @param array $types Corresponding list of type OIDs for the parameters.
478 * @param callable $cb as function(\pq\Result $res) : void
479 * Result handler callback.
480 * @throws \pq\Exception\InvalidArgumentException
481 * @throws \pq\Exception\RuntimeException
482 * @throws \pq\Exception\BadMethodCallException
484 function execParamsAsync(string $query, array $params, array $types = NULL, callable
$cb = NULL) {}
486 * Flush pending writes on the connection.
487 * Call after sending any command or data on a nonblocking connection.
489 * If it returns FALSE, wait for the socket to become read or write-ready.
490 * If it becomes write-ready, call pq\Connection::flush() again.
491 * If it becomes read-ready, call pq\Connection::poll(), then call pq\Connection::flush() again.
492 * Repeat until pq\Connection::flush() returns TRUE.
495 * > This method was added in v1.1.0, resp. v2.1.0.
497 * @throws \pq\Exception\InvalidArgumentException
498 * @throws \pq\Exception\RuntimeException
499 * @return bool whether everything has been flushed.
503 * Fetch the result of an [asynchronous](pq/Connection/: Asynchronous Usage) query.
505 * If the query hasn't finished yet, the call will block until the result is available.
507 * @throws \pq\Exception\InvalidArgumentException
508 * @throws \pq\Exception\BadMethodCallException
509 * @return NULL|\pq\Result NULL if there has not been a query
510 * or \pq\Result when the query has finished
512 function getResult() {}
514 * Listen on $channel for notifications.
515 * See pq\Connection::unlisten().
517 * @param string $channel The channel to listen on.
518 * @param callable $listener as function(string $channel, string $message, int $pid)
519 * A callback automatically called whenever a notification on $channel arrives.
520 * @throws \pq\Exception\InvalidArgumentException
521 * @throws \pq\Exception\BadMethodCallException
522 * @throws \pq\Exception\RuntimeException
524 function listen(string $channel, callable
$listener) {}
526 * [Asynchronously](pq/Connection/: Asynchronous Usage) start listening on $channel for notifcations.
527 * See pq\Connection::listen().
529 * @param string $channel The channel to listen on.
530 * @param callable $listener as function(string $channel, string $message, int $pid)
531 * A callback automatically called whenever a notification on $channel arrives.
532 * @throws \pq\Exception\InvalidArgumentException
533 * @throws \pq\Exception\BadMethodCallException
534 * @throws \pq\Exception\RuntimeException
536 function listenAsync(string $channel, callable
$listener) {}
538 * Notify all listeners on $channel with $message.
540 * @param string $channel The channel to notify.
541 * @param string $message The message to send.
542 * @throws \pq\Exception\InvalidArgumentException
543 * @throws \pq\Exception\BadMethodCallException
544 * @throws \pq\Exception\RuntimeException
546 function notify(string $channel, string $message) {}
548 * [Asynchronously](pq/Connection/: Asynchronous Usage) start notifying all listeners on $channel with $message.
550 * @param string $channel The channel to notify.
551 * @param string $message The message to send.
552 * @throws \pq\Exception\InvalidArgumentException
553 * @throws \pq\Exception\BadMethodCallException
554 * @throws \pq\Exception\RuntimeException
556 function notifyAsync(string $channel, string $message) {}
558 * Stops listening for an event type.
560 * @param string $event Any pq\Connection::EVENT_*.
561 * @throws \pq\Exception\InvalidArgumentException
562 * @throws \pq\Exception\BadMethodCallException
563 * @return bool success.
565 function off(string $event) {}
567 * Listen for an event.
569 * @param string $event Any pq\Connection::EVENT_*.
570 * @param callable $callback as function(pq\Connection $c[, pq\Result $r)
571 * The callback to invoke on event.
572 * @throws \pq\Exception\InvalidArgumentException
573 * @throws \pq\Exception\BadMethodCallException
574 * @return int number of previously attached event listeners.
576 function on(string $event, callable
$callback) {}
578 * Poll an [asynchronously](pq/Connection/: Asynchronous Usage) operating connection.
579 * See pq\Connection::resetAsync() for an usage example.
581 * @throws \pq\Exception\InvalidArgumentException
582 * @throws \pq\Exception\RuntimeException
583 * @throws \pq\Exception\BadMethodCallException
584 * @return int pq\Connection::POLLING_* constant
588 * Prepare a named statement for later execution with pq\Statement::execute().
590 * @param string $name The identifying name of the prepared statement.
591 * @param string $query The query to prepare.
592 * @param array $types An array of type OIDs for the substitution parameters.
593 * @throws \pq\Exception\InvalidArgumentException
594 * @throws \pq\Exception\BadMethodCallException
595 * @throws \pq\Exception\RuntimeException
596 * @return \pq\Statement a prepared statement instance.
598 function prepare(string $name, string $query, array $types = NULL) {}
600 * [Asynchronously](pq/Connection/: Asynchronous Usage) prepare a named statement for later execution with pq\Statement::exec().
603 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
605 * @param string $name The identifying name of the prepared statement.
606 * @param string $query The query to prepare.
607 * @param array $types An array of type OIDs for the substitution parameters.
608 * @throws \pq\Exception\InvalidArgumentException
609 * @throws \pq\Exception\BadMethodCallException
610 * @throws \pq\Exception\RuntimeException
611 * @return \pq\Statement a prepared statement instance.
613 function prepareAsync(string $name, string $query, array $types = NULL) {}
615 * Quote a string for safe use in a query.
616 * The result is truncated at any zero byte and wrapped in single quotes.
619 * Beware of matching character encodings.
621 * @param string $payload The payload to quote for use in a query.
622 * @throws \pq\Exception\BadMethodCallException
623 * @return string|FALSE string a single-quote wrapped string safe for literal use in a query.
624 * or FALSE if quoting fails.
626 function quote(string $payload) {}
628 * Quote an identifier for safe usage as name.
631 * Beware of case-sensitivity.
633 * @param string $name The name to quote.
634 * @throws \pq\Exception\BadMethodCallException
635 * @return string|FALSE string the quoted identifier.
636 * or FALSE if quoting fails.
638 function quoteName(string $name) {}
640 * Attempt to reset a possibly broken connection to a working state.
642 * @throws \pq\Exception\InvalidArgumentException
643 * @throws \pq\Exception\BadMethodCallException
644 * @throws \pq\Exception\RuntimeException
648 * [Asynchronously](pq/Connection/: Asynchronous Usage) reset a possibly broken connection to a working state.
650 * @throws \pq\Exception\InvalidArgumentException
651 * @throws \pq\Exception\BadMethodCallException
652 * @throws \pq\Exception\RuntimeException
654 function resetAsync() {}
656 * Set a data type converter.
658 * @param \pq\Converter $converter An instance implementing pq\Converter.
659 * @throws \pq\Exception\InvalidArgumentException
660 * @throws \pq\Exception\BadMethodCallException
662 function setConverter(\pq\Converter
$converter) {}
664 * Begin a transaction.
666 * @param int $isolation Any pq\Transaction isolation level constant
667 * (defaults to pq\Connection::$defaultTransactionIsolation).
668 * @param bool $readonly Whether the transaction executes only reads
669 * (defaults to pq\Connection::$defaultTransactionReadonly).
670 * @param bool $deferrable Whether the transaction is deferrable
671 * (defaults to pq\Connection::$defaultTransactionDeferrable).
674 * A transaction can only be deferrable if it also is readonly and serializable.
675 * See the official [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/sql-set-transaction.html) for further information.
676 * @throws \pq\Exception\InvalidArgumentException
677 * @throws \pq\Exception\BadMethodCallException
678 * @throws \pq\Exception\RuntimeException
679 * @return \pq\Transaction a begun transaction instance.
681 function startTransaction(int $isolation = \pq\Transaction
::READ_COMMITTED
, bool $readonly = FALSE, bool $deferrable = FALSE) {}
683 * [Asynchronously](pq/Connection/: Asynchronous Usage) begin a transaction.
685 * @param int $isolation Any pq\Transaction isolation level constant
686 * (defaults to pq\Connection::$defaultTransactionIsolation).
687 * @param bool $readonly Whether the transaction executes only reads
688 * (defaults to pq\Connection::$defaultTransactionReadonly).
689 * @param bool $deferrable Whether the transaction is deferrable
690 * (defaults to pq\Connection::$defaultTransactionDeferrable).
693 * A transaction can only be deferrable if it also is readonly and serializable.
694 * See the official [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/sql-set-transaction.html) for further information.
695 * @throws \pq\Exception\InvalidArgumentException
696 * @throws \pq\Exception\BadMethodCallException
697 * @throws \pq\Exception\RuntimeException
698 * @return \pq\Transaction an asynchronously begun transaction instance.
700 function startTransactionAsync(int $isolation = \pq\Transaction
::READ_COMMITTED
, bool $readonly = FALSE, bool $deferrable = FALSE) {}
702 * Trace protocol communication with the server.
705 * Calling pq\Connection::trace() without argument or NULL stops tracing.
707 * @param resource $stream The resource to which the protocol trace will be output.
708 * (The stream must be castable to STDIO).
709 * @throws \pq\Exception\BadMethodCallException
710 * @return bool success.
712 function trace($stream = NULL) {}
714 * Unescape bytea data retrieved from the server.
716 * @param string $bytea Bytea data retrieved from the server.
717 * @throws \pq\Exception\BadMethodCallException
718 * @return string|FALSE string unescaped binary data.
719 * or FALSE if unescaping fails.
721 function unescapeBytea(string $bytea) {}
723 * Stop listening for notifications on channel $channel.
724 * See pq\Connection::listen().
726 * @param string $channel The name of a channel which is currently listened on.
727 * @throws \pq\Exception\InvalidArgumentException
728 * @throws \pq\Exception\BadMethodCallException
729 * @throws \pq\Exception\RuntimeException
731 function unlisten(string $channel) {}
733 * [Asynchronously](pq/Connection/: Asynchronous Usage) stop listening for notifications on channel $channel.
734 * See pq\Connection::unlisten() and pq\Connection::listenAsync().
736 * @param string $channel The name of a channel which is currently listened on.
737 * @throws \pq\Exception\InvalidArgumentException
738 * @throws \pq\Exception\BadMethodCallException
739 * @throws \pq\Exception\RuntimeException
741 function unlistenAsync(string $channel) {}
743 * Stop applying a data type converter.
745 * @param \pq\Converter $converter A converter previously set with pq\Connection::setConverter().
746 * @throws \pq\Exception\InvalidArgumentException
747 * @throws \pq\Exception\BadMethodCallException
749 function unsetConverter(\pq\Converter
$converter) {}
752 * Interface for type conversions.
754 interface Converter
{
756 * Convert a string received from the PostgreSQL server back to a PHP type.
758 * @param string $data String data received from the server.
759 * @param int $type The type OID of the data. Irrelevant for single-type converters.
760 * @return mixed the value converted to a PHP type.
762 function convertFromString(string $data, int $type);
764 * Convert a value to a string for use in a query.
766 * @param mixed $value The PHP value which should be converted to a string.
767 * @param int $type The type OID the converter should handle. Irrelevant for singly-type converters.
768 * @return string a textual representation of the value accepted by the PostgreSQL server.
770 function convertToString($value, int $type);
772 * Announce which types the implementing converter can handle.
774 * @return array OIDs of handled types.
776 function convertTypes();
783 * Causes the cursor to return data in binary rather than in text format. You probably do not want to use that.
787 * The data returned by the cursor should be unaffected by updates to the tables underlying the cursor that take place after the cursor was opened.
789 const INSENSITIVE
= 2;
791 * The cursor should stay usable after the transaction that created it was successfully committed.
795 * Force that rows can be retrieved in any order from the cursor.
799 * Force that rows are only retrievable in sequiential order.
802 * See the [notes in the official PostgreSQL documentation](http://www.postgresql.org/docs/current/static/sql-declare.html#SQL-DECLARE-NOTES) for more information.
804 const NO_SCROLL
= 32;
806 * The connection the cursor was declared on.
810 * @var \pq\Connection
814 * The identifying name of the cursor.
823 * See pq\Connection::declare().
825 * @param \pq\Connection $connection The connection on which the cursor should be declared.
826 * @param string $name The name of the cursor.
827 * @param int $flags See pq\Cursor constants.
828 * @param string $query The query for which the cursor should be opened.
829 * @param bool $async Whether to declare the cursor [asynchronously](pq/Connection/: Asynchronous Usage).
830 * @throws \pq\Exception\InvalidArgumentException
831 * @throws \pq\Exception\BadMethodCallException
832 * @throws \pq\Exception\RuntimeException
834 function __construct(\pq\Connection
$connection, string $name, int $flags, string $query, bool $async) {}
836 * Close an open cursor.
837 * This is a no-op on already closed cursors.
839 * @throws \pq\Exception\InvalidArgumentException
840 * @throws \pq\Exception\BadMethodCallException
841 * @throws \pq\Exception\RuntimeException
845 * [Asynchronously](pq/Connection/: Asynchronous Usage) close an open cursor.
846 * See pq\Cursor::close().
848 * @throws \pq\Exception\InvalidArgumentException
849 * @throws \pq\Exception\BadMethodCallException
850 * @throws \pq\Exception\RuntimeException
852 function closeAsync() {}
854 * Fetch rows from the cursor.
855 * See pq\Cursor::move().
857 * @param string $spec What to fetch.
859 * ### Fetch argument:
861 * FETCH and MOVE usually accepts arguments like the following, where `count` is the number of rows:
862 * @throws \pq\Exception\InvalidArgumentException
863 * @throws \pq\Exception\BadMethodCallException
864 * @throws \pq\Exception\RuntimeException
865 * @return \pq\Result the fetched row(s).
867 function fetch(string $spec = "1") {}
869 * [Asynchronously](pq/Connection/: Asynchronous Usage) fetch rows from the cursor.
870 * See pq\Cursor::fetch().
872 * @param string $spec What to fetch.
873 * @param callable $callback as function(pq\Result $res)
874 * A callback to execute when the result is ready.
875 * @throws \pq\Exception\InvalidArgumentException
876 * @throws \pq\Exception\BadMethodCallException
877 * @throws \pq\Exception\RuntimeException
879 function fetchAsync(string $spec = "1", callable
$callback = NULL) {}
882 * See pq\Cursor::fetch().
884 * @param string $spec What to fetch.
886 * ### Fetch argument:
888 * FETCH and MOVE usually accepts arguments like the following, where `count` is the number of rows:
889 * @throws \pq\Exception\InvalidArgumentException
890 * @throws \pq\Exception\BadMethodCallException
891 * @throws \pq\Exception\RuntimeException
892 * @return \pq\Result command status.
894 function move(string $spec = "1") {}
896 * [Asynchronously](pq/Connection/: Asynchronous Usage) move the cursor.
897 * See pq\Cursor::move().
899 * @param string $spec What to fetch.
900 * @param callable $callback as function(pq\Result $res)
901 * A callback to execute when the command completed.
902 * @throws \pq\Exception\InvalidArgumentException
903 * @throws \pq\Exception\BadMethodCallException
904 * @throws \pq\Exception\RuntimeException
906 function moveAsync(string $spec = "1", callable
$callback = NULL) {}
909 * This is a no-op on already open cursors.
912 * Only cursors closed by pq\Cursor::close() will be reopened.
914 * @throws \pq\Exception\InvalidArgumentException
915 * @throws \pq\Exception\BadMethodCallException
916 * @throws \pq\Exception\RuntimeException
920 * [Asynchronously](pq/Connection/: Asynchronous Usage) reopen a cursor.
921 * See pq\Cursor::open().
923 * @throws \pq\Exception\InvalidArgumentException
924 * @throws \pq\Exception\BadMethodCallException
925 * @throws \pq\Exception\RuntimeException
927 function openAsync() {}
930 * A simple DateTime wrapper with predefined formats which supports stringification and JSON.
932 class DateTime
extends \DateTime
implements \JsonSerializable
{
934 * The default format of any date/time type automatically converted by pq\Result (depends on the actual type of the column).
939 public $format = "Y-m-d H:i:s.uO";
941 * Stringify the DateTime instance according to pq\DateTime::$format.
943 * @return string the DateTime as string.
945 function __toString() {}
948 * Alias of pq\DateTime::__toString().
950 * @return string the DateTime stringified according to pq\DateTime::$format.
952 function jsonSerialize() {}
955 * A base interface for all pq\Exception classes.
957 interface Exception
{
959 * An invalid argument was passed to a method (pq\Exception\InvalidArgumentException).
961 const INVALID_ARGUMENT
= 0;
963 * A runtime exception occurred (pq\Exception\RuntimeException).
967 * The connection failed (pq\Exception\RuntimeException).
969 const CONNECTION_FAILED
= 2;
971 * An input/output exception occurred (pq\Exception\RuntimeException).
975 * Escaping an argument or identifier failed internally (pq\Exception\RuntimeException).
979 * An object's constructor was not called (pq\Exception\BadMethodCallException).
981 const UNINITIALIZED
= 6;
983 * Calling this method was not expected (yet) (pq\Exception\BadMethodCallException).
985 const BAD_METHODCALL
= 5;
987 * SQL syntax error (pq\Exception\DomainException).
991 * Implementation domain error (pq\Exception\DomainException).
999 * Working with *large objects* requires an active transaction.
1003 * 0, representing an invalid OID.
1005 const INVALID_OID
= 0;
1011 * The transaction wrapping the operations on the *large object*.
1015 * @var \pq\Transaction
1017 public $transaction;
1019 * The OID of the *large object*.
1027 * The stream connected to the *large object*.
1035 * Open or create a *large object*.
1036 * See pq\Transaction::openLOB() and pq\Transaction::createLOB().
1038 * @param \pq\Transaction $txn The transaction which wraps the *large object* operations.
1039 * @param int $oid The OID of the existing *large object* to open.
1040 * @param int $mode Access mode (read, write or read/write).
1041 * @throws \pq\Exception\InvalidArgumentException
1042 * @throws \pq\Exception\BadMethodCallException
1043 * @throws \pq\Exception\RuntimeException
1045 function __construct(\pq\Transaction
$txn, int $oid = \pq\LOB
::INVALID_OID
, int $mode = \pq\LOB
::RW
) {}
1047 * Read a string of data from the current position of the *large object*.
1049 * @param int $length The amount of bytes to read from the *large object*.
1050 * @param int $read The amount of bytes actually read from the *large object*.
1051 * @throws \pq\Exception\InvalidArgumentException
1052 * @throws \pq\Exception\BadMethodCallException
1053 * @throws \pq\Exception\RuntimeException
1054 * @return string the data read.
1056 function read(int $length = 0x1000, int &$read = NULL) {}
1058 * Seek to a position within the *large object*.
1060 * @param int $offset The position to seek to.
1061 * @param int $whence From where to seek (SEEK_SET, SEEK_CUR or SEEK_END).
1062 * @throws \pq\Exception\InvalidArgumentException
1063 * @throws \pq\Exception\BadMethodCallException
1064 * @throws \pq\Exception\RuntimeException
1065 * @return int the new position.
1067 function seek(int $offset, int $whence = SEEK_SET
) {}
1069 * Retrieve the current position within the *large object*.
1071 * @throws \pq\Exception\InvalidArgumentException
1072 * @throws \pq\Exception\BadMethodCallException
1073 * @throws \pq\Exception\RuntimeException
1074 * @return int the current position.
1078 * Truncate the *large object*.
1080 * @param int $length The length to truncate to.
1081 * @throws \pq\Exception\InvalidArgumentException
1082 * @throws \pq\Exception\BadMethodCallException
1083 * @throws \pq\Exception\RuntimeException
1085 function truncate(int $length = 0) {}
1087 * Write data to the *large object*.
1089 * @param string $data The data that should be written to the current position.
1090 * @return int the number of bytes written.
1092 function write(string $data) {}
1097 * See [Fetching Results](pq/Result/: Fetching Results) for a general overview.
1099 class Result
implements \Traversable
, \Countable
{
1101 * The query sent to the server was empty.
1103 const EMPTY_QUERY
= 0;
1105 * The query did not generate a result set and completed successfully.
1107 const COMMAND_OK
= 1;
1109 * The query successfully generated a result set.
1111 const TUPLES_OK
= 2;
1113 * The result contains a single row of the result set when using pq\Connection::$unbuffered.
1115 const SINGLE_TUPLE
= 9;
1117 * COPY data can be received from the server.
1121 * COPY data can be sent to the server.
1125 * COPY in/out data transfer in progress.
1127 const COPY_BOTH
= 8;
1129 * The server sent a bad response.
1131 const BAD_RESPONSE
= 5;
1133 * A nonfatal error (notice or warning) occurred.
1135 const NONFATAL_ERROR
= 6;
1137 * A fatal error occurred.
1139 const FATAL_ERROR
= 7;
1141 * Fetch rows numerically indexed, where the index start with 0.
1143 const FETCH_ARRAY
= 0;
1145 * Fetch rows associatively indexed by column name.
1147 const FETCH_ASSOC
= 1;
1149 * Fetch rows as stdClass instance, where the column names are the property names.
1151 const FETCH_OBJECT
= 2;
1153 * Automatically convert 'f' and 't' to FALSE and TRUE and vice versa.
1155 const CONV_BOOL
= 1;
1157 * Automatically convert integral strings to either int if it fits into maximum integer size or else to float and vice versa.
1161 * Automatically convert floating point numbers.
1163 const CONV_FLOAT
= 4;
1165 * Do all scalar conversions listed above.
1167 const CONV_SCALAR
= 15;
1169 * Automatically convert arrays.
1171 const CONV_ARRAY
= 16;
1173 * Automatically convert date strings to pq\DateTime and vice versa.
1175 const CONV_DATETIME
= 32;
1177 * Automatically convert JSON.
1179 const CONV_JSON
= 256;
1181 * Do all of the above.
1183 const CONV_ALL
= 65535;
1185 * A [status constant](pq/Result#Status.values:).
1193 * The accompanying status message.
1199 public $statusMessage;
1201 * Any error message if $status indicates an error.
1207 public $errorMessage;
1209 * The number of rows in the result set.
1217 * The number of fields in a single tuple of the result set.
1225 * The number of rows affected by a statement.
1231 public $affectedRows;
1233 * Error details. See [PQresultErrorField](https://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD) docs.
1241 * The [type of return value](pq/Result#Fetch.types:) the fetch methods should return when no fetch type argument was given. Defaults to pq\Connection::$defaultFetchType.
1246 public $fetchType = \pq\Result
::FETCH_ARRAY
;
1248 * What [type of conversions](pq/Result#Conversion.bits:) to perform automatically.
1253 public $autoConvert = \pq\Result
::CONV_ALL
;
1255 * Bind a variable to a result column.
1256 * See pq\Result::fetchBound().
1258 * @param mixed $col The column name or index to bind to.
1259 * @param mixed $var The variable reference.
1260 * @throws \pq\Exception\InvalidArgumentException
1261 * @throws \pq\Exception\BadMethodCallException
1262 * @return bool success.
1264 function bind($col, $var) {}
1266 * Count number of rows in this result set.
1268 * @throws \pq\Exception\InvalidArgumentException
1269 * @throws \pq\Exception\BadMethodCallException
1270 * @return int the number of rows.
1274 * Describe a prepared statement.
1277 * This will only return meaningful information for a result of pq\Statement::desc().
1279 * @throws \pq\Exception\InvalidArgumentException
1280 * @throws \pq\Exception\BadMethodCallException
1281 * @return array list of parameter type OIDs for the prepared statement.
1285 * Fetch all rows at once.
1287 * @param int $fetch_type The type the return value should have, see pq\Result::FETCH_* constants, defaults to pq\Result::$fetchType.
1288 * @throws \pq\Exception\InvalidArgumentException
1289 * @throws \pq\Exception\BadMethodCallException
1290 * @return array all fetched rows.
1292 function fetchAll(int $fetch_type = NULL) {}
1294 * Fetch all rows of a single column.
1296 * @param int $col The column name or index to fetch.
1297 * @throws \pq\Exception\InvalidArgumentException
1298 * @throws \pq\Exception\BadMethodCallException
1299 * @throws \pq\Exception\RuntimeException
1300 * @return array list of column values.
1302 function fetchAllCols(int $col = 0) {}
1304 * Iteratively fetch a row into bound variables.
1305 * See pq\Result::bind().
1307 * @throws \pq\Exception\InvalidArgumentException
1308 * @throws \pq\Exception\BadMethodCallException
1309 * @throws \pq\Exception\RuntimeException
1310 * @return array|NULL array the fetched row as numerically indexed array.
1311 * or NULL when iteration ends.
1313 function fetchBound() {}
1315 * Iteratively fetch a single column.
1317 * @param mixed $ref The variable where the column value will be stored in.
1318 * @param mixed $col The column name or index.
1319 * @throws \pq\Exception\InvalidArgumentException
1320 * @throws \pq\Exception\BadMethodCallException
1321 * @throws \pq\Exception\RuntimeException
1322 * @return bool|NULL bool success.
1323 * or NULL when iteration ends.
1325 function fetchCol($ref, $col = 0) {}
1327 * Iteratively fetch a row.
1329 * @param int $fetch_type The type the return value should have, see pq\Result::FETCH_* constants, defaults to pq\Result::$fetchType.
1330 * @throws \pq\Exception\InvalidArgumentException
1331 * @throws \pq\Exception\BadMethodCallException
1332 * @throws \pq\Exception\RuntimeException
1333 * @return array|array|object|NULL array numerically indexed for pq\Result::FETCH_ARRAY
1334 * or array associatively indexed for pq\Result::FETCH_ASSOC
1335 * or object stdClass instance for pq\Result::FETCH_OBJECT
1336 * or NULL when iteration ends.
1338 function fetchRow(int $fetch_type = NULL) {}
1340 * Fetch the complete result set as a simple map, a *multi dimensional array*, each dimension indexed by a column.
1342 * @param mixed $keys The the column indices/names used to index the map.
1343 * @param mixed $vals The column indices/names which should build up the leaf entry of the map.
1344 * @param int $fetch_type The type the return value should have, see pq\Result::FETCH_* constants, defaults to pq\Result::$fetchType.
1345 * @throws \pq\Exception\InvalidArgumentException
1346 * @throws \pq\Exception\BadMethodCallException
1347 * @throws \pq\Exception\RuntimeException
1348 * @return array |object, the mapped columns.
1350 function map($keys = 0, $vals = NULL, int $fetch_type = NULL) {}
1353 * A named prepared statement.
1354 * See pq\Connection::prepare().
1358 * The connection to the server.
1362 * @var \pq\Connection
1366 * The identifiying name of the prepared statement.
1374 * The query string used to prepare the statement.
1382 * List of corresponding query parameter type OIDs for the prepared statement.
1390 * Prepare a new statement.
1391 * See pq\Connection::prepare().
1393 * @param \pq\Connection $conn The connection to prepare the statement on.
1394 * @param string $name The name identifying this statement.
1395 * @param string $query The actual query to prepare.
1396 * @param array $types A list of corresponding query parameter type OIDs.
1397 * @param bool $async Whether to prepare the statement [asynchronously](pq/Connection/: Asynchronous Usage).
1398 * @throws \pq\Exception\InvalidArgumentException
1399 * @throws \pq\Exception\BadMethodCallException
1400 * @throws \pq\Exception\RuntimeException
1401 * @throws \pq\Exception\DomainException
1403 function __construct(\pq\Connection
$conn, string $name, string $query, array $types = NULL, bool $async = FALSE) {}
1405 * Bind a variable to an input parameter.
1407 * @param int $param_no The parameter index to bind to.
1408 * @param mixed $param_ref The variable to bind.
1409 * @throws \pq\Exception\InvalidArgumentException
1410 * @throws \pq\Exception\BadMethodCallException
1412 function bind(int $param_no, &$param_ref) {}
1414 * Free the server resources used by the prepared statement, so it can no longer be executed.
1415 * This is done implicitly when the object is destroyed.
1417 * @throws \pq\Exception\InvalidArgumentException
1418 * @throws \pq\Exception\BadMethodCallException
1419 * @throws \pq\Exception\RuntimeException
1421 function deallocate() {}
1423 * [Asynchronously](pq/Connection/: Asynchronous Usage) free the server resources used by the
1424 * prepared statement, so it can no longer be executed.
1426 * @throws \pq\Exception\InvalidArgumentException
1427 * @throws \pq\Exception\BadMethodCallException
1428 * @throws \pq\Exception\RuntimeException
1430 function deallocateAsync() {}
1432 * Describe the parameters of the prepared statement.
1434 * @throws \pq\Exception\InvalidArgumentException
1435 * @throws \pq\Exception\BadMethodCallException
1436 * @throws \pq\Exception\RuntimeException
1437 * @throws \pq\Exception\DomainException
1438 * @return array list of type OIDs of the substitution parameters.
1442 * [Asynchronously](pq/Connection/: Asynchronous Usage) describe the parameters of the prepared statement.
1444 * @param callable $callback as function(array $oids)
1445 * A callback to receive list of type OIDs of the substitution parameters.
1446 * @throws \pq\Exception\InvalidArgumentException
1447 * @throws \pq\Exception\BadMethodCallException
1448 * @throws \pq\Exception\RuntimeException
1450 function descAsync(callable
$callback) {}
1452 * Execute the prepared statement.
1454 * @param array $params Any parameters to substitute in the prepared statement (defaults to any bou
1456 * @throws \pq\Exception\InvalidArgumentException
1457 * @throws \pq\Exception\BadMethodCallException
1458 * @throws \pq\Exception\RuntimeException
1459 * @return \pq\Result the result of the execution of the prepared statement.
1461 function exec(array $params = NULL) {}
1463 * [Asynchronously](pq/Connection/: Asynchronous Usage) execute the prepared statement.
1465 * @param array $params Any parameters to substitute in the prepared statement (defaults to any bou
1467 * @param callable $cb as function(\pq\Result $res) : void
1468 * Result handler callback.
1469 * @throws \pq\Exception\InvalidArgumentException
1470 * @throws \pq\Exception\BadMethodCallException
1471 * @throws \pq\Exception\RuntimeException
1473 function execAsync(array $params = NULL, callable
$cb = NULL) {}
1475 * Re-prepare a statement that has been deallocated. This is a no-op on already open statements.
1477 * @throws \pq\Exception\InvalidArgumentException
1478 * @throws \pq\Exception\BadMethodCallException
1479 * @throws \pq\Exception\RuntimeException
1481 function prepare() {}
1483 * [Asynchronously](pq/Connection/: Asynchronous Usage) re-prepare a statement that has been
1484 * deallocated. This is a no-op on already open statements.
1486 * @throws \pq\Exception\InvalidArgumentException
1487 * @throws \pq\Exception\BadMethodCallException
1488 * @throws \pq\Exception\RuntimeException
1490 function prepareAsync() {}
1493 * A database transaction.
1496 * Transactional properties like pq\Transaction::$isolation, pq\Transaction::$readonly and pq\Transaction::$deferrable can be changed after the transaction begun and the first query has been executed. Doing this will lead to appropriate `SET TRANSACTION` queries.
1500 * Transaction isolation level where only rows committed before the transaction began can be seen.
1502 const READ_COMMITTED
= 0;
1504 * Transaction isolation level where only rows committed before the first query was executed in this transaction.
1506 const REPEATABLE_READ
= 1;
1508 * Transaction isolation level that guarantees serializable repeatability which might lead to serialization_failure on high concurrency.
1510 const SERIALIZABLE
= 2;
1512 * The connection the transaction was started on.
1516 * @var \pq\Connection
1520 * The transaction isolation level.
1525 public $isolation = \pq\Transaction
::READ_COMMITTED
;
1527 * Whether this transaction performs read only queries.
1532 public $readonly = FALSE;
1534 * Whether the transaction is deferrable. See pq\Connection::startTransaction().
1539 public $deferrable = FALSE;
1541 * Start a transaction.
1542 * See pq\Connection::startTransaction().
1544 * @param \pq\Connection $conn The connection to start the transaction on.
1545 * @param bool $async Whether to start the transaction [asynchronously](pq/Connection/: Asynchronous Usage).
1546 * @param int $isolation The transaction isolation level (defaults to pq\Connection::$defaultTransactionIsolation).
1547 * @param bool $readonly Whether the transaction is readonly (defaults to pq\Connection::$defaultTransactionReadonly).
1548 * @param bool $deferrable Whether the transaction is deferrable (defaults to pq\Connection::$defaultTransactionDeferrable).
1549 * @throws \pq\Exception\InvalidArgumentException
1550 * @throws \pq\Exception\BadMethodCallException
1551 * @throws \pq\Exception\RuntimeException
1553 function __construct(\pq\Connection
$conn, bool $async = FALSE, int $isolation = \pq\Transaction
::READ_COMMITTED
, bool $readonly = FALSE, bool $deferrable = FALSE) {}
1555 * Commit the transaction or release the previous savepoint.
1556 * See pq\Transaction::savepoint().
1558 * @throws \pq\Exception\InvalidArgumentException
1559 * @throws \pq\Exception\BadMethodCallException
1560 * @throws \pq\Exception\RuntimeException
1561 * @throws \pq\Exception\DomainException
1563 function commit() {}
1565 * [Asynchronously](pq/Connection/: Asynchronous Usage) commit the transaction or release the previous savepoint.
1566 * See pq\Transaction::commit() and pq\Transaction::savepoint().
1568 * @throws \pq\Exception\InvalidArgumentException
1569 * @throws \pq\Exception\BadMethodCallException
1570 * @throws \pq\Exception\RuntimeException
1572 function commitAsync() {}
1574 * Create a new *large object* and open it.
1575 * See pq\Transaction::openLOB().
1577 * @param int $mode How to open the *large object* (read, write or both; see pq\LOB constants).
1578 * @throws \pq\Exception\InvalidArgumentException
1579 * @throws \pq\Exception\BadMethodCallException
1580 * @throws \pq\Exception\RuntimeException
1581 * @return \pq\LOB instance of the new *large object*.
1583 function createLOB(int $mode = \pq\LOB
::RW
) {}
1585 * Export a *large object* to a local file.
1586 * See pq\Transaction::importLOB().
1588 * @param int $oid The OID of the *large object*.
1589 * @param string $path The path of a local file to export to.
1590 * @throws \pq\Exception\InvalidArgumentException
1591 * @throws \pq\Exception\BadMethodCallException
1592 * @throws \pq\Exception\RuntimeException
1594 function exportLOB(int $oid, string $path) {}
1596 * Export a snapshot for transaction synchronization.
1597 * See pq\Transaction::importSnapshot().
1599 * @throws \pq\Exception\InvalidArgumentException
1600 * @throws \pq\Exception\BadMethodCallException
1601 * @throws \pq\Exception\RuntimeException
1602 * @throws \pq\Exception\DomainException
1603 * @return string the snapshot identifier usable with pq\Transaction::importSnapshot().
1605 function exportSnapshot() {}
1607 * [Asynchronously](pq/Connection/: Asynchronous Usage) export a snapshot for transaction synchronization.
1608 * See pq\Transaction::exportSnapshot().
1610 * @throws \pq\Exception\InvalidArgumentException
1611 * @throws \pq\Exception\BadMethodCallException
1612 * @throws \pq\Exception\RuntimeException
1614 function exportSnapshotAsync() {}
1616 * Import a local file into a *large object*.
1618 * @param string $local_path A path to a local file to import.
1619 * @param int $oid The target OID. A new *large object* will be created if INVALID_OID.
1620 * @throws \pq\Exception\InvalidArgumentException
1621 * @throws \pq\Exception\BadMethodCallException
1622 * @throws \pq\Exception\RuntimeException
1623 * @return int the (new) OID of the *large object*.
1625 function importLOB(string $local_path, int $oid = \pq\LOB
::INVALID_OID
) {}
1627 * Import a snapshot from another transaction to synchronize with.
1628 * See pq\Transaction::exportSnapshot().
1631 * The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
1633 * @param string $snapshot_id The snapshot identifier obtained by exporting a snapshot from a transaction.
1634 * @throws \pq\Exception\InvalidArgumentException
1635 * @throws \pq\Exception\BadMethodCallException
1636 * @throws \pq\Exception\RuntimeException
1637 * @throws \pq\Exception\DomainException
1639 function importSnapshot(string $snapshot_id) {}
1641 * [Asynchronously](pq/Connection/: Asynchronous Usage) import a snapshot from another transaction to synchronize with.
1642 * See pq\Transaction::importSnapshot().
1645 * The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
1647 * @param string $snapshot_id The snapshot identifier obtained by exporting a snapshot from a transaction.
1648 * @throws \pq\Exception\InvalidArgumentException
1649 * @throws \pq\Exception\BadMethodCallException
1650 * @throws \pq\Exception\RuntimeException
1652 function importSnapshotAsync(string $snapshot_id) {}
1654 * Open a *large object*.
1655 * See pq\Transaction::createLOB().
1657 * @param int $oid The OID of the *large object*.
1658 * @param int $mode Operational mode; read, write or both.
1659 * @throws \pq\Exception\InvalidArgumentException
1660 * @throws \pq\Exception\BadMethodCallException
1661 * @throws \pq\Exception\RuntimeException
1662 * @return \pq\LOB instance of the opened *large object*.
1664 function openLOB(int $oid, int $mode = \pq\LOB
::RW
) {}
1666 * Rollback the transaction or to the previous savepoint within this transaction.
1667 * See pq\Transaction::commit() and pq\Transaction::savepoint().
1669 * @throws \pq\Exception\InvalidArgumentException
1670 * @throws \pq\Exception\BadMethodCallException
1671 * @throws \pq\Exception\RuntimeException
1672 * @throws \pq\Exception\DomainException
1674 function rollback() {}
1676 * [Asynchronously](pq/Connection/: Asynchronous Usage) rollback the transaction or to the previous savepoint within this transaction.
1677 * See pq\Transaction::rollback() and pq\Transaction::savepoint().
1679 * @throws \pq\Exception\InvalidArgumentException
1680 * @throws \pq\Exception\BadMethodCallException
1681 * @throws \pq\Exception\RuntimeException
1683 function rollbackAsync() {}
1685 * Create a `SAVEPOINT` within this transaction.
1688 * pq\Transaction tracks an internal counter as savepoint identifier.
1690 * @throws \pq\Exception\InvalidArgumentException
1691 * @throws \pq\Exception\BadMethodCallException
1692 * @throws \pq\Exception\RuntimeException
1694 function savepoint() {}
1696 * [Asynchronously](pq/Connection/: Asynchronous Usage) create a `SAVEPOINT` within this transaction.
1697 * See pq\Transaction::savepoint().
1699 * @throws \pq\Exception\InvalidArgumentException
1700 * @throws \pq\Exception\BadMethodCallException
1701 * @throws \pq\Exception\RuntimeException
1703 function savepointAsync() {}
1705 * Unlink a *large object*.
1706 * See pq\Transaction::createLOB().
1708 * @param int $oid The OID of the *large object*.
1709 * @throws \pq\Exception\InvalidArgumentException
1710 * @throws \pq\Exception\BadMethodCallException
1711 * @throws \pq\Exception\RuntimeException
1712 * @return \pq\LOB instance of the opened *large object*.
1714 function unlinkLOB(int $oid) {}
1717 * Accessor to the PostgreSQL `pg_type` relation.
1718 * See [here for an overview](pq/Types/: Overview).
1720 class Types
implements \ArrayAccess
{
1722 * OID of the `bool` type.
1726 * OID of the `bytea` type.
1730 * OID of the `char` type.
1734 * OID of the `name` type.
1738 * OID of the `int8` type.
1742 * OID of the `int2` type.
1746 * OID of the `int2vector` type.
1748 const INT2VECTOR
= 22;
1750 * OID of the `int4` type.
1754 * OID of the `regproc` type.
1758 * OID of the `text` type.
1762 * OID of the `oid` type.
1766 * OID of the `tid` type.
1770 * OID of the `xid` type.
1774 * OID of the `cid` type.
1778 * OID of the `oidvector` type.
1780 const OIDVECTOR
= 30;
1782 * OID of the `pg_type` type.
1786 * OID of the `pg_attribute` type.
1788 const PG_ATTRIBUTE
= 75;
1790 * OID of the `pg_proc` type.
1794 * OID of the `pg_class` type.
1796 const PG_CLASS
= 83;
1798 * OID of the `json` type.
1802 * OID of the `xml` type.
1806 * OID of the `xmlarray` type.
1808 const XMLARRAY
= 143;
1810 * OID of the `jsonarray` type.
1812 const JSONARRAY
= 199;
1814 * OID of the `pg_node_tree` type.
1816 const PG_NODE_TREE
= 194;
1818 * OID of the `smgr` type.
1822 * OID of the `point` type.
1826 * OID of the `lseg` type.
1830 * OID of the `path` type.
1834 * OID of the `box` type.
1838 * OID of the `polygon` type.
1840 const POLYGON
= 604;
1842 * OID of the `line` type.
1846 * OID of the `linearray` type.
1848 const LINEARRAY
= 629;
1850 * OID of the `float4` type.
1854 * OID of the `float8` type.
1858 * OID of the `unknown` type.
1860 const UNKNOWN
= 705;
1862 * OID of the `circle` type.
1866 * OID of the `circlearray` type.
1868 const CIRCLEARRAY
= 719;
1870 * OID of the `money` type.
1874 * OID of the `moneyarray` type.
1876 const MONEYARRAY
= 791;
1878 * OID of the `macaddr` type.
1880 const MACADDR
= 829;
1882 * OID of the `inet` type.
1886 * OID of the `cidr` type.
1890 * OID of the `boolarray` type.
1892 const BOOLARRAY
= 1000;
1894 * OID of the `byteaarray` type.
1896 const BYTEAARRAY
= 1001;
1898 * OID of the `chararray` type.
1900 const CHARARRAY
= 1002;
1902 * OID of the `namearray` type.
1904 const NAMEARRAY
= 1003;
1906 * OID of the `int2array` type.
1908 const INT2ARRAY
= 1005;
1910 * OID of the `int2vectorarray` type.
1912 const INT2VECTORARRAY
= 1006;
1914 * OID of the `int4array` type.
1916 const INT4ARRAY
= 1007;
1918 * OID of the `regprocarray` type.
1920 const REGPROCARRAY
= 1008;
1922 * OID of the `textarray` type.
1924 const TEXTARRAY
= 1009;
1926 * OID of the `oidarray` type.
1928 const OIDARRAY
= 1028;
1930 * OID of the `tidarray` type.
1932 const TIDARRAY
= 1010;
1934 * OID of the `xidarray` type.
1936 const XIDARRAY
= 1011;
1938 * OID of the `cidarray` type.
1940 const CIDARRAY
= 1012;
1942 * OID of the `oidvectorarray` type.
1944 const OIDVECTORARRAY
= 1013;
1946 * OID of the `bpchararray` type.
1948 const BPCHARARRAY
= 1014;
1950 * OID of the `varchararray` type.
1952 const VARCHARARRAY
= 1015;
1954 * OID of the `int8array` type.
1956 const INT8ARRAY
= 1016;
1958 * OID of the `pointarray` type.
1960 const POINTARRAY
= 1017;
1962 * OID of the `lsegarray` type.
1964 const LSEGARRAY
= 1018;
1966 * OID of the `patharray` type.
1968 const PATHARRAY
= 1019;
1970 * OID of the `boxarray` type.
1972 const BOXARRAY
= 1020;
1974 * OID of the `float4array` type.
1976 const FLOAT4ARRAY
= 1021;
1978 * OID of the `float8array` type.
1980 const FLOAT8ARRAY
= 1022;
1982 * OID of the `polygonarray` type.
1984 const POLYGONARRAY
= 1027;
1986 * OID of the `aclitem` type.
1988 const ACLITEM
= 1033;
1990 * OID of the `aclitemarray` type.
1992 const ACLITEMARRAY
= 1034;
1994 * OID of the `macaddrarray` type.
1996 const MACADDRARRAY
= 1040;
1998 * OID of the `inetarray` type.
2000 const INETARRAY
= 1041;
2002 * OID of the `cidrarray` type.
2004 const CIDRARRAY
= 651;
2006 * OID of the `cstringarray` type.
2008 const CSTRINGARRAY
= 1263;
2010 * OID of the `bpchar` type.
2012 const BPCHAR
= 1042;
2014 * OID of the `varchar` type.
2016 const VARCHAR
= 1043;
2018 * OID of the `date` type.
2022 * OID of the `time` type.
2026 * OID of the `timestamp` type.
2028 const TIMESTAMP
= 1114;
2030 * OID of the `timestamparray` type.
2032 const TIMESTAMPARRAY
= 1115;
2034 * OID of the `datearray` type.
2036 const DATEARRAY
= 1182;
2038 * OID of the `timearray` type.
2040 const TIMEARRAY
= 1183;
2042 * OID of the `timestamptz` type.
2044 const TIMESTAMPTZ
= 1184;
2046 * OID of the `timestamptzarray` type.
2048 const TIMESTAMPTZARRAY
= 1185;
2050 * OID of the `interval` type.
2052 const INTERVAL
= 1186;
2054 * OID of the `intervalarray` type.
2056 const INTERVALARRAY
= 1187;
2058 * OID of the `numericarray` type.
2060 const NUMERICARRAY
= 1231;
2062 * OID of the `timetz` type.
2064 const TIMETZ
= 1266;
2066 * OID of the `timetzarray` type.
2068 const TIMETZARRAY
= 1270;
2070 * OID of the `bit` type.
2074 * OID of the `bitarray` type.
2076 const BITARRAY
= 1561;
2078 * OID of the `varbit` type.
2080 const VARBIT
= 1562;
2082 * OID of the `varbitarray` type.
2084 const VARBITARRAY
= 1563;
2086 * OID of the `numeric` type.
2088 const NUMERIC = 1700;
2090 * OID of the `refcursor` type.
2092 const REFCURSOR
= 1790;
2094 * OID of the `refcursorarray` type.
2096 const REFCURSORARRAY
= 2201;
2098 * OID of the `regprocedure` type.
2100 const REGPROCEDURE
= 2202;
2102 * OID of the `regoper` type.
2104 const REGOPER
= 2203;
2106 * OID of the `regoperator` type.
2108 const REGOPERATOR
= 2204;
2110 * OID of the `regclass` type.
2112 const REGCLASS
= 2205;
2114 * OID of the `regtype` type.
2116 const REGTYPE
= 2206;
2118 * OID of the `regprocedurearray` type.
2120 const REGPROCEDUREARRAY
= 2207;
2122 * OID of the `regoperarray` type.
2124 const REGOPERARRAY
= 2208;
2126 * OID of the `regoperatorarray` type.
2128 const REGOPERATORARRAY
= 2209;
2130 * OID of the `regclassarray` type.
2132 const REGCLASSARRAY
= 2210;
2134 * OID of the `regtypearray` type.
2136 const REGTYPEARRAY
= 2211;
2138 * OID of the `uuid` type.
2142 * OID of the `uuidarray` type.
2144 const UUIDARRAY
= 2951;
2146 * OID of the `tsvector` type.
2148 const TSVECTOR
= 3614;
2150 * OID of the `gtsvector` type.
2152 const GTSVECTOR
= 3642;
2154 * OID of the `tsquery` type.
2156 const TSQUERY
= 3615;
2158 * OID of the `regconfig` type.
2160 const REGCONFIG
= 3734;
2162 * OID of the `regdictionary` type.
2164 const REGDICTIONARY
= 3769;
2166 * OID of the `tsvectorarray` type.
2168 const TSVECTORARRAY
= 3643;
2170 * OID of the `gtsvectorarray` type.
2172 const GTSVECTORARRAY
= 3644;
2174 * OID of the `tsqueryarray` type.
2176 const TSQUERYARRAY
= 3645;
2178 * OID of the `regconfigarray` type.
2180 const REGCONFIGARRAY
= 3735;
2182 * OID of the `regdictionaryarray` type.
2184 const REGDICTIONARYARRAY
= 3770;
2186 * OID of the `txid_snapshot` type.
2188 const TXID_SNAPSHOT
= 2970;
2190 * OID of the `txid_snapshotarray` type.
2192 const TXID_SNAPSHOTARRAY
= 2949;
2194 * OID of the `int4range` type.
2196 const INT4RANGE
= 3904;
2198 * OID of the `int4rangearray` type.
2200 const INT4RANGEARRAY
= 3905;
2202 * OID of the `numrange` type.
2204 const NUMRANGE
= 3906;
2206 * OID of the `numrangearray` type.
2208 const NUMRANGEARRAY
= 3907;
2210 * OID of the `tsrange` type.
2212 const TSRANGE
= 3908;
2214 * OID of the `tsrangearray` type.
2216 const TSRANGEARRAY
= 3909;
2218 * OID of the `tstzrange` type.
2220 const TSTZRANGE
= 3910;
2222 * OID of the `tstzrangearray` type.
2224 const TSTZRANGEARRAY
= 3911;
2226 * OID of the `daterange` type.
2228 const DATERANGE
= 3912;
2230 * OID of the `daterangearray` type.
2232 const DATERANGEARRAY
= 3913;
2234 * OID of the `int8range` type.
2236 const INT8RANGE
= 3926;
2238 * OID of the `int8rangearray` type.
2240 const INT8RANGEARRAY
= 3927;
2242 * OID of the `record` type.
2244 const RECORD
= 2249;
2246 * OID of the `cstring` type.
2248 const CSTRING
= 2275;
2250 * OID of the `any` type.
2254 * OID of the `anyarray` type.
2256 const ANYARRAY
= 2277;
2258 * OID of the `void` type.
2262 * OID of the `trigger` type.
2264 const TRIGGER
= 2279;
2266 * OID of the `event_trigger` type.
2268 const EVENT_TRIGGER
= 3838;
2270 * OID of the `language_handler` type.
2272 const LANGUAGE_HANDLER
= 2280;
2274 * OID of the `internal` type.
2276 const INTERNAL
= 2281;
2278 * OID of the `opaque` type.
2280 const OPAQUE
= 2282;
2282 * OID of the `anyelement` type.
2284 const ANYELEMENT
= 2283;
2286 * OID of the `anynonarray` type.
2288 const ANYNONARRAY
= 2776;
2290 * OID of the `anyenum` type.
2292 const ANYENUM
= 3500;
2294 * OID of the `fdw_handler` type.
2296 const FDW_HANDLER
= 3115;
2298 * OID of the `anyrange` type.
2300 const ANYRANGE
= 3831;
2302 * The connection which was used to obtain type information.
2306 * @var \pq\Connection
2310 * Create a new instance populated with information obtained from the `pg_type` relation.
2312 * @param \pq\Connection $conn The connection to use.
2313 * @param array $namespaces Which namespaces to query (defaults to `public` and `pg_catalog`).
2314 * @throws \pq\Exception\InvalidArgumentException
2315 * @throws \pq\Exception\BadMethodCallException
2316 * @throws \pq\Exception\RuntimeException
2318 function __construct(\pq\Connection
$conn, array $namespaces = NULL) {}
2320 * Refresh type information from `pg_type`.
2322 * @param array $namespaces Which namespaces to query (defaults to `public` and `pg_catalog`).
2323 * @throws \pq\Exception\InvalidArgumentException
2324 * @throws \pq\Exception\BadMethodCallException
2325 * @throws \pq\Exception\RuntimeException
2327 function refresh(array $namespaces = NULL) {}
2329 namespace pq\Exception
;
2331 * A method call was not expected.
2333 class BadMethodCallException
extends \BadMethodCallException
implements \pq\Exception
{
2336 * Implementation or SQL syntax error.
2338 class DomainException
extends \DomainException
implements \pq\Exception
{
2340 * The SQLSTATE code, see the [official documentation](http://www.postgresql.org/docs/current/static/errcodes-appendix.html) for further information.
2349 * An invalid argument was passed to a method.
2351 class InvalidArgumentException
extends \InvalidArgumentException
implements \pq\Exception
{
2354 * A runtime exception occurred.
2356 class RuntimeException
extends \RuntimeException
implements \pq\Exception
{