mdref.json config
[mdref/mdref-pq] / pq.stub.php
1 <?php
2 /**
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.
4 *
5 * ### Highlights:
6 *
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).
11 */
12 namespace pq;
13 use pq;
14 /**
15 * Fast import/export using COPY.
16 */
17 class COPY {
18 /**
19 * Start a COPY operation from STDIN to the PostgreSQL server.
20 */
21 const FROM_STDIN = 0;
22 /**
23 * Start a COPY operation from the server to STDOUT.
24 */
25 const TO_STDOUT = 1;
26 /**
27 * The connection to the PostgreSQL server.
28 *
29 * @public
30 * @readonly
31 * @var \pq\Connection
32 */
33 public $connection;
34 /**
35 * The expression of the COPY statement used to start the operation.
36 *
37 * @public
38 * @readonly
39 * @var string
40 */
41 public $expression;
42 /**
43 * The drection of the COPY operation (pq\COPY::FROM_STDIN or pq\COPY::TO_STDOUT).
44 *
45 * @public
46 * @readonly
47 * @var int
48 */
49 public $direction;
50 /**
51 * Any additional options used to start the COPY operation.
52 *
53 * @public
54 * @readonly
55 * @var string
56 */
57 public $options;
58 /**
59 * Start a COPY operation.
60 *
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
68 */
69 function __construct(\pq\Connection $conn, string $expression, int $direction, string $options = NULL) {}
70 /**
71 * End the COPY operation to the server during pq\Result::COPY_IN state.
72 *
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
77 */
78 function end(string $error = NULL) {}
79 /**
80 * Receive data from the server during pq\Result::COPY_OUT state.
81 *
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.
87 */
88 function get(string &$data) {}
89 /**
90 * Send data to the server during pq\Result::COPY_IN state.
91 *
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
96 */
97 function put(string $data) {}
98 }
99 /**
100 * Request cancellation of an asynchronous query.
101 */
102 class Cancel {
103 /**
104 * The connection to cancel the query on.
105 *
106 * @public
107 * @readonly
108 * @var \pq\Connection
109 */
110 public $connection;
111 /**
112 * Create a new cancellation request for an [asynchronous](pq/Connection/: Asynchronous Usage) query.
113 *
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
118 */
119 function __construct(\pq\Connection $conn) {}
120 /**
121 * Perform the cancellation request.
122 *
123 * @throws \pq\Exception\InvalidArgumentException
124 * @throws \pq\Exception\BadMethodCallException
125 * @throws \pq\Exception\RuntimeException
126 */
127 function cancel() {}
128 }
129 /**
130 * The connection to the PostgreSQL server.
131 *
132 * See the [General Usage](pq/Connection/: General Usage) page for an introduction on how to use this class.
133 */
134 class Connection {
135 /**
136 * (Re-)open a persistent connection.
137 */
138 const PERSISTENT = 2;
139 /**
140 * If the connection is not already open, perform the connection attempt [asynchronously](pq/Connection/: Asynchronous Usage).
141 */
142 const ASYNC = 1;
143 /**
144 * Everything well; if a connection has been newly and synchronously created, the connection will always have this status right after creation.
145 */
146 const OK = 0;
147 /**
148 * Broken connection; consider pq\Connection::reset() or recreation.
149 */
150 const BAD = 1;
151 /**
152 * Waiting for connection to be made.
153 */
154 const STARTED = 2;
155 /**
156 * Connection okay; waiting to send.
157 */
158 const MADE = 3;
159 /**
160 * Waiting for a response from the server.
161 */
162 const AWAITING_RESPONSE = 4;
163 /**
164 * Received authentication; waiting for backend start-up to finish.
165 */
166 const AUTH_OK = 5;
167 /**
168 * Negotiating SSL encryption.
169 */
170 const SSL_STARTUP = 7;
171 /**
172 * Negotiating environment-driven parameter settings.
173 */
174 const SETENV = 6;
175 /**
176 * No active transaction.
177 */
178 const TRANS_IDLE = 0;
179 /**
180 * A transaction command is in progress.
181 */
182 const TRANS_ACTIVE = 1;
183 /**
184 * Idling in a valid transaction block.
185 */
186 const TRANS_INTRANS = 2;
187 /**
188 * Idling in a failed transaction block.
189 */
190 const TRANS_INERROR = 3;
191 /**
192 * Bad connection.
193 */
194 const TRANS_UNKNOWN = 4;
195 /**
196 * The connection procedure has failed.
197 */
198 const POLLING_FAILED = 0;
199 /**
200 * Select for read-readiness.
201 */
202 const POLLING_READING = 1;
203 /**
204 * Select for write-readiness.
205 */
206 const POLLING_WRITING = 2;
207 /**
208 * The connection has been successfully made.
209 */
210 const POLLING_OK = 3;
211 /**
212 * Register the event handler for notices.
213 */
214 const EVENT_NOTICE = 'notice';
215 /**
216 * Register the event handler for any created results.
217 */
218 const EVENT_RESULT = 'result';
219 /**
220 * Register the event handler for connection resets.
221 */
222 const EVENT_RESET = 'reset';
223 /**
224 * A [connection status constant](pq/Connection#Connection.Status:) value.
225 *
226 * @public
227 * @readonly
228 * @var int
229 */
230 public $status;
231 /**
232 * A [transaction status constant](pq/Connection#Transaction.Status:) value.
233 *
234 * @public
235 * @readonly
236 * @var int
237 */
238 public $transactionStatus;
239 /**
240 * The server socket resource.
241 *
242 * @public
243 * @readonly
244 * @var resource
245 */
246 public $socket;
247 /**
248 * Whether the connection is busy with [asynchronous operations](pq/Connection/: Asynchronous Usage).
249 *
250 * @public
251 * @readonly
252 * @var bool
253 */
254 public $busy;
255 /**
256 * Any error message on failure.
257 *
258 * @public
259 * @readonly
260 * @var string
261 */
262 public $errorMessage;
263 /**
264 * List of registered event handlers.
265 *
266 * @public
267 * @readonly
268 * @var array
269 */
270 public $eventHandlers;
271 /**
272 * Connection character set.
273 *
274 * @public
275 * @var string
276 */
277 public $encoding = NULL;
278 /**
279 * Whether to fetch [asynchronous](pq/Connection/: Asynchronous Usage) results in unbuffered mode, i.e. each row generates a distinct pq\Result.
280 *
281 * @public
282 * @var bool
283 */
284 public $unbuffered = FALSE;
285 /**
286 * Whether to set the underlying socket nonblocking, useful for asynchronous handling of writes. See also pq\Connection::flush().
287 *
288 * ### Connection Information:
289 *
290 * @public
291 * @var bool
292 */
293 public $nonblocking = FALSE;
294 /**
295 * The database name of the connection.
296 *
297 * @public
298 * @readonly
299 * @var string
300 */
301 public $db;
302 /**
303 * The user name of the connection.
304 *
305 * @public
306 * @readonly
307 * @var string
308 */
309 public $user;
310 /**
311 * The password of the connection.
312 *
313 * @public
314 * @readonly
315 * @var string
316 */
317 public $pass;
318 /**
319 * The server host name of the connection.
320 *
321 * @public
322 * @readonly
323 * @var string
324 */
325 public $host;
326 /**
327 * The port of the connection.
328 *
329 * @public
330 * @readonly
331 * @var string
332 */
333 public $port;
334 /**
335 * The command-line options passed in the connection request.
336 *
337 * ### Inheritable Defaults:
338 *
339 * @public
340 * @readonly
341 * @var string
342 */
343 public $options;
344 /**
345 * Default fetch type for future pq\Result instances.
346 *
347 * @public
348 * @var int
349 */
350 public $defaultFetchType = \pq\Result::FETCH_ARRAY;
351 /**
352 * Default conversion bitmask for future pq\Result instances.
353 *
354 * @public
355 * @var int
356 */
357 public $defaultAutoConvert = \pq\Result::CONV_ALL;
358 /**
359 * Default transaction isolation level for future pq\Transaction instances.
360 *
361 * @public
362 * @var int
363 */
364 public $defaultTransactionIsolation = \pq\Transaction::READ_COMMITTED;
365 /**
366 * Default transaction readonlyness for future pq\Transaction instances.
367 *
368 * @public
369 * @var bool
370 */
371 public $defaultTransactionReadonly = FALSE;
372 /**
373 * Default transaction deferrability for future pq\Transaction instances.
374 *
375 * @public
376 * @var bool
377 */
378 public $defaultTransactionDeferrable = FALSE;
379 /**
380 * Create a new PostgreSQL connection.
381 * See also [General Usage](pq/Connection/: General Usage).
382 *
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
388 */
389 function __construct(string $dsn = "", int $flags = 0) {}
390 /**
391 * Declare a cursor for a query.
392 *
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.
400 */
401 function declare(string $name, int $flags, string $query) {}
402 /**
403 * [Asynchronously](pq/Connection/: Asynchronous Usage) declare a cursor for a query.
404 *
405 * > ***NOTE***:
406 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
407 *
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.
415 */
416 function declareAsync(string $name, int $flags, string $query) {}
417 /**
418 * Escape binary data for use within a query with the type bytea.
419 *
420 * > ***NOTE:***
421 * The result is not wrapped in single quotes.
422 *
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.
427 */
428 function escapeBytea(string $binary) {}
429 /**
430 * [Execute one or multiple SQL queries](pq/Connection/: Executing Queries) on the connection.
431 *
432 * > ***NOTE:***
433 * > Only the last result will be returned, if the query string contains more than one SQL query.
434 *
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
440 * @return \pq\Result
441 */
442 function exec(string $query) {}
443 /**
444 * [Asynchronously](pq/Connection/: Asynchronous Usage) [execute an SQL query](pq/Connection: Executing Queries) on the connection.
445 *
446 * > ***NOTE***:
447 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
448 *
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
455 */
456 function execAsync(string $query, callable $callback = NULL) {}
457 /**
458 * [Execute an SQL query](pq/Connection: Executing Queries) with properly escaped parameters substituted.
459 *
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
466 * @return \pq\Result
467 */
468 function execParams(string $query, array $params, array $types = NULL) {}
469 /**
470 * [Asynchronously](pq/Connection/: Asynchronous Usage) [execute an SQL query](pq/Connection: Executing Queries) with properly escaped parameters substituted.
471 *
472 * > ***NOTE***:
473 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
474 *
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
483 */
484 function execParamsAsync(string $query, array $params, array $types = NULL, callable $cb = NULL) {}
485 /**
486 * Flush pending writes on the connection.
487 * Call after sending any command or data on a nonblocking connection.
488 *
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.
493 *
494 * > ***NOTE:***
495 * > This method was added in v1.1.0, resp. v2.1.0.
496 *
497 * @throws \pq\Exception\InvalidArgumentException
498 * @throws \pq\Exception\RuntimeException
499 * @return bool whether everything has been flushed.
500 */
501 function flush() {}
502 /**
503 * Fetch the result of an [asynchronous](pq/Connection/: Asynchronous Usage) query.
504 *
505 * If the query hasn't finished yet, the call will block until the result is available.
506 *
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
511 */
512 function getResult() {}
513 /**
514 * Listen on $channel for notifications.
515 * See pq\Connection::unlisten().
516 *
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
523 */
524 function listen(string $channel, callable $listener) {}
525 /**
526 * [Asynchronously](pq/Connection/: Asynchronous Usage) start listening on $channel for notifcations.
527 * See pq\Connection::listen().
528 *
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
535 */
536 function listenAsync(string $channel, callable $listener) {}
537 /**
538 * Notify all listeners on $channel with $message.
539 *
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
545 */
546 function notify(string $channel, string $message) {}
547 /**
548 * [Asynchronously](pq/Connection/: Asynchronous Usage) start notifying all listeners on $channel with $message.
549 *
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
555 */
556 function notifyAsync(string $channel, string $message) {}
557 /**
558 * Stops listening for an event type.
559 *
560 * @param string $event Any pq\Connection::EVENT_*.
561 * @throws \pq\Exception\InvalidArgumentException
562 * @throws \pq\Exception\BadMethodCallException
563 * @return bool success.
564 */
565 function off(string $event) {}
566 /**
567 * Listen for an event.
568 *
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.
575 */
576 function on(string $event, callable $callback) {}
577 /**
578 * Poll an [asynchronously](pq/Connection/: Asynchronous Usage) operating connection.
579 * See pq\Connection::resetAsync() for an usage example.
580 *
581 * @throws \pq\Exception\InvalidArgumentException
582 * @throws \pq\Exception\RuntimeException
583 * @throws \pq\Exception\BadMethodCallException
584 * @return int pq\Connection::POLLING_* constant
585 */
586 function poll() {}
587 /**
588 * Prepare a named statement for later execution with pq\Statement::execute().
589 *
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.
597 */
598 function prepare(string $name, string $query, array $types = NULL) {}
599 /**
600 * [Asynchronously](pq/Connection/: Asynchronous Usage) prepare a named statement for later execution with pq\Statement::exec().
601 *
602 * > ***NOTE***:
603 * If pq\Connection::$unbuffered is TRUE, each call to pq\Connection::getResult() will generate a distinct pq\Result containing exactly one row.
604 *
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.
612 */
613 function prepareAsync(string $name, string $query, array $types = NULL) {}
614 /**
615 * Quote a string for safe use in a query.
616 * The result is truncated at any zero byte and wrapped in single quotes.
617 *
618 * > ***NOTE:***
619 * Beware of matching character encodings.
620 *
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.
625 */
626 function quote(string $payload) {}
627 /**
628 * Quote an identifier for safe usage as name.
629 *
630 * > ***NOTE:***
631 * Beware of case-sensitivity.
632 *
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.
637 */
638 function quoteName(string $name) {}
639 /**
640 * Attempt to reset a possibly broken connection to a working state.
641 *
642 * @throws \pq\Exception\InvalidArgumentException
643 * @throws \pq\Exception\BadMethodCallException
644 * @throws \pq\Exception\RuntimeException
645 */
646 function reset() {}
647 /**
648 * [Asynchronously](pq/Connection/: Asynchronous Usage) reset a possibly broken connection to a working state.
649 *
650 * @throws \pq\Exception\InvalidArgumentException
651 * @throws \pq\Exception\BadMethodCallException
652 * @throws \pq\Exception\RuntimeException
653 */
654 function resetAsync() {}
655 /**
656 * Set a data type converter.
657 *
658 * @param \pq\Converter $converter An instance implementing pq\Converter.
659 * @throws \pq\Exception\InvalidArgumentException
660 * @throws \pq\Exception\BadMethodCallException
661 */
662 function setConverter(\pq\Converter $converter) {}
663 /**
664 * Begin a transaction.
665 *
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).
672 *
673 * > ***NOTE:***
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.
680 */
681 function startTransaction(int $isolation = \pq\Transaction::READ_COMMITTED, bool $readonly = FALSE, bool $deferrable = FALSE) {}
682 /**
683 * [Asynchronously](pq/Connection/: Asynchronous Usage) begin a transaction.
684 *
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).
691 *
692 * > ***NOTE:***
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.
699 */
700 function startTransactionAsync(int $isolation = \pq\Transaction::READ_COMMITTED, bool $readonly = FALSE, bool $deferrable = FALSE) {}
701 /**
702 * Trace protocol communication with the server.
703 *
704 * > ***NOTE:***
705 * Calling pq\Connection::trace() without argument or NULL stops tracing.
706 *
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.
711 */
712 function trace($stream = NULL) {}
713 /**
714 * Unescape bytea data retrieved from the server.
715 *
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.
720 */
721 function unescapeBytea(string $bytea) {}
722 /**
723 * Stop listening for notifications on channel $channel.
724 * See pq\Connection::listen().
725 *
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
730 */
731 function unlisten(string $channel) {}
732 /**
733 * [Asynchronously](pq/Connection/: Asynchronous Usage) stop listening for notifications on channel $channel.
734 * See pq\Connection::unlisten() and pq\Connection::listenAsync().
735 *
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
740 */
741 function unlistenAsync(string $channel) {}
742 /**
743 * Stop applying a data type converter.
744 *
745 * @param \pq\Converter $converter A converter previously set with pq\Connection::setConverter().
746 * @throws \pq\Exception\InvalidArgumentException
747 * @throws \pq\Exception\BadMethodCallException
748 */
749 function unsetConverter(\pq\Converter $converter) {}
750 }
751 /**
752 * Interface for type conversions.
753 */
754 interface Converter {
755 /**
756 * Convert a string received from the PostgreSQL server back to a PHP type.
757 *
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.
761 */
762 function convertFromString(string $data, int $type);
763 /**
764 * Convert a value to a string for use in a query.
765 *
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.
769 */
770 function convertToString($value, int $type);
771 /**
772 * Announce which types the implementing converter can handle.
773 *
774 * @return array OIDs of handled types.
775 */
776 function convertTypes();
777 }
778 /**
779 * Declare a cursor.
780 */
781 class Cursor {
782 /**
783 * Causes the cursor to return data in binary rather than in text format. You probably do not want to use that.
784 */
785 const BINARY = 1;
786 /**
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.
788 */
789 const INSENSITIVE = 2;
790 /**
791 * The cursor should stay usable after the transaction that created it was successfully committed.
792 */
793 const WITH_HOLD = 4;
794 /**
795 * Force that rows can be retrieved in any order from the cursor.
796 */
797 const SCROLL = 16;
798 /**
799 * Force that rows are only retrievable in sequiential order.
800 *
801 * > ***NOTE:***
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.
803 */
804 const NO_SCROLL = 32;
805 /**
806 * The connection the cursor was declared on.
807 *
808 * @public
809 * @readonly
810 * @var \pq\Connection
811 */
812 public $connection;
813 /**
814 * The identifying name of the cursor.
815 *
816 * @public
817 * @readonly
818 * @var string
819 */
820 public $name;
821 /**
822 * Declare a cursor.
823 * See pq\Connection::declare().
824 *
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
833 */
834 function __construct(\pq\Connection $connection, string $name, int $flags, string $query, bool $async) {}
835 /**
836 * Close an open cursor.
837 * This is a no-op on already closed cursors.
838 *
839 * @throws \pq\Exception\InvalidArgumentException
840 * @throws \pq\Exception\BadMethodCallException
841 * @throws \pq\Exception\RuntimeException
842 */
843 function close() {}
844 /**
845 * [Asynchronously](pq/Connection/: Asynchronous Usage) close an open cursor.
846 * See pq\Cursor::close().
847 *
848 * @throws \pq\Exception\InvalidArgumentException
849 * @throws \pq\Exception\BadMethodCallException
850 * @throws \pq\Exception\RuntimeException
851 */
852 function closeAsync() {}
853 /**
854 * Fetch rows from the cursor.
855 * See pq\Cursor::move().
856 *
857 * @param string $spec What to fetch.
858 *
859 * ### Fetch argument:
860 *
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).
866 */
867 function fetch(string $spec = "1") {}
868 /**
869 * [Asynchronously](pq/Connection/: Asynchronous Usage) fetch rows from the cursor.
870 * See pq\Cursor::fetch().
871 *
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
878 */
879 function fetchAsync(string $spec = "1", callable $callback = NULL) {}
880 /**
881 * Move the cursor.
882 * See pq\Cursor::fetch().
883 *
884 * @param string $spec What to fetch.
885 *
886 * ### Fetch argument:
887 *
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.
893 */
894 function move(string $spec = "1") {}
895 /**
896 * [Asynchronously](pq/Connection/: Asynchronous Usage) move the cursor.
897 * See pq\Cursor::move().
898 *
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
905 */
906 function moveAsync(string $spec = "1", callable $callback = NULL) {}
907 /**
908 * Reopen a cursor.
909 * This is a no-op on already open cursors.
910 *
911 * > ***NOTE:***
912 * Only cursors closed by pq\Cursor::close() will be reopened.
913 *
914 * @throws \pq\Exception\InvalidArgumentException
915 * @throws \pq\Exception\BadMethodCallException
916 * @throws \pq\Exception\RuntimeException
917 */
918 function open() {}
919 /**
920 * [Asynchronously](pq/Connection/: Asynchronous Usage) reopen a cursor.
921 * See pq\Cursor::open().
922 *
923 * @throws \pq\Exception\InvalidArgumentException
924 * @throws \pq\Exception\BadMethodCallException
925 * @throws \pq\Exception\RuntimeException
926 */
927 function openAsync() {}
928 }
929 /**
930 * A simple DateTime wrapper with predefined formats which supports stringification and JSON.
931 */
932 class DateTime extends \DateTime implements \JsonSerializable {
933 /**
934 * The default format of any date/time type automatically converted by pq\Result (depends on the actual type of the column).
935 *
936 * @public
937 * @var string
938 */
939 public $format = "Y-m-d H:i:s.uO";
940 /**
941 * Stringify the DateTime instance according to pq\DateTime::$format.
942 *
943 * @return string the DateTime as string.
944 */
945 function __toString() {}
946 /**
947 * Serialize to JSON.
948 * Alias of pq\DateTime::__toString().
949 *
950 * @return string the DateTime stringified according to pq\DateTime::$format.
951 */
952 function jsonSerialize() {}
953 }
954 /**
955 * A base interface for all pq\Exception classes.
956 */
957 interface Exception {
958 /**
959 * An invalid argument was passed to a method (pq\Exception\InvalidArgumentException).
960 */
961 const INVALID_ARGUMENT = 0;
962 /**
963 * A runtime exception occurred (pq\Exception\RuntimeException).
964 */
965 const RUNTIME = 1;
966 /**
967 * The connection failed (pq\Exception\RuntimeException).
968 */
969 const CONNECTION_FAILED = 2;
970 /**
971 * An input/output exception occurred (pq\Exception\RuntimeException).
972 */
973 const IO = 3;
974 /**
975 * Escaping an argument or identifier failed internally (pq\Exception\RuntimeException).
976 */
977 const ESCAPE = 4;
978 /**
979 * An object's constructor was not called (pq\Exception\BadMethodCallException).
980 */
981 const UNINITIALIZED = 6;
982 /**
983 * Calling this method was not expected (yet) (pq\Exception\BadMethodCallException).
984 */
985 const BAD_METHODCALL = 5;
986 /**
987 * SQL syntax error (pq\Exception\DomainException).
988 */
989 const SQL = 8;
990 /**
991 * Implementation domain error (pq\Exception\DomainException).
992 */
993 const DOMAIN = 7;
994 }
995 /**
996 * A *large object*.
997 *
998 * > ***NOTE:***
999 * Working with *large objects* requires an active transaction.
1000 */
1001 class LOB {
1002 /**
1003 * 0, representing an invalid OID.
1004 */
1005 const INVALID_OID = 0;
1006 /**
1007 * Read/write mode.
1008 */
1009 const RW = 393216;
1010 /**
1011 * The transaction wrapping the operations on the *large object*.
1012 *
1013 * @public
1014 * @readonly
1015 * @var \pq\Transaction
1016 */
1017 public $transaction;
1018 /**
1019 * The OID of the *large object*.
1020 *
1021 * @public
1022 * @readonly
1023 * @var int
1024 */
1025 public $oid;
1026 /**
1027 * The stream connected to the *large object*.
1028 *
1029 * @public
1030 * @readonly
1031 * @var resource
1032 */
1033 public $stream;
1034 /**
1035 * Open or create a *large object*.
1036 * See pq\Transaction::openLOB() and pq\Transaction::createLOB().
1037 *
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
1044 */
1045 function __construct(\pq\Transaction $txn, int $oid = \pq\LOB::INVALID_OID, int $mode = \pq\LOB::RW) {}
1046 /**
1047 * Read a string of data from the current position of the *large object*.
1048 *
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.
1055 */
1056 function read(int $length = 0x1000, int &$read = NULL) {}
1057 /**
1058 * Seek to a position within the *large object*.
1059 *
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.
1066 */
1067 function seek(int $offset, int $whence = SEEK_SET) {}
1068 /**
1069 * Retrieve the current position within the *large object*.
1070 *
1071 * @throws \pq\Exception\InvalidArgumentException
1072 * @throws \pq\Exception\BadMethodCallException
1073 * @throws \pq\Exception\RuntimeException
1074 * @return int the current position.
1075 */
1076 function tell() {}
1077 /**
1078 * Truncate the *large object*.
1079 *
1080 * @param int $length The length to truncate to.
1081 * @throws \pq\Exception\InvalidArgumentException
1082 * @throws \pq\Exception\BadMethodCallException
1083 * @throws \pq\Exception\RuntimeException
1084 */
1085 function truncate(int $length = 0) {}
1086 /**
1087 * Write data to the *large object*.
1088 *
1089 * @param string $data The data that should be written to the current position.
1090 * @return int the number of bytes written.
1091 */
1092 function write(string $data) {}
1093 }
1094 /**
1095 * A query result.
1096 *
1097 * See [Fetching Results](pq/Result/: Fetching Results) for a general overview.
1098 */
1099 class Result implements \Traversable, \Countable {
1100 /**
1101 * The query sent to the server was empty.
1102 */
1103 const EMPTY_QUERY = 0;
1104 /**
1105 * The query did not generate a result set and completed successfully.
1106 */
1107 const COMMAND_OK = 1;
1108 /**
1109 * The query successfully generated a result set.
1110 */
1111 const TUPLES_OK = 2;
1112 /**
1113 * The result contains a single row of the result set when using pq\Connection::$unbuffered.
1114 */
1115 const SINGLE_TUPLE = 9;
1116 /**
1117 * COPY data can be received from the server.
1118 */
1119 const COPY_OUT = 3;
1120 /**
1121 * COPY data can be sent to the server.
1122 */
1123 const COPY_IN = 4;
1124 /**
1125 * COPY in/out data transfer in progress.
1126 */
1127 const COPY_BOTH = 8;
1128 /**
1129 * The server sent a bad response.
1130 */
1131 const BAD_RESPONSE = 5;
1132 /**
1133 * A nonfatal error (notice or warning) occurred.
1134 */
1135 const NONFATAL_ERROR = 6;
1136 /**
1137 * A fatal error occurred.
1138 */
1139 const FATAL_ERROR = 7;
1140 /**
1141 * Fetch rows numerically indexed, where the index start with 0.
1142 */
1143 const FETCH_ARRAY = 0;
1144 /**
1145 * Fetch rows associatively indexed by column name.
1146 */
1147 const FETCH_ASSOC = 1;
1148 /**
1149 * Fetch rows as stdClass instance, where the column names are the property names.
1150 */
1151 const FETCH_OBJECT = 2;
1152 /**
1153 * Automatically convert 'f' and 't' to FALSE and TRUE and vice versa.
1154 */
1155 const CONV_BOOL = 1;
1156 /**
1157 * Automatically convert integral strings to either int if it fits into maximum integer size or else to float and vice versa.
1158 */
1159 const CONV_INT = 2;
1160 /**
1161 * Automatically convert floating point numbers.
1162 */
1163 const CONV_FLOAT = 4;
1164 /**
1165 * Do all scalar conversions listed above.
1166 */
1167 const CONV_SCALAR = 15;
1168 /**
1169 * Automatically convert arrays.
1170 */
1171 const CONV_ARRAY = 16;
1172 /**
1173 * Automatically convert date strings to pq\DateTime and vice versa.
1174 */
1175 const CONV_DATETIME = 32;
1176 /**
1177 * Automatically convert JSON.
1178 */
1179 const CONV_JSON = 256;
1180 /**
1181 * Do all of the above.
1182 */
1183 const CONV_ALL = 65535;
1184 /**
1185 * A [status constant](pq/Result#Status.values:).
1186 *
1187 * @public
1188 * @readonly
1189 * @var int
1190 */
1191 public $status;
1192 /**
1193 * The accompanying status message.
1194 *
1195 * @public
1196 * @readonly
1197 * @var string
1198 */
1199 public $statusMessage;
1200 /**
1201 * Any error message if $status indicates an error.
1202 *
1203 * @public
1204 * @readonly
1205 * @var string
1206 */
1207 public $errorMessage;
1208 /**
1209 * The number of rows in the result set.
1210 *
1211 * @public
1212 * @readonly
1213 * @var int
1214 */
1215 public $numRows;
1216 /**
1217 * The number of fields in a single tuple of the result set.
1218 *
1219 * @public
1220 * @readonly
1221 * @var int
1222 */
1223 public $numCols;
1224 /**
1225 * The number of rows affected by a statement.
1226 *
1227 * @public
1228 * @readonly
1229 * @var int
1230 */
1231 public $affectedRows;
1232 /**
1233 * Error details. See [PQresultErrorField](https://www.postgresql.org/docs/current/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD) docs.
1234 *
1235 * @public
1236 * @readonly
1237 * @var array
1238 */
1239 public $diag;
1240 /**
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.
1242 *
1243 * @public
1244 * @var int
1245 */
1246 public $fetchType = \pq\Result::FETCH_ARRAY;
1247 /**
1248 * What [type of conversions](pq/Result#Conversion.bits:) to perform automatically.
1249 *
1250 * @public
1251 * @var int
1252 */
1253 public $autoConvert = \pq\Result::CONV_ALL;
1254 /**
1255 * Bind a variable to a result column.
1256 * See pq\Result::fetchBound().
1257 *
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.
1263 */
1264 function bind($col, $var) {}
1265 /**
1266 * Count number of rows in this result set.
1267 *
1268 * @throws \pq\Exception\InvalidArgumentException
1269 * @throws \pq\Exception\BadMethodCallException
1270 * @return int the number of rows.
1271 */
1272 function count() {}
1273 /**
1274 * Describe a prepared statement.
1275 *
1276 * > ***NOTE:***
1277 * This will only return meaningful information for a result of pq\Statement::desc().
1278 *
1279 * @throws \pq\Exception\InvalidArgumentException
1280 * @throws \pq\Exception\BadMethodCallException
1281 * @return array list of parameter type OIDs for the prepared statement.
1282 */
1283 function desc() {}
1284 /**
1285 * Fetch all rows at once.
1286 *
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.
1291 */
1292 function fetchAll(int $fetch_type = NULL) {}
1293 /**
1294 * Fetch all rows of a single column.
1295 *
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.
1301 */
1302 function fetchAllCols(int $col = 0) {}
1303 /**
1304 * Iteratively fetch a row into bound variables.
1305 * See pq\Result::bind().
1306 *
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.
1312 */
1313 function fetchBound() {}
1314 /**
1315 * Iteratively fetch a single column.
1316 *
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.
1324 */
1325 function fetchCol($ref, $col = 0) {}
1326 /**
1327 * Iteratively fetch a row.
1328 *
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.
1337 */
1338 function fetchRow(int $fetch_type = NULL) {}
1339 /**
1340 * Fetch the complete result set as a simple map, a *multi dimensional array*, each dimension indexed by a column.
1341 *
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.
1349 */
1350 function map($keys = 0, $vals = NULL, int $fetch_type = NULL) {}
1351 }
1352 /**
1353 * A named prepared statement.
1354 * See pq\Connection::prepare().
1355 */
1356 class Statement {
1357 /**
1358 * The connection to the server.
1359 *
1360 * @public
1361 * @readonly
1362 * @var \pq\Connection
1363 */
1364 public $connection;
1365 /**
1366 * The identifiying name of the prepared statement.
1367 *
1368 * @public
1369 * @readonly
1370 * @var string
1371 */
1372 public $name;
1373 /**
1374 * The query string used to prepare the statement.
1375 *
1376 * @public
1377 * @readonly
1378 * @var string
1379 */
1380 public $query;
1381 /**
1382 * List of corresponding query parameter type OIDs for the prepared statement.
1383 *
1384 * @public
1385 * @readonly
1386 * @var array
1387 */
1388 public $types;
1389 /**
1390 * Prepare a new statement.
1391 * See pq\Connection::prepare().
1392 *
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
1402 */
1403 function __construct(\pq\Connection $conn, string $name, string $query, array $types = NULL, bool $async = FALSE) {}
1404 /**
1405 * Bind a variable to an input parameter.
1406 *
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
1411 */
1412 function bind(int $param_no, &$param_ref) {}
1413 /**
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.
1416 *
1417 * @throws \pq\Exception\InvalidArgumentException
1418 * @throws \pq\Exception\BadMethodCallException
1419 * @throws \pq\Exception\RuntimeException
1420 */
1421 function deallocate() {}
1422 /**
1423 * [Asynchronously](pq/Connection/: Asynchronous Usage) free the server resources used by the
1424 * prepared statement, so it can no longer be executed.
1425 *
1426 * @throws \pq\Exception\InvalidArgumentException
1427 * @throws \pq\Exception\BadMethodCallException
1428 * @throws \pq\Exception\RuntimeException
1429 */
1430 function deallocateAsync() {}
1431 /**
1432 * Describe the parameters of the prepared statement.
1433 *
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.
1439 */
1440 function desc() {}
1441 /**
1442 * [Asynchronously](pq/Connection/: Asynchronous Usage) describe the parameters of the prepared statement.
1443 *
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
1449 */
1450 function descAsync(callable $callback) {}
1451 /**
1452 * Execute the prepared statement.
1453 *
1454 * @param array $params Any parameters to substitute in the prepared statement (defaults to any bou
1455 * nd variables).
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.
1460 */
1461 function exec(array $params = NULL) {}
1462 /**
1463 * [Asynchronously](pq/Connection/: Asynchronous Usage) execute the prepared statement.
1464 *
1465 * @param array $params Any parameters to substitute in the prepared statement (defaults to any bou
1466 * nd variables).
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
1472 */
1473 function execAsync(array $params = NULL, callable $cb = NULL) {}
1474 /**
1475 * Re-prepare a statement that has been deallocated. This is a no-op on already open statements.
1476 *
1477 * @throws \pq\Exception\InvalidArgumentException
1478 * @throws \pq\Exception\BadMethodCallException
1479 * @throws \pq\Exception\RuntimeException
1480 */
1481 function prepare() {}
1482 /**
1483 * [Asynchronously](pq/Connection/: Asynchronous Usage) re-prepare a statement that has been
1484 * deallocated. This is a no-op on already open statements.
1485 *
1486 * @throws \pq\Exception\InvalidArgumentException
1487 * @throws \pq\Exception\BadMethodCallException
1488 * @throws \pq\Exception\RuntimeException
1489 */
1490 function prepareAsync() {}
1491 }
1492 /**
1493 * A database transaction.
1494 *
1495 * > ***NOTE:***
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.
1497 */
1498 class Transaction {
1499 /**
1500 * Transaction isolation level where only rows committed before the transaction began can be seen.
1501 */
1502 const READ_COMMITTED = 0;
1503 /**
1504 * Transaction isolation level where only rows committed before the first query was executed in this transaction.
1505 */
1506 const REPEATABLE_READ = 1;
1507 /**
1508 * Transaction isolation level that guarantees serializable repeatability which might lead to serialization_failure on high concurrency.
1509 */
1510 const SERIALIZABLE = 2;
1511 /**
1512 * The connection the transaction was started on.
1513 *
1514 * @public
1515 * @readonly
1516 * @var \pq\Connection
1517 */
1518 public $connection;
1519 /**
1520 * The transaction isolation level.
1521 *
1522 * @public
1523 * @var int
1524 */
1525 public $isolation = \pq\Transaction::READ_COMMITTED;
1526 /**
1527 * Whether this transaction performs read only queries.
1528 *
1529 * @public
1530 * @var bool
1531 */
1532 public $readonly = FALSE;
1533 /**
1534 * Whether the transaction is deferrable. See pq\Connection::startTransaction().
1535 *
1536 * @public
1537 * @var bool
1538 */
1539 public $deferrable = FALSE;
1540 /**
1541 * Start a transaction.
1542 * See pq\Connection::startTransaction().
1543 *
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
1552 */
1553 function __construct(\pq\Connection $conn, bool $async = FALSE, int $isolation = \pq\Transaction::READ_COMMITTED, bool $readonly = FALSE, bool $deferrable = FALSE) {}
1554 /**
1555 * Commit the transaction or release the previous savepoint.
1556 * See pq\Transaction::savepoint().
1557 *
1558 * @throws \pq\Exception\InvalidArgumentException
1559 * @throws \pq\Exception\BadMethodCallException
1560 * @throws \pq\Exception\RuntimeException
1561 * @throws \pq\Exception\DomainException
1562 */
1563 function commit() {}
1564 /**
1565 * [Asynchronously](pq/Connection/: Asynchronous Usage) commit the transaction or release the previous savepoint.
1566 * See pq\Transaction::commit() and pq\Transaction::savepoint().
1567 *
1568 * @throws \pq\Exception\InvalidArgumentException
1569 * @throws \pq\Exception\BadMethodCallException
1570 * @throws \pq\Exception\RuntimeException
1571 */
1572 function commitAsync() {}
1573 /**
1574 * Create a new *large object* and open it.
1575 * See pq\Transaction::openLOB().
1576 *
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*.
1582 */
1583 function createLOB(int $mode = \pq\LOB::RW) {}
1584 /**
1585 * Export a *large object* to a local file.
1586 * See pq\Transaction::importLOB().
1587 *
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
1593 */
1594 function exportLOB(int $oid, string $path) {}
1595 /**
1596 * Export a snapshot for transaction synchronization.
1597 * See pq\Transaction::importSnapshot().
1598 *
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().
1604 */
1605 function exportSnapshot() {}
1606 /**
1607 * [Asynchronously](pq/Connection/: Asynchronous Usage) export a snapshot for transaction synchronization.
1608 * See pq\Transaction::exportSnapshot().
1609 *
1610 * @throws \pq\Exception\InvalidArgumentException
1611 * @throws \pq\Exception\BadMethodCallException
1612 * @throws \pq\Exception\RuntimeException
1613 */
1614 function exportSnapshotAsync() {}
1615 /**
1616 * Import a local file into a *large object*.
1617 *
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*.
1624 */
1625 function importLOB(string $local_path, int $oid = \pq\LOB::INVALID_OID) {}
1626 /**
1627 * Import a snapshot from another transaction to synchronize with.
1628 * See pq\Transaction::exportSnapshot().
1629 *
1630 * > ***NOTE:***
1631 * The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
1632 *
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
1638 */
1639 function importSnapshot(string $snapshot_id) {}
1640 /**
1641 * [Asynchronously](pq/Connection/: Asynchronous Usage) import a snapshot from another transaction to synchronize with.
1642 * See pq\Transaction::importSnapshot().
1643 *
1644 * > ***NOTE:***
1645 * The transaction must have an isolation level of at least pq\Transaction::REPEATABLE_READ.
1646 *
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
1651 */
1652 function importSnapshotAsync(string $snapshot_id) {}
1653 /**
1654 * Open a *large object*.
1655 * See pq\Transaction::createLOB().
1656 *
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*.
1663 */
1664 function openLOB(int $oid, int $mode = \pq\LOB::RW) {}
1665 /**
1666 * Rollback the transaction or to the previous savepoint within this transaction.
1667 * See pq\Transaction::commit() and pq\Transaction::savepoint().
1668 *
1669 * @throws \pq\Exception\InvalidArgumentException
1670 * @throws \pq\Exception\BadMethodCallException
1671 * @throws \pq\Exception\RuntimeException
1672 * @throws \pq\Exception\DomainException
1673 */
1674 function rollback() {}
1675 /**
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().
1678 *
1679 * @throws \pq\Exception\InvalidArgumentException
1680 * @throws \pq\Exception\BadMethodCallException
1681 * @throws \pq\Exception\RuntimeException
1682 */
1683 function rollbackAsync() {}
1684 /**
1685 * Create a `SAVEPOINT` within this transaction.
1686 *
1687 * > ***NOTE:***
1688 * pq\Transaction tracks an internal counter as savepoint identifier.
1689 *
1690 * @throws \pq\Exception\InvalidArgumentException
1691 * @throws \pq\Exception\BadMethodCallException
1692 * @throws \pq\Exception\RuntimeException
1693 */
1694 function savepoint() {}
1695 /**
1696 * [Asynchronously](pq/Connection/: Asynchronous Usage) create a `SAVEPOINT` within this transaction.
1697 * See pq\Transaction::savepoint().
1698 *
1699 * @throws \pq\Exception\InvalidArgumentException
1700 * @throws \pq\Exception\BadMethodCallException
1701 * @throws \pq\Exception\RuntimeException
1702 */
1703 function savepointAsync() {}
1704 /**
1705 * Unlink a *large object*.
1706 * See pq\Transaction::createLOB().
1707 *
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*.
1713 */
1714 function unlinkLOB(int $oid) {}
1715 }
1716 /**
1717 * Accessor to the PostgreSQL `pg_type` relation.
1718 * See [here for an overview](pq/Types/: Overview).
1719 */
1720 class Types implements \ArrayAccess {
1721 /**
1722 * OID of the `bool` type.
1723 */
1724 const BOOL = 16;
1725 /**
1726 * OID of the `bytea` type.
1727 */
1728 const BYTEA = 17;
1729 /**
1730 * OID of the `char` type.
1731 */
1732 const CHAR = 18;
1733 /**
1734 * OID of the `name` type.
1735 */
1736 const NAME = 19;
1737 /**
1738 * OID of the `int8` type.
1739 */
1740 const INT8 = 20;
1741 /**
1742 * OID of the `int2` type.
1743 */
1744 const INT2 = 21;
1745 /**
1746 * OID of the `int2vector` type.
1747 */
1748 const INT2VECTOR = 22;
1749 /**
1750 * OID of the `int4` type.
1751 */
1752 const INT4 = 23;
1753 /**
1754 * OID of the `regproc` type.
1755 */
1756 const REGPROC = 24;
1757 /**
1758 * OID of the `text` type.
1759 */
1760 const TEXT = 25;
1761 /**
1762 * OID of the `oid` type.
1763 */
1764 const OID = 26;
1765 /**
1766 * OID of the `tid` type.
1767 */
1768 const TID = 27;
1769 /**
1770 * OID of the `xid` type.
1771 */
1772 const XID = 28;
1773 /**
1774 * OID of the `cid` type.
1775 */
1776 const CID = 29;
1777 /**
1778 * OID of the `oidvector` type.
1779 */
1780 const OIDVECTOR = 30;
1781 /**
1782 * OID of the `pg_type` type.
1783 */
1784 const PG_TYPE = 71;
1785 /**
1786 * OID of the `pg_attribute` type.
1787 */
1788 const PG_ATTRIBUTE = 75;
1789 /**
1790 * OID of the `pg_proc` type.
1791 */
1792 const PG_PROC = 81;
1793 /**
1794 * OID of the `pg_class` type.
1795 */
1796 const PG_CLASS = 83;
1797 /**
1798 * OID of the `json` type.
1799 */
1800 const JSON = 114;
1801 /**
1802 * OID of the `xml` type.
1803 */
1804 const XML = 142;
1805 /**
1806 * OID of the `xmlarray` type.
1807 */
1808 const XMLARRAY = 143;
1809 /**
1810 * OID of the `jsonarray` type.
1811 */
1812 const JSONARRAY = 199;
1813 /**
1814 * OID of the `pg_node_tree` type.
1815 */
1816 const PG_NODE_TREE = 194;
1817 /**
1818 * OID of the `smgr` type.
1819 */
1820 const SMGR = 210;
1821 /**
1822 * OID of the `point` type.
1823 */
1824 const POINT = 600;
1825 /**
1826 * OID of the `lseg` type.
1827 */
1828 const LSEG = 601;
1829 /**
1830 * OID of the `path` type.
1831 */
1832 const PATH = 602;
1833 /**
1834 * OID of the `box` type.
1835 */
1836 const BOX = 603;
1837 /**
1838 * OID of the `polygon` type.
1839 */
1840 const POLYGON = 604;
1841 /**
1842 * OID of the `line` type.
1843 */
1844 const LINE = 628;
1845 /**
1846 * OID of the `linearray` type.
1847 */
1848 const LINEARRAY = 629;
1849 /**
1850 * OID of the `float4` type.
1851 */
1852 const FLOAT4 = 700;
1853 /**
1854 * OID of the `float8` type.
1855 */
1856 const FLOAT8 = 701;
1857 /**
1858 * OID of the `unknown` type.
1859 */
1860 const UNKNOWN = 705;
1861 /**
1862 * OID of the `circle` type.
1863 */
1864 const CIRCLE = 718;
1865 /**
1866 * OID of the `circlearray` type.
1867 */
1868 const CIRCLEARRAY = 719;
1869 /**
1870 * OID of the `money` type.
1871 */
1872 const MONEY = 790;
1873 /**
1874 * OID of the `moneyarray` type.
1875 */
1876 const MONEYARRAY = 791;
1877 /**
1878 * OID of the `macaddr` type.
1879 */
1880 const MACADDR = 829;
1881 /**
1882 * OID of the `inet` type.
1883 */
1884 const INET = 869;
1885 /**
1886 * OID of the `cidr` type.
1887 */
1888 const CIDR = 650;
1889 /**
1890 * OID of the `boolarray` type.
1891 */
1892 const BOOLARRAY = 1000;
1893 /**
1894 * OID of the `byteaarray` type.
1895 */
1896 const BYTEAARRAY = 1001;
1897 /**
1898 * OID of the `chararray` type.
1899 */
1900 const CHARARRAY = 1002;
1901 /**
1902 * OID of the `namearray` type.
1903 */
1904 const NAMEARRAY = 1003;
1905 /**
1906 * OID of the `int2array` type.
1907 */
1908 const INT2ARRAY = 1005;
1909 /**
1910 * OID of the `int2vectorarray` type.
1911 */
1912 const INT2VECTORARRAY = 1006;
1913 /**
1914 * OID of the `int4array` type.
1915 */
1916 const INT4ARRAY = 1007;
1917 /**
1918 * OID of the `regprocarray` type.
1919 */
1920 const REGPROCARRAY = 1008;
1921 /**
1922 * OID of the `textarray` type.
1923 */
1924 const TEXTARRAY = 1009;
1925 /**
1926 * OID of the `oidarray` type.
1927 */
1928 const OIDARRAY = 1028;
1929 /**
1930 * OID of the `tidarray` type.
1931 */
1932 const TIDARRAY = 1010;
1933 /**
1934 * OID of the `xidarray` type.
1935 */
1936 const XIDARRAY = 1011;
1937 /**
1938 * OID of the `cidarray` type.
1939 */
1940 const CIDARRAY = 1012;
1941 /**
1942 * OID of the `oidvectorarray` type.
1943 */
1944 const OIDVECTORARRAY = 1013;
1945 /**
1946 * OID of the `bpchararray` type.
1947 */
1948 const BPCHARARRAY = 1014;
1949 /**
1950 * OID of the `varchararray` type.
1951 */
1952 const VARCHARARRAY = 1015;
1953 /**
1954 * OID of the `int8array` type.
1955 */
1956 const INT8ARRAY = 1016;
1957 /**
1958 * OID of the `pointarray` type.
1959 */
1960 const POINTARRAY = 1017;
1961 /**
1962 * OID of the `lsegarray` type.
1963 */
1964 const LSEGARRAY = 1018;
1965 /**
1966 * OID of the `patharray` type.
1967 */
1968 const PATHARRAY = 1019;
1969 /**
1970 * OID of the `boxarray` type.
1971 */
1972 const BOXARRAY = 1020;
1973 /**
1974 * OID of the `float4array` type.
1975 */
1976 const FLOAT4ARRAY = 1021;
1977 /**
1978 * OID of the `float8array` type.
1979 */
1980 const FLOAT8ARRAY = 1022;
1981 /**
1982 * OID of the `polygonarray` type.
1983 */
1984 const POLYGONARRAY = 1027;
1985 /**
1986 * OID of the `aclitem` type.
1987 */
1988 const ACLITEM = 1033;
1989 /**
1990 * OID of the `aclitemarray` type.
1991 */
1992 const ACLITEMARRAY = 1034;
1993 /**
1994 * OID of the `macaddrarray` type.
1995 */
1996 const MACADDRARRAY = 1040;
1997 /**
1998 * OID of the `inetarray` type.
1999 */
2000 const INETARRAY = 1041;
2001 /**
2002 * OID of the `cidrarray` type.
2003 */
2004 const CIDRARRAY = 651;
2005 /**
2006 * OID of the `cstringarray` type.
2007 */
2008 const CSTRINGARRAY = 1263;
2009 /**
2010 * OID of the `bpchar` type.
2011 */
2012 const BPCHAR = 1042;
2013 /**
2014 * OID of the `varchar` type.
2015 */
2016 const VARCHAR = 1043;
2017 /**
2018 * OID of the `date` type.
2019 */
2020 const DATE = 1082;
2021 /**
2022 * OID of the `time` type.
2023 */
2024 const TIME = 1083;
2025 /**
2026 * OID of the `timestamp` type.
2027 */
2028 const TIMESTAMP = 1114;
2029 /**
2030 * OID of the `timestamparray` type.
2031 */
2032 const TIMESTAMPARRAY = 1115;
2033 /**
2034 * OID of the `datearray` type.
2035 */
2036 const DATEARRAY = 1182;
2037 /**
2038 * OID of the `timearray` type.
2039 */
2040 const TIMEARRAY = 1183;
2041 /**
2042 * OID of the `timestamptz` type.
2043 */
2044 const TIMESTAMPTZ = 1184;
2045 /**
2046 * OID of the `timestamptzarray` type.
2047 */
2048 const TIMESTAMPTZARRAY = 1185;
2049 /**
2050 * OID of the `interval` type.
2051 */
2052 const INTERVAL = 1186;
2053 /**
2054 * OID of the `intervalarray` type.
2055 */
2056 const INTERVALARRAY = 1187;
2057 /**
2058 * OID of the `numericarray` type.
2059 */
2060 const NUMERICARRAY = 1231;
2061 /**
2062 * OID of the `timetz` type.
2063 */
2064 const TIMETZ = 1266;
2065 /**
2066 * OID of the `timetzarray` type.
2067 */
2068 const TIMETZARRAY = 1270;
2069 /**
2070 * OID of the `bit` type.
2071 */
2072 const BIT = 1560;
2073 /**
2074 * OID of the `bitarray` type.
2075 */
2076 const BITARRAY = 1561;
2077 /**
2078 * OID of the `varbit` type.
2079 */
2080 const VARBIT = 1562;
2081 /**
2082 * OID of the `varbitarray` type.
2083 */
2084 const VARBITARRAY = 1563;
2085 /**
2086 * OID of the `numeric` type.
2087 */
2088 const NUMERIC = 1700;
2089 /**
2090 * OID of the `refcursor` type.
2091 */
2092 const REFCURSOR = 1790;
2093 /**
2094 * OID of the `refcursorarray` type.
2095 */
2096 const REFCURSORARRAY = 2201;
2097 /**
2098 * OID of the `regprocedure` type.
2099 */
2100 const REGPROCEDURE = 2202;
2101 /**
2102 * OID of the `regoper` type.
2103 */
2104 const REGOPER = 2203;
2105 /**
2106 * OID of the `regoperator` type.
2107 */
2108 const REGOPERATOR = 2204;
2109 /**
2110 * OID of the `regclass` type.
2111 */
2112 const REGCLASS = 2205;
2113 /**
2114 * OID of the `regtype` type.
2115 */
2116 const REGTYPE = 2206;
2117 /**
2118 * OID of the `regprocedurearray` type.
2119 */
2120 const REGPROCEDUREARRAY = 2207;
2121 /**
2122 * OID of the `regoperarray` type.
2123 */
2124 const REGOPERARRAY = 2208;
2125 /**
2126 * OID of the `regoperatorarray` type.
2127 */
2128 const REGOPERATORARRAY = 2209;
2129 /**
2130 * OID of the `regclassarray` type.
2131 */
2132 const REGCLASSARRAY = 2210;
2133 /**
2134 * OID of the `regtypearray` type.
2135 */
2136 const REGTYPEARRAY = 2211;
2137 /**
2138 * OID of the `uuid` type.
2139 */
2140 const UUID = 2950;
2141 /**
2142 * OID of the `uuidarray` type.
2143 */
2144 const UUIDARRAY = 2951;
2145 /**
2146 * OID of the `tsvector` type.
2147 */
2148 const TSVECTOR = 3614;
2149 /**
2150 * OID of the `gtsvector` type.
2151 */
2152 const GTSVECTOR = 3642;
2153 /**
2154 * OID of the `tsquery` type.
2155 */
2156 const TSQUERY = 3615;
2157 /**
2158 * OID of the `regconfig` type.
2159 */
2160 const REGCONFIG = 3734;
2161 /**
2162 * OID of the `regdictionary` type.
2163 */
2164 const REGDICTIONARY = 3769;
2165 /**
2166 * OID of the `tsvectorarray` type.
2167 */
2168 const TSVECTORARRAY = 3643;
2169 /**
2170 * OID of the `gtsvectorarray` type.
2171 */
2172 const GTSVECTORARRAY = 3644;
2173 /**
2174 * OID of the `tsqueryarray` type.
2175 */
2176 const TSQUERYARRAY = 3645;
2177 /**
2178 * OID of the `regconfigarray` type.
2179 */
2180 const REGCONFIGARRAY = 3735;
2181 /**
2182 * OID of the `regdictionaryarray` type.
2183 */
2184 const REGDICTIONARYARRAY = 3770;
2185 /**
2186 * OID of the `txid_snapshot` type.
2187 */
2188 const TXID_SNAPSHOT = 2970;
2189 /**
2190 * OID of the `txid_snapshotarray` type.
2191 */
2192 const TXID_SNAPSHOTARRAY = 2949;
2193 /**
2194 * OID of the `int4range` type.
2195 */
2196 const INT4RANGE = 3904;
2197 /**
2198 * OID of the `int4rangearray` type.
2199 */
2200 const INT4RANGEARRAY = 3905;
2201 /**
2202 * OID of the `numrange` type.
2203 */
2204 const NUMRANGE = 3906;
2205 /**
2206 * OID of the `numrangearray` type.
2207 */
2208 const NUMRANGEARRAY = 3907;
2209 /**
2210 * OID of the `tsrange` type.
2211 */
2212 const TSRANGE = 3908;
2213 /**
2214 * OID of the `tsrangearray` type.
2215 */
2216 const TSRANGEARRAY = 3909;
2217 /**
2218 * OID of the `tstzrange` type.
2219 */
2220 const TSTZRANGE = 3910;
2221 /**
2222 * OID of the `tstzrangearray` type.
2223 */
2224 const TSTZRANGEARRAY = 3911;
2225 /**
2226 * OID of the `daterange` type.
2227 */
2228 const DATERANGE = 3912;
2229 /**
2230 * OID of the `daterangearray` type.
2231 */
2232 const DATERANGEARRAY = 3913;
2233 /**
2234 * OID of the `int8range` type.
2235 */
2236 const INT8RANGE = 3926;
2237 /**
2238 * OID of the `int8rangearray` type.
2239 */
2240 const INT8RANGEARRAY = 3927;
2241 /**
2242 * OID of the `record` type.
2243 */
2244 const RECORD = 2249;
2245 /**
2246 * OID of the `cstring` type.
2247 */
2248 const CSTRING = 2275;
2249 /**
2250 * OID of the `any` type.
2251 */
2252 const ANY = 2276;
2253 /**
2254 * OID of the `anyarray` type.
2255 */
2256 const ANYARRAY = 2277;
2257 /**
2258 * OID of the `void` type.
2259 */
2260 const VOID = 2278;
2261 /**
2262 * OID of the `trigger` type.
2263 */
2264 const TRIGGER = 2279;
2265 /**
2266 * OID of the `event_trigger` type.
2267 */
2268 const EVENT_TRIGGER = 3838;
2269 /**
2270 * OID of the `language_handler` type.
2271 */
2272 const LANGUAGE_HANDLER = 2280;
2273 /**
2274 * OID of the `internal` type.
2275 */
2276 const INTERNAL = 2281;
2277 /**
2278 * OID of the `opaque` type.
2279 */
2280 const OPAQUE = 2282;
2281 /**
2282 * OID of the `anyelement` type.
2283 */
2284 const ANYELEMENT = 2283;
2285 /**
2286 * OID of the `anynonarray` type.
2287 */
2288 const ANYNONARRAY = 2776;
2289 /**
2290 * OID of the `anyenum` type.
2291 */
2292 const ANYENUM = 3500;
2293 /**
2294 * OID of the `fdw_handler` type.
2295 */
2296 const FDW_HANDLER = 3115;
2297 /**
2298 * OID of the `anyrange` type.
2299 */
2300 const ANYRANGE = 3831;
2301 /**
2302 * The connection which was used to obtain type information.
2303 *
2304 * @public
2305 * @readonly
2306 * @var \pq\Connection
2307 */
2308 public $connection;
2309 /**
2310 * Create a new instance populated with information obtained from the `pg_type` relation.
2311 *
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
2317 */
2318 function __construct(\pq\Connection $conn, array $namespaces = NULL) {}
2319 /**
2320 * Refresh type information from `pg_type`.
2321 *
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
2326 */
2327 function refresh(array $namespaces = NULL) {}
2328 }
2329 namespace pq\Exception;
2330 /**
2331 * A method call was not expected.
2332 */
2333 class BadMethodCallException extends \BadMethodCallException implements \pq\Exception {
2334 }
2335 /**
2336 * Implementation or SQL syntax error.
2337 */
2338 class DomainException extends \DomainException implements \pq\Exception {
2339 /**
2340 * The SQLSTATE code, see the [official documentation](http://www.postgresql.org/docs/current/static/errcodes-appendix.html) for further information.
2341 *
2342 * @public
2343 * @readonly
2344 * @var string
2345 */
2346 public $sqlstate;
2347 }
2348 /**
2349 * An invalid argument was passed to a method.
2350 */
2351 class InvalidArgumentException extends \InvalidArgumentException implements \pq\Exception {
2352 }
2353 /**
2354 * A runtime exception occurred.
2355 */
2356 class RuntimeException extends \RuntimeException implements \pq\Exception {
2357 }