|
40 | 40 | #include "php_globals.h" |
41 | 41 | #include "zend_exceptions.h" |
42 | 42 | #include "zend_attributes.h" |
43 | | -#if !defined(HAVE_PG_SOCKET_POLL) |
44 | 43 | #include "php_network.h" |
45 | | -#endif |
46 | 44 |
|
47 | 45 | #ifdef HAVE_PGSQL |
48 | 46 |
|
@@ -935,16 +933,16 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type |
935 | 933 | array_init(return_value); |
936 | 934 | res = PQexec(pgsql, "SHOW jit_provider"); |
937 | 935 | if (PQresultStatus(res) != PGRES_TUPLES_OK) { |
938 | | - add_assoc_null(return_value, "jit_provider"); |
| 936 | + add_assoc_null(return_value, "jit_provider"); |
939 | 937 | } else { |
940 | | - add_assoc_string(return_value, "jit_provider", PQgetvalue(res, 0, 0)); |
| 938 | + add_assoc_string(return_value, "jit_provider", PQgetvalue(res, 0, 0)); |
941 | 939 | } |
942 | 940 | PQclear(res); |
943 | 941 | res = PQexec(pgsql, "SHOW jit"); |
944 | 942 | if (PQresultStatus(res) != PGRES_TUPLES_OK) { |
945 | | - add_assoc_null(return_value, "jit"); |
| 943 | + add_assoc_null(return_value, "jit"); |
946 | 944 | } else { |
947 | | - add_assoc_string(return_value, "jit", PQgetvalue(res, 0, 0)); |
| 945 | + add_assoc_string(return_value, "jit", PQgetvalue(res, 0, 0)); |
948 | 946 | } |
949 | 947 | PQclear(res); |
950 | 948 | return; |
@@ -4346,7 +4344,7 @@ static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{ |
4346 | 4344 | } |
4347 | 4345 |
|
4348 | 4346 | if (ret) { |
4349 | | - *(php_socket_t *)ret = fd_number; |
| 4347 | + *(php_socket_t *)ret = fd_number; |
4350 | 4348 | } |
4351 | 4349 | } |
4352 | 4350 | return SUCCESS; |
@@ -6248,3 +6246,29 @@ PHP_FUNCTION(pg_socket_poll) |
6248 | 6246 |
|
6249 | 6247 | RETURN_LONG((zend_long)PQsocketPoll(socket, (int)read, (int)write, (int)ts)); |
6250 | 6248 | } |
| 6249 | + |
| 6250 | +#if defined(HAVE_PG_SET_CHUNKED_ROWS_SIZE) |
| 6251 | +PHP_FUNCTION(pg_set_chunked_rows_size) |
| 6252 | +{ |
| 6253 | + zval *pgsql_link; |
| 6254 | + pgsql_link_handle *link; |
| 6255 | + zend_long size; |
| 6256 | + |
| 6257 | + ZEND_PARSE_PARAMETERS_START(2, 2) |
| 6258 | + Z_PARAM_OBJECT_OF_CLASS(pgsql_link, pgsql_link_ce) |
| 6259 | + Z_PARAM_LONG(size) |
| 6260 | + ZEND_PARSE_PARAMETERS_END(); |
| 6261 | + |
| 6262 | + if (size < 1 || size > INT_MAX) { |
| 6263 | + zend_argument_value_error(2, "must be between 1 and %d", INT_MAX); |
| 6264 | + RETURN_THROWS(); |
| 6265 | + } |
| 6266 | + |
| 6267 | + link = Z_PGSQL_LINK_P(pgsql_link); |
| 6268 | + CHECK_PGSQL_LINK(link); |
| 6269 | + |
| 6270 | + /** can still fail if it is not allowed e.g. already fetched results **/ |
| 6271 | + |
| 6272 | + RETURN_BOOL(PQsetChunkedRowsMode(link->conn, (int)size) == 1); |
| 6273 | +} |
| 6274 | +#endif |
0 commit comments