-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/pgsql: adding pg_service() alongside other connection infos. #18198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -907,6 +907,7 @@ PHP_FUNCTION(pg_close) | |
#define PHP_PG_HOST 6 | ||
#define PHP_PG_VERSION 7 | ||
#define PHP_PG_JIT 8 | ||
#define PHP_PG_SERVICE 9 | ||
|
||
/* php_pgsql_get_link_info */ | ||
static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) | ||
|
@@ -991,6 +992,12 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type | |
PQclear(res); | ||
return; | ||
} | ||
#if defined(HAVE_PG_SERVICE) | ||
case PHP_PG_SERVICE: { | ||
result = PQservice(pgsql); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this return NULL? If it does, then it will return the interned empty string, in which case the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless there's an exception for interned strings, but I don't believe so? I could be wrong There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it can return NULL. |
||
break; | ||
} | ||
#endif | ||
EMPTY_SWITCH_DEFAULT_CASE() | ||
} | ||
if (result) { | ||
|
@@ -1047,6 +1054,13 @@ PHP_FUNCTION(pg_jit) | |
php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_JIT); | ||
} | ||
|
||
#if defined(HAVE_PG_SERVICE) | ||
PHP_FUNCTION(pg_service) | ||
{ | ||
php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_SERVICE); | ||
} | ||
#endif | ||
|
||
/* Returns the value of a server parameter */ | ||
PHP_FUNCTION(pg_parameter_status) | ||
{ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
PostgreSQL connection service field support | ||
--EXTENSIONS-- | ||
pgsql | ||
--SKIPIF-- | ||
<?php | ||
include("inc/skipif.inc"); | ||
if (!function_exists("pg_service")) die("skip pg_service unsupported"); | ||
?> | ||
--FILE-- | ||
<?php | ||
include('inc/config.inc'); | ||
|
||
$db = pg_connect($conn_str); | ||
var_dump(pg_service($db)); | ||
pg_close($db); | ||
?> | ||
--EXPECTF-- | ||
string(%d) "%A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you add this by hand, or did you forget to update the optimizer infos after updating the annotation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added after the first round of stub update forgot to rerun again ... should disappear