mirror of
https://github.com/php/php-src.git
synced 2024-11-27 03:44:07 +08:00
Revert incomplete PG pipeline addition
Closes GH-12735
This commit is contained in:
parent
ff2b50889c
commit
1e66e6ae73
3
NEWS
3
NEWS
@ -28,6 +28,9 @@ PHP NEWS
|
||||
- PCRE:
|
||||
. Fixed bug GH-12628 (The gh11374 test fails on Alpinelinux). (nielsdos)
|
||||
|
||||
- PGSQL:
|
||||
. Reverted PG pipeline addition. (Jakub Zelenka)
|
||||
|
||||
- PHPDBG:
|
||||
. Fixed bug GH-12675 (MEMORY_LEAK in phpdbg_prompt.c). (nielsdos)
|
||||
|
||||
|
@ -435,11 +435,6 @@ PHP 8.3 UPGRADE NOTES
|
||||
- PGSQL:
|
||||
. Added pg_set_error_context_visibility to set the visibility of the context
|
||||
in error messages (with libpq >= 9.6).
|
||||
. Added pg_enter_pipeline_mode().
|
||||
. Added pg_exit_pipeline_mode().
|
||||
. Added pg_send_flush_request().
|
||||
. Added pg_pipeline_sync().
|
||||
. Added pg_pipeline_status().
|
||||
|
||||
- Random:
|
||||
. Added Randomizer::getBytesFromString().
|
||||
@ -537,10 +532,6 @@ PHP 8.3 UPGRADE NOTES
|
||||
. PGSQL_TRACE_SUPPRESS_TIMESTAMPS
|
||||
. PGSQL_TRACE_REGRESS_MODE
|
||||
. PGSQL_ERRORS_SQLSTATE
|
||||
. PGSQL_PIPELINE_SYNC
|
||||
. PGSQL_PIPELINE_ON
|
||||
. PGSQL_PIPELINE_OFF
|
||||
. PGSQL_PIPELINE_ABORTED
|
||||
. PGSQL_SHOW_CONTEXT_NEVER
|
||||
. PGSQL_SHOW_CONTEXT_ERRORS
|
||||
. PGSQL_SHOW_CONTEXT_ALWAYS
|
||||
|
@ -3595,9 +3595,6 @@ PHP_FUNCTION(pg_send_query)
|
||||
char *query;
|
||||
size_t len;
|
||||
PGconn *pgsql;
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
bool is_pipeline_mode;
|
||||
#endif
|
||||
int is_non_blocking;
|
||||
int ret;
|
||||
|
||||
@ -3609,40 +3606,23 @@ PHP_FUNCTION(pg_send_query)
|
||||
CHECK_PGSQL_LINK(link);
|
||||
pgsql = link->conn;
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
is_pipeline_mode = (PQpipelineStatus(pgsql) == PQ_PIPELINE_ON);
|
||||
if (is_pipeline_mode) {
|
||||
is_non_blocking = 1;
|
||||
} else {
|
||||
#endif
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_non_blocking) {
|
||||
if (!PQsendQuery(pgsql, query)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_pipeline_mode) {
|
||||
ret = 0;
|
||||
} else {
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
}
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
} else {
|
||||
if (!PQsendQuery(pgsql, query)) {
|
||||
if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
|
||||
@ -3687,9 +3667,6 @@ PHP_FUNCTION(pg_send_query_params)
|
||||
char *query;
|
||||
size_t query_len;
|
||||
PGconn *pgsql;
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
bool is_pipeline_mode;
|
||||
#endif
|
||||
int is_non_blocking;
|
||||
int ret;
|
||||
|
||||
@ -3701,26 +3678,17 @@ PHP_FUNCTION(pg_send_query_params)
|
||||
CHECK_PGSQL_LINK(link);
|
||||
pgsql = link->conn;
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
is_pipeline_mode = (PQpipelineStatus(pgsql) == PQ_PIPELINE_ON);
|
||||
if (is_pipeline_mode) {
|
||||
is_non_blocking = 1;
|
||||
} else {
|
||||
#endif
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#endif
|
||||
|
||||
num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr));
|
||||
if (num_params > 0) {
|
||||
@ -3759,15 +3727,7 @@ PHP_FUNCTION(pg_send_query_params)
|
||||
}
|
||||
|
||||
if (is_non_blocking) {
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_pipeline_mode) {
|
||||
ret = 0;
|
||||
} else {
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
}
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
} else {
|
||||
/* Wait to finish sending buffer */
|
||||
while ((ret = PQflush(pgsql))) {
|
||||
@ -3801,9 +3761,6 @@ PHP_FUNCTION(pg_send_prepare)
|
||||
char *query, *stmtname;
|
||||
size_t stmtname_len, query_len;
|
||||
PGconn *pgsql;
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
bool is_pipeline_mode;
|
||||
#endif
|
||||
int is_non_blocking;
|
||||
int ret;
|
||||
|
||||
@ -3815,26 +3772,17 @@ PHP_FUNCTION(pg_send_prepare)
|
||||
CHECK_PGSQL_LINK(link);
|
||||
pgsql = link->conn;
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
is_pipeline_mode = (PQpipelineStatus(pgsql) == PQ_PIPELINE_ON);
|
||||
if (is_pipeline_mode) {
|
||||
is_non_blocking = 1;
|
||||
} else {
|
||||
#endif
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!PQsendPrepare(pgsql, stmtname, query, 0, NULL)) {
|
||||
if (is_non_blocking) {
|
||||
@ -3850,15 +3798,7 @@ PHP_FUNCTION(pg_send_prepare)
|
||||
}
|
||||
|
||||
if (is_non_blocking) {
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_pipeline_mode) {
|
||||
ret = 0;
|
||||
} else {
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
}
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
} else {
|
||||
/* Wait to finish sending buffer */
|
||||
while ((ret = PQflush(pgsql))) {
|
||||
@ -3894,9 +3834,6 @@ PHP_FUNCTION(pg_send_execute)
|
||||
char *stmtname;
|
||||
size_t stmtname_len;
|
||||
PGconn *pgsql;
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
bool is_pipeline_mode;
|
||||
#endif
|
||||
int is_non_blocking;
|
||||
int ret;
|
||||
|
||||
@ -3908,26 +3845,17 @@ PHP_FUNCTION(pg_send_execute)
|
||||
CHECK_PGSQL_LINK(link);
|
||||
pgsql = link->conn;
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
is_pipeline_mode = (PQpipelineStatus(pgsql) == PQ_PIPELINE_ON);
|
||||
if (is_pipeline_mode) {
|
||||
is_non_blocking = 1;
|
||||
} else {
|
||||
#endif
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
is_non_blocking = PQisnonblocking(pgsql);
|
||||
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_non_blocking == 0 && PQsetnonblocking(pgsql, 1) == -1) {
|
||||
php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (_php_pgsql_link_has_results(pgsql)) {
|
||||
php_error_docref(NULL, E_NOTICE,
|
||||
"There are results on this connection. Call pg_get_result() until it returns FALSE");
|
||||
}
|
||||
#endif
|
||||
|
||||
num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr));
|
||||
if (num_params > 0) {
|
||||
@ -3968,15 +3896,7 @@ PHP_FUNCTION(pg_send_execute)
|
||||
}
|
||||
|
||||
if (is_non_blocking) {
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
if (is_pipeline_mode) {
|
||||
ret = 0;
|
||||
} else {
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
}
|
||||
#endif
|
||||
ret = PQflush(pgsql);
|
||||
} else {
|
||||
/* Wait to finish sending buffer */
|
||||
while ((ret = PQflush(pgsql))) {
|
||||
@ -5958,85 +5878,4 @@ PHP_FUNCTION(pg_select)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
PHP_FUNCTION(pg_enter_pipeline_mode)
|
||||
{
|
||||
zval *pgsql_link;
|
||||
pgsql_link_handle *pgsql_handle;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pgsql_link, pgsql_link_ce) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
pgsql_handle = Z_PGSQL_LINK_P(pgsql_link);
|
||||
CHECK_PGSQL_LINK(pgsql_handle);
|
||||
|
||||
PQsetnonblocking(pgsql_handle->conn, 1);
|
||||
|
||||
RETURN_BOOL(PQenterPipelineMode(pgsql_handle->conn));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(pg_exit_pipeline_mode)
|
||||
{
|
||||
zval *pgsql_link;
|
||||
pgsql_link_handle *pgsql_handle;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pgsql_link, pgsql_link_ce) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
pgsql_handle = Z_PGSQL_LINK_P(pgsql_link);
|
||||
CHECK_PGSQL_LINK(pgsql_handle);
|
||||
|
||||
PQsetnonblocking(pgsql_handle->conn, 0);
|
||||
|
||||
RETURN_BOOL(PQexitPipelineMode(pgsql_handle->conn));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(pg_send_flush_request)
|
||||
{
|
||||
zval *pgsql_link;
|
||||
pgsql_link_handle *pgsql_handle;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pgsql_link, pgsql_link_ce) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
pgsql_handle = Z_PGSQL_LINK_P(pgsql_link);
|
||||
CHECK_PGSQL_LINK(pgsql_handle);
|
||||
|
||||
RETURN_BOOL(PQsendFlushRequest(pgsql_handle->conn));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(pg_pipeline_sync)
|
||||
{
|
||||
zval *pgsql_link;
|
||||
pgsql_link_handle *pgsql_handle;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pgsql_link, pgsql_link_ce) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
pgsql_handle = Z_PGSQL_LINK_P(pgsql_link);
|
||||
CHECK_PGSQL_LINK(pgsql_handle);
|
||||
|
||||
RETURN_BOOL(PQpipelineSync(pgsql_handle->conn));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(pg_pipeline_status)
|
||||
{
|
||||
zval *pgsql_link;
|
||||
pgsql_link_handle *pgsql_handle;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &pgsql_link, pgsql_link_ce) == FAILURE) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
pgsql_handle = Z_PGSQL_LINK_P(pgsql_link);
|
||||
CHECK_PGSQL_LINK(pgsql_handle);
|
||||
|
||||
RETURN_LONG(PQpipelineStatus(pgsql_handle->conn));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -440,29 +440,6 @@ namespace {
|
||||
const PGSQL_TRACE_REGRESS_MODE = UNKNOWN;
|
||||
#endif
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue PGRES_PIPELINE_SYNC
|
||||
*/
|
||||
const PGSQL_PIPELINE_SYNC = UNKNOWN;
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue PQ_PIPELINE_ON
|
||||
*/
|
||||
const PGSQL_PIPELINE_ON = UNKNOWN;
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue PQ_PIPELINE_OFF
|
||||
*/
|
||||
const PGSQL_PIPELINE_OFF = UNKNOWN;
|
||||
/**
|
||||
* @var int
|
||||
* @cvalue PQ_PIPELINE_ABORTED
|
||||
*/
|
||||
const PGSQL_PIPELINE_ABORTED = UNKNOWN;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PG_CONTEXT_VISIBILITY
|
||||
/* For pg_set_error_context_visibility() */
|
||||
|
||||
@ -963,14 +940,6 @@ namespace {
|
||||
*/
|
||||
function pg_select(PgSql\Connection $connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC, int $mode = PGSQL_ASSOC): array|string|false {}
|
||||
|
||||
#ifdef LIBPQ_HAS_PIPELINING
|
||||
function pg_enter_pipeline_mode(PgSql\Connection $connection): bool {}
|
||||
function pg_exit_pipeline_mode(PgSql\Connection $connection): bool {}
|
||||
function pg_send_flush_request(PgSql\Connection $connection): bool {}
|
||||
function pg_pipeline_sync(PgSql\Connection $connection): bool {}
|
||||
function pg_pipeline_status(PgSql\Connection $connection): int {}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PG_CONTEXT_VISIBILITY
|
||||
function pg_set_error_context_visibility(PgSql\Connection $connection, int $visibility): int {}
|
||||
#endif
|
||||
|
68
ext/pgsql/pgsql_arginfo.h
generated
68
ext/pgsql/pgsql_arginfo.h
generated
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 25badfac7b1d807202b80fd544e6db234fd726fd */
|
||||
* Stub hash: 7966ed8575d26d934f6b292f3b13b0b6a4bf0e1e */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE)
|
||||
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
|
||||
@ -452,30 +452,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_select, 0, 3, MAY_BE_ARRAY|MA
|
||||
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_ASSOC")
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_enter_pipeline_mode, 0, 1, _IS_BOOL, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
#define arginfo_pg_exit_pipeline_mode arginfo_pg_enter_pipeline_mode
|
||||
#endif
|
||||
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
#define arginfo_pg_send_flush_request arginfo_pg_enter_pipeline_mode
|
||||
#endif
|
||||
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
#define arginfo_pg_pipeline_sync arginfo_pg_enter_pipeline_mode
|
||||
#endif
|
||||
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_pipeline_status, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PG_CONTEXT_VISIBILITY)
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_set_error_context_visibility, 0, 2, IS_LONG, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
|
||||
@ -575,21 +551,6 @@ ZEND_FUNCTION(pg_insert);
|
||||
ZEND_FUNCTION(pg_update);
|
||||
ZEND_FUNCTION(pg_delete);
|
||||
ZEND_FUNCTION(pg_select);
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FUNCTION(pg_enter_pipeline_mode);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FUNCTION(pg_exit_pipeline_mode);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FUNCTION(pg_send_flush_request);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FUNCTION(pg_pipeline_sync);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FUNCTION(pg_pipeline_status);
|
||||
#endif
|
||||
#if defined(HAVE_PG_CONTEXT_VISIBILITY)
|
||||
ZEND_FUNCTION(pg_set_error_context_visibility);
|
||||
#endif
|
||||
@ -710,21 +671,6 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(pg_update, arginfo_pg_update)
|
||||
ZEND_FE(pg_delete, arginfo_pg_delete)
|
||||
ZEND_FE(pg_select, arginfo_pg_select)
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FE(pg_enter_pipeline_mode, arginfo_pg_enter_pipeline_mode)
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FE(pg_exit_pipeline_mode, arginfo_pg_exit_pipeline_mode)
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FE(pg_send_flush_request, arginfo_pg_send_flush_request)
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FE(pg_pipeline_sync, arginfo_pg_pipeline_sync)
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
ZEND_FE(pg_pipeline_status, arginfo_pg_pipeline_status)
|
||||
#endif
|
||||
#if defined(HAVE_PG_CONTEXT_VISIBILITY)
|
||||
ZEND_FE(pg_set_error_context_visibility, arginfo_pg_set_error_context_visibility)
|
||||
#endif
|
||||
@ -848,18 +794,6 @@ static void register_pgsql_symbols(int module_number)
|
||||
#if defined(PQTRACE_REGRESS_MODE)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_TRACE_REGRESS_MODE", PQTRACE_REGRESS_MODE, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_PIPELINE_SYNC", PGRES_PIPELINE_SYNC, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_PIPELINE_ON", PQ_PIPELINE_ON, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_PIPELINE_OFF", PQ_PIPELINE_OFF, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(LIBPQ_HAS_PIPELINING)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_PIPELINE_ABORTED", PQ_PIPELINE_ABORTED, CONST_PERSISTENT);
|
||||
#endif
|
||||
#if defined(HAVE_PG_CONTEXT_VISIBILITY)
|
||||
REGISTER_LONG_CONSTANT("PGSQL_SHOW_CONTEXT_NEVER", PQSHOW_CONTEXT_NEVER, CONST_PERSISTENT);
|
||||
#endif
|
||||
|
@ -1,130 +0,0 @@
|
||||
--TEST--
|
||||
PostgreSQL pipeline mode
|
||||
--EXTENSIONS--
|
||||
pgsql
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include("skipif.inc");
|
||||
if (!defined('PGSQL_PIPELINE_SYNC') || !function_exists('pg_send_query_params')) {
|
||||
die('skip pipeline mode not available');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include('config.inc');
|
||||
include('nonblocking.inc');
|
||||
|
||||
if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) {
|
||||
die("pg_connect() error");
|
||||
} elseif (pg_connection_status($db) === PGSQL_CONNECTION_BAD) {
|
||||
die("pg_connect() error");
|
||||
} elseif ($db_socket = pg_socket($db)) {
|
||||
stream_set_blocking($db_socket, FALSE);
|
||||
} else {
|
||||
die("pg_socket() error");
|
||||
}
|
||||
|
||||
while (true) {
|
||||
switch ($status = pg_connect_poll($db)) {
|
||||
case PGSQL_POLLING_READING:
|
||||
nb_is_readable($db_socket);
|
||||
break;
|
||||
case PGSQL_POLLING_WRITING:
|
||||
nb_is_writable($db_socket);
|
||||
break;
|
||||
case PGSQL_POLLING_FAILED:
|
||||
die("async connection failed");
|
||||
case PGSQL_POLLING_OK:
|
||||
break 2;
|
||||
default:
|
||||
die("unknown poll status");
|
||||
}
|
||||
}
|
||||
|
||||
if (!pg_enter_pipeline_mode($db)) {
|
||||
die('pg_enter_pipeline_mode{}');
|
||||
}
|
||||
|
||||
if (!pg_send_query_params($db, "select $1 as index, now() + ($1||' day')::interval as time", array(1))) {
|
||||
die('pg_send_query_params failed');
|
||||
}
|
||||
|
||||
if (!pg_flush($db)) {
|
||||
die('pg_flush failed');
|
||||
}
|
||||
|
||||
for ($i = 2; $i < 50; ++$i) {
|
||||
if (!pg_send_query_params($db, "select $1 as index, now() + ($1||' day')::interval as time", array($i))) {
|
||||
die('pg_send_query_params failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (!pg_send_flush_request($db)) {
|
||||
die('pg_send_flush_request failed');
|
||||
}
|
||||
|
||||
for ($i = 50; $i < 99; ++$i) {
|
||||
if (!pg_send_query_params($db, "select $1 as index, now() + ($1||' day')::interval as time", array($i))) {
|
||||
die('pg_send_query_params failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (!pg_pipeline_sync($db)) {
|
||||
die('pg_pipeline_sync failed');
|
||||
}
|
||||
|
||||
if (pg_pipeline_status($db) !== PGSQL_PIPELINE_ON) {
|
||||
die('pg_pipeline_status failed');
|
||||
}
|
||||
|
||||
if (!($stream = pg_socket($db))) {
|
||||
die('pg_socket');
|
||||
}
|
||||
|
||||
if (pg_connection_busy($db)) {
|
||||
$read = [$stream]; $write = $ex = [];
|
||||
while (!stream_select($read, $write, $ex, null, null)) { }
|
||||
}
|
||||
|
||||
for ($i = 1; $i < 99; ++$i) {
|
||||
if (!($result = pg_get_result($db))) {
|
||||
die('pg_get_result');
|
||||
}
|
||||
|
||||
if (pg_result_status($result) !== PGSQL_TUPLES_OK) {
|
||||
die('pg_result_status failed');
|
||||
}
|
||||
|
||||
if (pg_num_rows($result) == -1) {
|
||||
die('pg_num_rows failed');
|
||||
}
|
||||
|
||||
if (!($row = pg_fetch_row($result, null))) {
|
||||
die('pg_fetch_row failed');
|
||||
}
|
||||
|
||||
pg_free_result($result);
|
||||
|
||||
if (pg_get_result($db) !== false) {
|
||||
die('pg_get_result failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (($result = pg_get_result($db)) !== false) {
|
||||
if (pg_result_status($result) !== PGSQL_PIPELINE_SYNC) {
|
||||
die('pg_result_status failed');
|
||||
}
|
||||
}
|
||||
|
||||
if (!pg_exit_pipeline_mode($db)) {
|
||||
die('pg_exit_pipeline_mode failed');
|
||||
}
|
||||
|
||||
echo "OK";
|
||||
|
||||
pg_close($db);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
OK
|
Loading…
Reference in New Issue
Block a user