-
Notifications
You must be signed in to change notification settings - Fork 7
/
pgsql.php
2288 lines (2116 loc) · 79.6 KB
/
pgsql.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Start of pgsql v.7.0.4-7ubuntu2
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Open a PostgreSQL connection
* @link http://php.net/manual/en/function.pg-connect.php
* @param string $connection_string <p>
* The <i>connection_string</i> can be empty to use all default parameters, or it
* can contain one or more parameter settings separated by whitespace.
* Each parameter setting is in the form keyword = value. Spaces around
* the equal sign are optional. To write an empty value or a value
* containing spaces, surround it with single quotes, e.g., keyword =
* 'a value'. Single quotes and backslashes within the value must be
* escaped with a backslash, i.e., \' and \\.
* </p>
* <p>
* The currently recognized parameter keywords are:
* <i>host</i>, <i>hostaddr</i>, <i>port</i>,
* <i>dbname</i> (defaults to value of <i>user</i>),
* <i>user</i>,
* <i>password</i>, <i>connect_timeout</i>,
* <i>options</i>, <i>tty</i> (ignored), <i>sslmode</i>,
* <i>requiressl</i> (deprecated in favor of <i>sslmode</i>), and
* <i>service</i>. Which of these arguments exist depends
* on your PostgreSQL version.
* </p>
* <p>
* The <i>options</i> parameter can be used to set command line parameters
* to be invoked by the server.
* </p>
* @param int $connect_type [optional] <p>
* If <b>PGSQL_CONNECT_FORCE_NEW</b> is passed, then a new connection
* is created, even if the <i>connection_string</i> is identical to
* an existing connection.
* </p>
* <p>
* If <b>PGSQL_CONNECT_ASYNC</b> is given, then the
* connection is established asynchronously. The state of the connection
* can then be checked via <b>pg_connect_poll</b> or
* <b>pg_connection_status</b>.
* </p>
* @return resource PostgreSQL connection resource on success, <b>FALSE</b> on failure.
*/
function pg_connect(string $connection_string, int $connect_type = null) {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Open a persistent PostgreSQL connection
* @link http://php.net/manual/en/function.pg-pconnect.php
* @param string $connection_string <p>
* The <i>connection_string</i> can be empty to use all default parameters, or it
* can contain one or more parameter settings separated by whitespace.
* Each parameter setting is in the form keyword = value. Spaces around
* the equal sign are optional. To write an empty value or a value
* containing spaces, surround it with single quotes, e.g., keyword =
* 'a value'. Single quotes and backslashes within the value must be
* escaped with a backslash, i.e., \' and \\.
* </p>
* <p>
* The currently recognized parameter keywords are:
* <i>host</i>, <i>hostaddr</i>, <i>port</i>,
* <i>dbname</i>, <i>user</i>,
* <i>password</i>, <i>connect_timeout</i>,
* <i>options</i>, <i>tty</i> (ignored), <i>sslmode</i>,
* <i>requiressl</i> (deprecated in favor of <i>sslmode</i>), and
* <i>service</i>. Which of these arguments exist depends
* on your PostgreSQL version.
* </p>
* @param int $connect_type [optional] <p>
* If <b>PGSQL_CONNECT_FORCE_NEW</b> is passed, then a new connection
* is created, even if the <i>connection_string</i> is identical to
* an existing connection.
* </p>
* @return resource PostgreSQL connection resource on success, <b>FALSE</b> on failure.
*/
function pg_pconnect(string $connection_string, int $connect_type = null) {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Poll the status of an in-progress asynchronous PostgreSQL connection
attempt.
* @link http://php.net/manual/en/function.pg-connect-poll.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource.
* </p>
* @return int <b>PGSQL_POLLING_FAILED</b>,
* <b>PGSQL_POLLING_READING</b>,
* <b>PGSQL_POLLING_WRITING</b>,
* <b>PGSQL_POLLING_OK</b>, or
* <b>PGSQL_POLLING_ACTIVE</b>.
*/
function pg_connect_poll($connection = null): int {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Closes a PostgreSQL connection
* @link http://php.net/manual/en/function.pg-close.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_close($connection = null): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Get connection status
* @link http://php.net/manual/en/function.pg-connection-status.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return int <b>PGSQL_CONNECTION_OK</b> or
* <b>PGSQL_CONNECTION_BAD</b>.
*/
function pg_connection_status($connection): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Get connection is busy or not
* @link http://php.net/manual/en/function.pg-connection-busy.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return bool <b>TRUE</b> if the connection is busy, <b>FALSE</b> otherwise.
*/
function pg_connection_busy($connection): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Reset connection (reconnect)
* @link http://php.net/manual/en/function.pg-connection-reset.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_connection_reset($connection): bool {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Returns the host name associated with the connection
* @link http://php.net/manual/en/function.pg-host.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return string A string containing the name of the host the
* <i>connection</i> is to, or <b>FALSE</b> on error.
*/
function pg_host($connection = null): string {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Get the database name
* @link http://php.net/manual/en/function.pg-dbname.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return string A string containing the name of the database the
* <i>connection</i> is to, or <b>FALSE</b> on error.
*/
function pg_dbname($connection = null): string {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Return the port number associated with the connection
* @link http://php.net/manual/en/function.pg-port.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return int An int containing the port number of the database
* server the <i>connection</i> is to,
* or <b>FALSE</b> on error.
*/
function pg_port($connection = null): int {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Return the TTY name associated with the connection
* @link http://php.net/manual/en/function.pg-tty.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return string A string containing the debug TTY of
* the <i>connection</i>, or <b>FALSE</b> on error.
*/
function pg_tty($connection = null): string {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Get the options associated with the connection
* @link http://php.net/manual/en/function.pg-options.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return string A string containing the <i>connection</i>
* options, or <b>FALSE</b> on error.
*/
function pg_options($connection = null): string {}
/**
* (PHP 5, PHP 7)<br/>
* Returns an array with client, protocol and server version (when available)
* @link http://php.net/manual/en/function.pg-version.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return array an array with client, protocol
* and server keys and values (if available). Returns
* <b>FALSE</b> on error or invalid connection.
*/
function pg_version($connection = null): array {}
/**
* (PHP 4 >= 4.3.0, PHP 5, PHP 7)<br/>
* Ping database connection
* @link http://php.net/manual/en/function.pg-ping.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_ping($connection = null): bool {}
/**
* (PHP 5, PHP 7)<br/>
* Looks up a current parameter setting of the server.
* @link http://php.net/manual/en/function.pg-parameter-status.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $param_name <p>
* Possible <i>param_name</i> values include server_version,
* server_encoding, client_encoding,
* is_superuser, session_authorization,
* DateStyle, TimeZone, and
* integer_datetimes.
* </p>
* @return string A string containing the value of the parameter, <b>FALSE</b> on failure or invalid
* <i>param_name</i>.
*/
function pg_parameter_status($connection = null, string $param_name): string {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Returns the current in-transaction status of the server.
* @link http://php.net/manual/en/function.pg-transaction-status.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return int The status can be <b>PGSQL_TRANSACTION_IDLE</b> (currently idle),
* <b>PGSQL_TRANSACTION_ACTIVE</b> (a command is in progress),
* <b>PGSQL_TRANSACTION_INTRANS</b> (idle, in a valid transaction block),
* or <b>PGSQL_TRANSACTION_INERROR</b> (idle, in a failed transaction block).
* <b>PGSQL_TRANSACTION_UNKNOWN</b> is reported if the connection is bad.
* <b>PGSQL_TRANSACTION_ACTIVE</b> is reported only when a query
* has been sent to the server and not yet completed.
*/
function pg_transaction_status($connection): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Execute a query
* @link http://php.net/manual/en/function.pg-query.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $query <p>
* The SQL statement or statements to be executed. When multiple statements are passed to the function,
* they are automatically executed as one transaction, unless there are explicit BEGIN/COMMIT commands
* included in the query string. However, using multiple transactions in one function call is not recommended.
* </p>
* <p>
* String interpolation of user-supplied data is extremely dangerous and is
* likely to lead to SQL
* injection vulnerabilities. In most cases
* <b>pg_query_params</b> should be preferred, passing
* user-supplied values as parameters rather than substituting them into
* the query string.
* </p>
* <p>
* Any user-supplied data substituted directly into a query string should
* be properly escaped.
* </p>
* @return resource A query result resource on success or <b>FALSE</b> on failure.
*/
function pg_query($connection = null, string $query) {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.
* @link http://php.net/manual/en/function.pg-query-params.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $query <p>
* The parameterized SQL statement. Must contain only a single statement.
* (multiple statements separated by semi-colons are not allowed.) If any parameters
* are used, they are referred to as $1, $2, etc.
* </p>
* <p>
* User-supplied values should always be passed as parameters, not
* interpolated into the query string, where they form possible
* SQL injection
* attack vectors and introduce bugs when handling data containing quotes.
* If for some reason you cannot use a parameter, ensure that interpolated
* values are properly escaped.
* </p>
* @param array $params <p>
* An array of parameter values to substitute for the $1, $2, etc. placeholders
* in the original prepared query string. The number of elements in the array
* must match the number of placeholders.
* </p>
* <p>
* Values intended for bytea fields are not supported as
* parameters. Use <b>pg_escape_bytea</b> instead, or use the
* large object functions.
* </p>
* @return resource A query result resource on success or <b>FALSE</b> on failure.
*/
function pg_query_params($connection = null, string $query, array $params) {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Submits a request to create a prepared statement with the
given parameters, and waits for completion.
* @link http://php.net/manual/en/function.pg-prepare.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $stmtname <p>
* The name to give the prepared statement. Must be unique per-connection. If
* "" is specified, then an unnamed statement is created, overwriting any
* previously defined unnamed statement.
* </p>
* @param string $query <p>
* The parameterized SQL statement. Must contain only a single statement.
* (multiple statements separated by semi-colons are not allowed.) If any parameters
* are used, they are referred to as $1, $2, etc.
* </p>
* @return resource A query result resource on success or <b>FALSE</b> on failure.
*/
function pg_prepare($connection = null, string $stmtname, string $query) {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Sends a request to execute a prepared statement with given parameters, and waits for the result.
* @link http://php.net/manual/en/function.pg-execute.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $stmtname <p>
* The name of the prepared statement to execute. if
* "" is specified, then the unnamed statement is executed. The name must have
* been previously prepared using <b>pg_prepare</b>,
* <b>pg_send_prepare</b> or a PREPARE SQL
* command.
* </p>
* @param array $params <p>
* An array of parameter values to substitute for the $1, $2, etc. placeholders
* in the original prepared query string. The number of elements in the array
* must match the number of placeholders.
* </p>
* <p>
* Elements are converted to strings by calling this function.
* </p>
* @return resource A query result resource on success or <b>FALSE</b> on failure.
*/
function pg_execute($connection = null, string $stmtname, array $params) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Sends asynchronous query
* @link http://php.net/manual/en/function.pg-send-query.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @param string $query <p>
* The SQL statement or statements to be executed.
* </p>
* <p>
* Data inside the query should be properly escaped.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.</p>
* <p>
* Use <b>pg_get_result</b> to determine the query result.
*/
function pg_send_query($connection, string $query): bool {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Submits a command and separate parameters to the server without waiting for the result(s).
* @link http://php.net/manual/en/function.pg-send-query-params.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @param string $query <p>
* The parameterized SQL statement. Must contain only a single statement.
* (multiple statements separated by semi-colons are not allowed.) If any parameters
* are used, they are referred to as $1, $2, etc.
* </p>
* @param array $params <p>
* An array of parameter values to substitute for the $1, $2, etc. placeholders
* in the original prepared query string. The number of elements in the array
* must match the number of placeholders.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.</p>
* <p>
* Use <b>pg_get_result</b> to determine the query result.
*/
function pg_send_query_params($connection, string $query, array $params): bool {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Sends a request to create a prepared statement with the given parameters, without waiting for completion.
* @link http://php.net/manual/en/function.pg-send-prepare.php
* @param resource $connection <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $stmtname <p>
* The name to give the prepared statement. Must be unique per-connection. If
* "" is specified, then an unnamed statement is created, overwriting any
* previously defined unnamed statement.
* </p>
* @param string $query <p>
* The parameterized SQL statement. Must contain only a single statement.
* (multiple statements separated by semi-colons are not allowed.) If any parameters
* are used, they are referred to as $1, $2, etc.
* </p>
* @return bool <b>TRUE</b> on success, <b>FALSE</b> on failure. Use <b>pg_get_result</b>
* to determine the query result.
*/
function pg_send_prepare($connection, string $stmtname, string $query): bool {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Sends a request to execute a prepared statement with given parameters, without waiting for the result(s).
* @link http://php.net/manual/en/function.pg-send-execute.php
* @param resource $connection <p>
* PostgreSQL database connection resource. When
* <i>connection</i> is not present, the default connection
* is used. The default connection is the last connection made by
* <b>pg_connect</b> or <b>pg_pconnect</b>.
* </p>
* @param string $stmtname <p>
* The name of the prepared statement to execute. if
* "" is specified, then the unnamed statement is executed. The name must have
* been previously prepared using <b>pg_prepare</b>,
* <b>pg_send_prepare</b> or a PREPARE SQL
* command.
* </p>
* @param array $params <p>
* An array of parameter values to substitute for the $1, $2, etc. placeholders
* in the original prepared query string. The number of elements in the array
* must match the number of placeholders.
* </p>
* @return bool <b>TRUE</b> on success, <b>FALSE</b> on failure. Use <b>pg_get_result</b>
* to determine the query result.
*/
function pg_send_execute($connection, string $stmtname, array $params): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Cancel an asynchronous query
* @link http://php.net/manual/en/function.pg-cancel-query.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_cancel_query($connection): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns values from a result resource
* @link http://php.net/manual/en/function.pg-fetch-result.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
* next row is fetched.
* </p>
* @param mixed $field <p>
* A string representing the name of the field (column) to fetch, otherwise
* an int representing the field number to fetch. Fields are
* numbered from 0 upwards.
* </p>
* @return string Boolean is returned as "t" or "f". All
* other types, including arrays are returned as strings formatted
* in the same default PostgreSQL manner that you would see in the
* psql program. Database NULL
* values are returned as <b>NULL</b>.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>row</i> exceeds the number
* of rows in the set, or on any other error.
*/
function pg_fetch_result($result, int $row, $field): string {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Get a row as an enumerated array
* @link http://php.net/manual/en/function.pg-fetch-row.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row [optional] <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If
* omitted or <b>NULL</b>, the next row is fetched.
* </p>
* @param int $result_type [optional]
* @return array An array, indexed from 0 upwards, with each value
* represented as a string. Database NULL
* values are returned as <b>NULL</b>.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>row</i> exceeds the number
* of rows in the set, there are no more rows, or on any other error.
*/
function pg_fetch_row($result, int $row = null, int $result_type = null): array {}
/**
* (PHP 4 >= 4.3.0, PHP 5, PHP 7)<br/>
* Fetch a row as an associative array
* @link http://php.net/manual/en/function.pg-fetch-assoc.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row [optional] <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If
* omitted or <b>NULL</b>, the next row is fetched.
* </p>
* @return array An array indexed associatively (by field name).
* Each value in the array is represented as a
* string. Database NULL
* values are returned as <b>NULL</b>.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>row</i> exceeds the number
* of rows in the set, there are no more rows, or on any other error.
*/
function pg_fetch_assoc($result, int $row = null): array {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Fetch a row as an array
* @link http://php.net/manual/en/function.pg-fetch-array.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row [optional] <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If
* omitted or <b>NULL</b>, the next row is fetched.
* </p>
* @param int $result_type [optional] <p>
* An optional parameter that controls
* how the returned array is indexed.
* <i>result_type</i> is a constant and can take the
* following values: <b>PGSQL_ASSOC</b>,
* <b>PGSQL_NUM</b> and <b>PGSQL_BOTH</b>.
* Using <b>PGSQL_NUM</b>, <b>pg_fetch_array</b>
* will return an array with numerical indices, using
* <b>PGSQL_ASSOC</b> it will return only associative indices
* while <b>PGSQL_BOTH</b>, the default, will return both
* numerical and associative indices.
* </p>
* @return array An array indexed numerically (beginning with 0) or
* associatively (indexed by field name), or both.
* Each value in the array is represented as a
* string. Database NULL
* values are returned as <b>NULL</b>.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>row</i> exceeds the number
* of rows in the set, there are no more rows, or on any other error.
*/
function pg_fetch_array($result, int $row = null, int $result_type = PGSQL_BOTH): array {}
/**
* (PHP 4, PHP 5, PHP 7)<br/>
* Fetch a row as an object
* @link http://php.net/manual/en/function.pg-fetch-object.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row [optional] <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If
* omitted or <b>NULL</b>, the next row is fetched.
* </p>
* @param int $result_type [optional] <p>
* Ignored and deprecated.
* </p>
* @return object An object with one attribute for each field
* name in the result. Database NULL
* values are returned as <b>NULL</b>.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>row</i> exceeds the number
* of rows in the set, there are no more rows, or on any other error.
*/
function pg_fetch_object($result, int $row = null, int $result_type = PGSQL_ASSOC) {}
/**
* (PHP 4 >= 4.3.0, PHP 5, PHP 7)<br/>
* Fetches all rows from a result as an array
* @link http://php.net/manual/en/function.pg-fetch-all.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return array An array with all rows in the result. Each row is an array
* of field values indexed by field name.
* </p>
* <p>
* <b>FALSE</b> is returned if there are no rows in the result, or on any
* other error.
*/
function pg_fetch_all($result): array {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Fetches all rows in a particular result column as an array
* @link http://php.net/manual/en/function.pg-fetch-all-columns.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $column [optional] <p>
* Column number, zero-based, to be retrieved from the result resource. Defaults
* to the first column if not specified.
* </p>
* @return array An array with all values in the result column.
* </p>
* <p>
* <b>FALSE</b> is returned if <i>column</i> is larger than the number
* of columns in the result, or on any other error.
*/
function pg_fetch_all_columns($result, int $column = 0): array {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns number of affected records (tuples)
* @link http://php.net/manual/en/function.pg-affected-rows.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return int The number of rows affected by the query. If no tuple is
* affected, it will return 0.
*/
function pg_affected_rows($result): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Get asynchronous query result
* @link http://php.net/manual/en/function.pg-get-result.php
* @param resource $connection [optional] <p>
* PostgreSQL database connection resource.
* </p>
* @return resource The result resource, or <b>FALSE</b> if no more results are available.
*/
function pg_get_result($connection = null) {}
/**
* (PHP 4 >= 4.3.0, PHP 5, PHP 7)<br/>
* Set internal row offset in result resource
* @link http://php.net/manual/en/function.pg-result-seek.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $offset <p>
* Row to move the internal offset to in the <i>result</i> resource.
* Rows are numbered starting from zero.
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_result_seek($result, int $offset): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Get status of query result
* @link http://php.net/manual/en/function.pg-result-status.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $type [optional] <p>
* Either <b>PGSQL_STATUS_LONG</b> to return the numeric status
* of the <i>result</i>, or <b>PGSQL_STATUS_STRING</b>
* to return the command tag of the <i>result</i>.
* If not specified, <b>PGSQL_STATUS_LONG</b> is the default.
* </p>
* @return mixed Possible return values are <b>PGSQL_EMPTY_QUERY</b>,
* <b>PGSQL_COMMAND_OK</b>, <b>PGSQL_TUPLES_OK</b>, <b>PGSQL_COPY_OUT</b>,
* <b>PGSQL_COPY_IN</b>, <b>PGSQL_BAD_RESPONSE</b>, <b>PGSQL_NONFATAL_ERROR</b> and
* <b>PGSQL_FATAL_ERROR</b> if <b>PGSQL_STATUS_LONG</b> is
* specified. Otherwise, a string containing the PostgreSQL command tag is returned.
*/
function pg_result_status($result, int $type = PGSQL_STATUS_LONG) {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Free result memory
* @link http://php.net/manual/en/function.pg-free-result.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return bool <b>TRUE</b> on success or <b>FALSE</b> on failure.
*/
function pg_free_result($result): bool {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the last row's OID
* @link http://php.net/manual/en/function.pg-last-oid.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return string A string containing the OID assigned to the most recently inserted
* row in the specified <i>connection</i>, or <b>FALSE</b> on error or
* no available OID.
*/
function pg_last_oid($result): string {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the number of rows in a result
* @link http://php.net/manual/en/function.pg-num-rows.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return int The number of rows in the result. On error, -1 is returned.
*/
function pg_num_rows($result): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the number of fields in a result
* @link http://php.net/manual/en/function.pg-num-fields.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @return int The number of fields (columns) in the result. On error, -1 is returned.
*/
function pg_num_fields($result): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the name of a field
* @link http://php.net/manual/en/function.pg-field-name.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $field_number <p>
* Field number, starting from 0.
* </p>
* @return string The field name, or <b>FALSE</b> on error.
*/
function pg_field_name($result, int $field_number): string {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the field number of the named field
* @link http://php.net/manual/en/function.pg-field-num.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param string $field_name <p>
* The name of the field.
* </p>
* @return int The field number (numbered from 0), or -1 on error.
*/
function pg_field_num($result, string $field_name): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the internal storage size of the named field
* @link http://php.net/manual/en/function.pg-field-size.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $field_number <p>
* Field number, starting from 0.
* </p>
* @return int The internal field storage size (in bytes). -1 indicates a variable
* length field. <b>FALSE</b> is returned on error.
*/
function pg_field_size($result, int $field_number): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the type name for the corresponding field number
* @link http://php.net/manual/en/function.pg-field-type.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $field_number <p>
* Field number, starting from 0.
* </p>
* @return string A string containing the base name of the field's type, or <b>FALSE</b>
* on error.
*/
function pg_field_type($result, int $field_number): string {}
/**
* (PHP 5 >= 5.1.0, PHP 7)<br/>
* Returns the type ID (OID) for the corresponding field number
* @link http://php.net/manual/en/function.pg-field-type-oid.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $field_number <p>
* Field number, starting from 0.
* </p>
* @return int The OID of the field's base type. <b>FALSE</b> is returned on error.
*/
function pg_field_type_oid($result, int $field_number): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Returns the printed length
* @link http://php.net/manual/en/function.pg-field-prtlen.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row_number
* @param mixed $field_name_or_number
* @return int The field printed length, or <b>FALSE</b> on error.
*/
function pg_field_prtlen($result, int $row_number, $field_name_or_number): int {}
/**
* (PHP 4 >= 4.2.0, PHP 5, PHP 7)<br/>
* Test if a field is SQL NULL
* @link http://php.net/manual/en/function.pg-field-is-null.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $row <p>
* Row number in result to fetch. Rows are numbered from 0 upwards. If omitted,
* current row is fetched.
* </p>
* @param mixed $field <p>
* Field number (starting from 0) as an integer or
* the field name as a string.
* </p>
* @return int 1 if the field in the given row is SQL NULL, 0
* if not. <b>FALSE</b> is returned if the row is out of range, or upon any other error.
*/
function pg_field_is_null($result, int $row, $field): int {}
/**
* (PHP 5 >= 5.2.0, PHP 7)<br/>
* Returns the name or oid of the tables field
* @link http://php.net/manual/en/function.pg-field-table.php
* @param resource $result <p>
* PostgreSQL query result resource, returned by <b>pg_query</b>,
* <b>pg_query_params</b> or <b>pg_execute</b>
* (among others).
* </p>
* @param int $field_number <p>
* Field number, starting from 0.
* </p>
* @param bool $oid_only [optional] <p>
* By default the tables name that field belongs to is returned but
* if <i>oid_only</i> is set to <b>TRUE</b>, then the
* oid will instead be returned.
* </p>
* @return mixed On success either the fields table name or oid. Or, <b>FALSE</b> on failure.
*/
function pg_field_table($result, int $field_number, bool $oid_only = false) {}
/**
* (PHP 4 >= 4.3.0, PHP 5, PHP 7)<br/>
* Gets SQL NOTIFY message
* @link http://php.net/manual/en/function.pg-get-notify.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @param int $result_type [optional] <p>
* An optional parameter that controls
* how the returned array is indexed.
* <i>result_type</i> is a constant and can take the
* following values: <b>PGSQL_ASSOC</b>,
* <b>PGSQL_NUM</b> and <b>PGSQL_BOTH</b>.
* Using <b>PGSQL_NUM</b>, <b>pg_get_notify</b>
* will return an array with numerical indices, using
* <b>PGSQL_ASSOC</b> it will return only associative indices
* while <b>PGSQL_BOTH</b>, the default, will return both
* numerical and associative indices.
* </p>
* @return array An array containing the NOTIFY message name and backend PID.
* Otherwise if no NOTIFY is waiting, then <b>FALSE</b> is returned.
*/
function pg_get_notify($connection, int $result_type = null): array {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Get a read only handle to the socket underlying a PostgreSQL connection
* @link http://php.net/manual/en/function.pg-socket.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return resource A socket resource on success or <b>FALSE</b> on failure.
*/
function pg_socket($connection) {}
/**
* (PHP 5 >= 5.6.0, PHP 7)<br/>
* Reads input on the connection
* @link http://php.net/manual/en/function.pg-consume-input.php
* @param resource $connection <p>
* PostgreSQL database connection resource.
* </p>
* @return bool <b>TRUE</b> if no error occurred, or <b>FALSE</b> if there was an error. Note that
* <b>TRUE</b> does not necessarily indicate that input was waiting to be read.
*/
function pg_consume_input($connection): bool {}