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 721721 'pg_field_table ' ,
722722 'pg_flush ' ,
723723 'pg_free_result ' ,
724+ 'pg_host ' ,
724725 'pg_insert ' ,
725726 'pg_last_oid ' ,
726727 'pg_lo_close ' ,
Original file line number Diff line number Diff line change @@ -384,6 +384,35 @@ function pg_free_result($result): void
384384}
385385
386386
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+
387416/**
388417 * pg_insert inserts the values
389418 * of values into the table specified
Original file line number Diff line number Diff line change 731731 'pg_field_table ' => 'Safe\pg_field_table ' ,
732732 'pg_flush ' => 'Safe\pg_flush ' ,
733733 'pg_free_result ' => 'Safe\pg_free_result ' ,
734+ 'pg_host ' => 'Safe\pg_host ' ,
734735 'pg_insert ' => 'Safe\pg_insert ' ,
735736 'pg_last_oid ' => 'Safe\pg_last_oid ' ,
736737 'pg_lo_close ' => 'Safe\pg_lo_close ' ,
You can’t perform that action at this time.
0 commit comments