-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/pgsql: adding postgresql 17 new libpq wrapper call. #14571
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
Conversation
9181959
to
ccb8fb8
Compare
--SKIPIF-- | ||
<?php | ||
include("inc/skipif.inc"); | ||
if (!function_exists("pg_set_chunked_rows_mode")) die("pg_set_chunked_rows_mode unsupported"); |
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.
The tests it borked otherwise due to an invalid SKIPIF section
if (!function_exists("pg_set_chunked_rows_mode")) die("pg_set_chunked_rows_mode unsupported"); | |
if (!function_exists("pg_set_chunked_rows_mode")) die("skip pg_set_chunked_rows_mode unsupported"); |
ext/pgsql/pgsql.c
Outdated
/** can still fail if it is not allowed e.g. already fetched results **/ | ||
|
||
RETURN_LONG((zend_long)PQsetChunkedRowsMode(link->conn, (int)size)); |
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.
What value is returned on failure? 0
?
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.
yes. it might be more appropriate to return a bool then.
ccb8fb8
to
c4e9aed
Compare
ext/pgsql/pgsql.c
Outdated
@@ -6248,3 +6246,29 @@ PHP_FUNCTION(pg_socket_poll) | |||
|
|||
RETURN_LONG((zend_long)PQsocketPoll(socket, (int)read, (int)write, (int)ts)); | |||
} | |||
|
|||
#if defined(HAVE_PG_SET_CHUNKED_ROWS_MODE) | |||
PHP_FUNCTION(pg_set_chunked_rows_mode) |
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.
The name of the function confuses me, is this setting a "mode" or the number of rows to chunk?
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.
"mode" refers to chunk mode vs single row mode (which is another libpq call, thus the exposition of PGSQL_TUPLES_CHUNK constant to differentiate it) but yes it set the number of rows.
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.
Does it possibly make sense to name the function we expose to userland in a slightly more sensible way? I think just replacing mode
with size
would possibly do.
And thus it mean, it can only fail if trying to set up a chunk size for results that cannot be chunked?
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.
can do indeed.
pg_set_chunked_rows_mode to allow to fetch results in chunk of max N rows.
c4e9aed
to
99f8c2f
Compare
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.
Looks better to me :) Don't forget to add an UPGRADING entry
pg_set_chunked_rows_mode to allow to fetch results in chunk of max N rows.