@@ -1020,17 +1020,23 @@ PHP_FUNCTION(pg_query)
1020
1020
1021
1021
pgsql = link -> conn ;
1022
1022
1023
- if (PQsetnonblocking (pgsql , 0 )) {
1024
- php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1025
- RETURN_FALSE ;
1026
- }
1027
- while ((pgsql_result = PQgetResult (pgsql ))) {
1028
- PQclear (pgsql_result );
1029
- leftover = 1 ;
1030
- }
1031
- if (leftover ) {
1032
- php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1023
+ #ifdef LIBPQ_HAS_PIPELINING
1024
+ if (PQpipelineStatus (pgsql ) == PQ_PIPELINE_OFF ) {
1025
+ #endif
1026
+ if (PQsetnonblocking (pgsql , 0 )) {
1027
+ php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1028
+ RETURN_FALSE ;
1029
+ }
1030
+ while ((pgsql_result = PQgetResult (pgsql ))) {
1031
+ PQclear (pgsql_result );
1032
+ leftover = 1 ;
1033
+ }
1034
+ if (leftover ) {
1035
+ php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1036
+ }
1037
+ #ifdef LIBPQ_HAS_PIPELINING
1033
1038
}
1039
+ #endif
1034
1040
pgsql_result = PQexec (pgsql , query );
1035
1041
if ((PGG (auto_reset_persistent ) & 2 ) && PQstatus (pgsql ) != CONNECTION_OK ) {
1036
1042
PQclear (pgsql_result );
@@ -1114,17 +1120,23 @@ PHP_FUNCTION(pg_query_params)
1114
1120
1115
1121
pgsql = link -> conn ;
1116
1122
1117
- if (PQsetnonblocking (pgsql , 0 )) {
1118
- php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1119
- RETURN_FALSE ;
1120
- }
1121
- while ((pgsql_result = PQgetResult (pgsql ))) {
1122
- PQclear (pgsql_result );
1123
- leftover = 1 ;
1124
- }
1125
- if (leftover ) {
1126
- php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1123
+ #ifdef LIBPQ_HAS_PIPELINING
1124
+ if (PQpipelineStatus (pgsql ) == PQ_PIPELINE_OFF ) {
1125
+ #endif
1126
+ if (PQsetnonblocking (pgsql , 0 )) {
1127
+ php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1128
+ RETURN_FALSE ;
1129
+ }
1130
+ while ((pgsql_result = PQgetResult (pgsql ))) {
1131
+ PQclear (pgsql_result );
1132
+ leftover = 1 ;
1133
+ }
1134
+ if (leftover ) {
1135
+ php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1136
+ }
1137
+ #ifdef LIBPQ_HAS_PIPELINING
1127
1138
}
1139
+ #endif
1128
1140
1129
1141
num_params = zend_hash_num_elements (Z_ARRVAL_P (pv_param_arr ));
1130
1142
if (num_params > 0 ) {
@@ -1219,17 +1231,23 @@ PHP_FUNCTION(pg_prepare)
1219
1231
1220
1232
pgsql = link -> conn ;
1221
1233
1222
- if (PQsetnonblocking (pgsql , 0 )) {
1223
- php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1224
- RETURN_FALSE ;
1225
- }
1226
- while ((pgsql_result = PQgetResult (pgsql ))) {
1227
- PQclear (pgsql_result );
1228
- leftover = 1 ;
1229
- }
1230
- if (leftover ) {
1231
- php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1234
+ #ifdef LIBPQ_HAS_PIPELINING
1235
+ if (PQpipelineStatus (pgsql ) == PQ_PIPELINE_OFF ) {
1236
+ #endif
1237
+ if (PQsetnonblocking (pgsql , 0 )) {
1238
+ php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1239
+ RETURN_FALSE ;
1240
+ }
1241
+ while ((pgsql_result = PQgetResult (pgsql ))) {
1242
+ PQclear (pgsql_result );
1243
+ leftover = 1 ;
1244
+ }
1245
+ if (leftover ) {
1246
+ php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1247
+ }
1248
+ #ifdef LIBPQ_HAS_PIPELINING
1232
1249
}
1250
+ #endif
1233
1251
pgsql_result = PQprepare (pgsql , stmtname , query , 0 , NULL );
1234
1252
if ((PGG (auto_reset_persistent ) & 2 ) && PQstatus (pgsql ) != CONNECTION_OK ) {
1235
1253
PQclear (pgsql_result );
@@ -1300,17 +1318,23 @@ PHP_FUNCTION(pg_execute)
1300
1318
1301
1319
pgsql = link -> conn ;
1302
1320
1303
- if (PQsetnonblocking (pgsql , 0 )) {
1304
- php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1305
- RETURN_FALSE ;
1306
- }
1307
- while ((pgsql_result = PQgetResult (pgsql ))) {
1308
- PQclear (pgsql_result );
1309
- leftover = 1 ;
1310
- }
1311
- if (leftover ) {
1312
- php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1321
+ #ifdef LIBPQ_HAS_PIPELINING
1322
+ if (PQpipelineStatus (pgsql ) == PQ_PIPELINE_OFF ) {
1323
+ #endif
1324
+ if (PQsetnonblocking (pgsql , 0 )) {
1325
+ php_error_docref (NULL , E_NOTICE ,"Cannot set connection to blocking mode" );
1326
+ RETURN_FALSE ;
1327
+ }
1328
+ while ((pgsql_result = PQgetResult (pgsql ))) {
1329
+ PQclear (pgsql_result );
1330
+ leftover = 1 ;
1331
+ }
1332
+ if (leftover ) {
1333
+ php_error_docref (NULL , E_NOTICE , "Found results on this connection. Use pg_get_result() to get these results first" );
1334
+ }
1335
+ #ifdef LIBPQ_HAS_PIPELINING
1313
1336
}
1337
+ #endif
1314
1338
1315
1339
num_params = zend_hash_num_elements (Z_ARRVAL_P (pv_param_arr ));
1316
1340
if (num_params > 0 ) {
0 commit comments