File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 721
721
'pg_field_table ' ,
722
722
'pg_flush ' ,
723
723
'pg_free_result ' ,
724
+ 'pg_host ' ,
724
725
'pg_insert ' ,
725
726
'pg_last_oid ' ,
726
727
'pg_lo_close ' ,
Original file line number Diff line number Diff line change @@ -384,6 +384,35 @@ function pg_free_result($result): void
384
384
}
385
385
386
386
387
+ /**
388
+ * pg_host returns the host name of the given
389
+ * PostgreSQL connection instance is
390
+ * connected to.
391
+ *
392
+ * @param resource $connection An PgSql\Connection instance.
393
+ * When connection is NULL, the default connection is used.
394
+ * The default connection is the last connection made by pg_connect
395
+ * or pg_pconnect.
396
+ * @return string A string containing the name of the host the
397
+ * connection is to.
398
+ * @throws PgsqlException
399
+ *
400
+ */
401
+ function pg_host ($ connection = null ): string
402
+ {
403
+ error_clear_last ();
404
+ if ($ connection !== null ) {
405
+ $ result = \pg_host ($ connection );
406
+ } else {
407
+ $ result = \pg_host ();
408
+ }
409
+ if ($ result === '' ) {
410
+ throw PgsqlException::createFromPhpError ();
411
+ }
412
+ return $ result ;
413
+ }
414
+
415
+
387
416
/**
388
417
* pg_insert inserts the values
389
418
* of values into the table specified
Original file line number Diff line number Diff line change 731
731
'pg_field_table ' => 'Safe\pg_field_table ' ,
732
732
'pg_flush ' => 'Safe\pg_flush ' ,
733
733
'pg_free_result ' => 'Safe\pg_free_result ' ,
734
+ 'pg_host ' => 'Safe\pg_host ' ,
734
735
'pg_insert ' => 'Safe\pg_insert ' ,
735
736
'pg_last_oid ' => 'Safe\pg_last_oid ' ,
736
737
'pg_lo_close ' => 'Safe\pg_lo_close ' ,
You can’t perform that action at this time.
0 commit comments