@@ -3595,9 +3595,6 @@ PHP_FUNCTION(pg_send_query)
3595
3595
char * query ;
3596
3596
size_t len ;
3597
3597
PGconn * pgsql ;
3598
- #ifdef LIBPQ_HAS_PIPELINING
3599
- bool is_pipeline_mode ;
3600
- #endif
3601
3598
int is_non_blocking ;
3602
3599
int ret ;
3603
3600
@@ -3609,40 +3606,23 @@ PHP_FUNCTION(pg_send_query)
3609
3606
CHECK_PGSQL_LINK (link );
3610
3607
pgsql = link -> conn ;
3611
3608
3612
- #ifdef LIBPQ_HAS_PIPELINING
3613
- is_pipeline_mode = (PQpipelineStatus (pgsql ) == PQ_PIPELINE_ON );
3614
- if (is_pipeline_mode ) {
3615
- is_non_blocking = 1 ;
3616
- } else {
3617
- #endif
3618
- is_non_blocking = PQisnonblocking (pgsql );
3609
+ is_non_blocking = PQisnonblocking (pgsql );
3619
3610
3620
- if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3621
- php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3622
- RETURN_FALSE ;
3623
- }
3611
+ if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3612
+ php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3613
+ RETURN_FALSE ;
3614
+ }
3624
3615
3625
- if (_php_pgsql_link_has_results (pgsql )) {
3626
- php_error_docref (NULL , E_NOTICE ,
3627
- "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3628
- }
3629
- #ifdef LIBPQ_HAS_PIPELINING
3616
+ if (_php_pgsql_link_has_results (pgsql )) {
3617
+ php_error_docref (NULL , E_NOTICE ,
3618
+ "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3630
3619
}
3631
- #endif
3632
3620
3633
3621
if (is_non_blocking ) {
3634
3622
if (!PQsendQuery (pgsql , query )) {
3635
3623
RETURN_FALSE ;
3636
3624
}
3637
- #ifdef LIBPQ_HAS_PIPELINING
3638
- if (is_pipeline_mode ) {
3639
- ret = 0 ;
3640
- } else {
3641
- #endif
3642
- ret = PQflush (pgsql );
3643
- #ifdef LIBPQ_HAS_PIPELINING
3644
- }
3645
- #endif
3625
+ ret = PQflush (pgsql );
3646
3626
} else {
3647
3627
if (!PQsendQuery (pgsql , query )) {
3648
3628
if ((PGG (auto_reset_persistent ) & 2 ) && PQstatus (pgsql ) != CONNECTION_OK ) {
@@ -3687,9 +3667,6 @@ PHP_FUNCTION(pg_send_query_params)
3687
3667
char * query ;
3688
3668
size_t query_len ;
3689
3669
PGconn * pgsql ;
3690
- #ifdef LIBPQ_HAS_PIPELINING
3691
- bool is_pipeline_mode ;
3692
- #endif
3693
3670
int is_non_blocking ;
3694
3671
int ret ;
3695
3672
@@ -3701,26 +3678,17 @@ PHP_FUNCTION(pg_send_query_params)
3701
3678
CHECK_PGSQL_LINK (link );
3702
3679
pgsql = link -> conn ;
3703
3680
3704
- #ifdef LIBPQ_HAS_PIPELINING
3705
- is_pipeline_mode = (PQpipelineStatus (pgsql ) == PQ_PIPELINE_ON );
3706
- if (is_pipeline_mode ) {
3707
- is_non_blocking = 1 ;
3708
- } else {
3709
- #endif
3710
- is_non_blocking = PQisnonblocking (pgsql );
3681
+ is_non_blocking = PQisnonblocking (pgsql );
3711
3682
3712
- if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3713
- php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3714
- RETURN_FALSE ;
3715
- }
3683
+ if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3684
+ php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3685
+ RETURN_FALSE ;
3686
+ }
3716
3687
3717
- if (_php_pgsql_link_has_results (pgsql )) {
3718
- php_error_docref (NULL , E_NOTICE ,
3719
- "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3720
- }
3721
- #ifdef LIBPQ_HAS_PIPELINING
3688
+ if (_php_pgsql_link_has_results (pgsql )) {
3689
+ php_error_docref (NULL , E_NOTICE ,
3690
+ "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3722
3691
}
3723
- #endif
3724
3692
3725
3693
num_params = zend_hash_num_elements (Z_ARRVAL_P (pv_param_arr ));
3726
3694
if (num_params > 0 ) {
@@ -3759,15 +3727,7 @@ PHP_FUNCTION(pg_send_query_params)
3759
3727
}
3760
3728
3761
3729
if (is_non_blocking ) {
3762
- #ifdef LIBPQ_HAS_PIPELINING
3763
- if (is_pipeline_mode ) {
3764
- ret = 0 ;
3765
- } else {
3766
- #endif
3767
- ret = PQflush (pgsql );
3768
- #ifdef LIBPQ_HAS_PIPELINING
3769
- }
3770
- #endif
3730
+ ret = PQflush (pgsql );
3771
3731
} else {
3772
3732
/* Wait to finish sending buffer */
3773
3733
while ((ret = PQflush (pgsql ))) {
@@ -3801,9 +3761,6 @@ PHP_FUNCTION(pg_send_prepare)
3801
3761
char * query , * stmtname ;
3802
3762
size_t stmtname_len , query_len ;
3803
3763
PGconn * pgsql ;
3804
- #ifdef LIBPQ_HAS_PIPELINING
3805
- bool is_pipeline_mode ;
3806
- #endif
3807
3764
int is_non_blocking ;
3808
3765
int ret ;
3809
3766
@@ -3815,26 +3772,17 @@ PHP_FUNCTION(pg_send_prepare)
3815
3772
CHECK_PGSQL_LINK (link );
3816
3773
pgsql = link -> conn ;
3817
3774
3818
- #ifdef LIBPQ_HAS_PIPELINING
3819
- is_pipeline_mode = (PQpipelineStatus (pgsql ) == PQ_PIPELINE_ON );
3820
- if (is_pipeline_mode ) {
3821
- is_non_blocking = 1 ;
3822
- } else {
3823
- #endif
3824
- is_non_blocking = PQisnonblocking (pgsql );
3775
+ is_non_blocking = PQisnonblocking (pgsql );
3825
3776
3826
- if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3827
- php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3828
- RETURN_FALSE ;
3829
- }
3777
+ if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3778
+ php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3779
+ RETURN_FALSE ;
3780
+ }
3830
3781
3831
- if (_php_pgsql_link_has_results (pgsql )) {
3832
- php_error_docref (NULL , E_NOTICE ,
3833
- "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3834
- }
3835
- #ifdef LIBPQ_HAS_PIPELINING
3782
+ if (_php_pgsql_link_has_results (pgsql )) {
3783
+ php_error_docref (NULL , E_NOTICE ,
3784
+ "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3836
3785
}
3837
- #endif
3838
3786
3839
3787
if (!PQsendPrepare (pgsql , stmtname , query , 0 , NULL )) {
3840
3788
if (is_non_blocking ) {
@@ -3850,15 +3798,7 @@ PHP_FUNCTION(pg_send_prepare)
3850
3798
}
3851
3799
3852
3800
if (is_non_blocking ) {
3853
- #ifdef LIBPQ_HAS_PIPELINING
3854
- if (is_pipeline_mode ) {
3855
- ret = 0 ;
3856
- } else {
3857
- #endif
3858
- ret = PQflush (pgsql );
3859
- #ifdef LIBPQ_HAS_PIPELINING
3860
- }
3861
- #endif
3801
+ ret = PQflush (pgsql );
3862
3802
} else {
3863
3803
/* Wait to finish sending buffer */
3864
3804
while ((ret = PQflush (pgsql ))) {
@@ -3894,9 +3834,6 @@ PHP_FUNCTION(pg_send_execute)
3894
3834
char * stmtname ;
3895
3835
size_t stmtname_len ;
3896
3836
PGconn * pgsql ;
3897
- #ifdef LIBPQ_HAS_PIPELINING
3898
- bool is_pipeline_mode ;
3899
- #endif
3900
3837
int is_non_blocking ;
3901
3838
int ret ;
3902
3839
@@ -3908,26 +3845,17 @@ PHP_FUNCTION(pg_send_execute)
3908
3845
CHECK_PGSQL_LINK (link );
3909
3846
pgsql = link -> conn ;
3910
3847
3911
- #ifdef LIBPQ_HAS_PIPELINING
3912
- is_pipeline_mode = (PQpipelineStatus (pgsql ) == PQ_PIPELINE_ON );
3913
- if (is_pipeline_mode ) {
3914
- is_non_blocking = 1 ;
3915
- } else {
3916
- #endif
3917
- is_non_blocking = PQisnonblocking (pgsql );
3848
+ is_non_blocking = PQisnonblocking (pgsql );
3918
3849
3919
- if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3920
- php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3921
- RETURN_FALSE ;
3922
- }
3850
+ if (is_non_blocking == 0 && PQsetnonblocking (pgsql , 1 ) == -1 ) {
3851
+ php_error_docref (NULL , E_NOTICE , "Cannot set connection to nonblocking mode" );
3852
+ RETURN_FALSE ;
3853
+ }
3923
3854
3924
- if (_php_pgsql_link_has_results (pgsql )) {
3925
- php_error_docref (NULL , E_NOTICE ,
3926
- "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3927
- }
3928
- #ifdef LIBPQ_HAS_PIPELINING
3855
+ if (_php_pgsql_link_has_results (pgsql )) {
3856
+ php_error_docref (NULL , E_NOTICE ,
3857
+ "There are results on this connection. Call pg_get_result() until it returns FALSE" );
3929
3858
}
3930
- #endif
3931
3859
3932
3860
num_params = zend_hash_num_elements (Z_ARRVAL_P (pv_param_arr ));
3933
3861
if (num_params > 0 ) {
@@ -3968,15 +3896,7 @@ PHP_FUNCTION(pg_send_execute)
3968
3896
}
3969
3897
3970
3898
if (is_non_blocking ) {
3971
- #ifdef LIBPQ_HAS_PIPELINING
3972
- if (is_pipeline_mode ) {
3973
- ret = 0 ;
3974
- } else {
3975
- #endif
3976
- ret = PQflush (pgsql );
3977
- #ifdef LIBPQ_HAS_PIPELINING
3978
- }
3979
- #endif
3899
+ ret = PQflush (pgsql );
3980
3900
} else {
3981
3901
/* Wait to finish sending buffer */
3982
3902
while ((ret = PQflush (pgsql ))) {
@@ -5958,85 +5878,4 @@ PHP_FUNCTION(pg_select)
5958
5878
}
5959
5879
/* }}} */
5960
5880
5961
- #ifdef LIBPQ_HAS_PIPELINING
5962
- PHP_FUNCTION (pg_enter_pipeline_mode )
5963
- {
5964
- zval * pgsql_link ;
5965
- pgsql_link_handle * pgsql_handle ;
5966
-
5967
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & pgsql_link , pgsql_link_ce ) == FAILURE ) {
5968
- RETURN_THROWS ();
5969
- }
5970
-
5971
- pgsql_handle = Z_PGSQL_LINK_P (pgsql_link );
5972
- CHECK_PGSQL_LINK (pgsql_handle );
5973
-
5974
- PQsetnonblocking (pgsql_handle -> conn , 1 );
5975
-
5976
- RETURN_BOOL (PQenterPipelineMode (pgsql_handle -> conn ));
5977
- }
5978
-
5979
- PHP_FUNCTION (pg_exit_pipeline_mode )
5980
- {
5981
- zval * pgsql_link ;
5982
- pgsql_link_handle * pgsql_handle ;
5983
-
5984
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & pgsql_link , pgsql_link_ce ) == FAILURE ) {
5985
- RETURN_THROWS ();
5986
- }
5987
-
5988
- pgsql_handle = Z_PGSQL_LINK_P (pgsql_link );
5989
- CHECK_PGSQL_LINK (pgsql_handle );
5990
-
5991
- PQsetnonblocking (pgsql_handle -> conn , 0 );
5992
-
5993
- RETURN_BOOL (PQexitPipelineMode (pgsql_handle -> conn ));
5994
- }
5995
-
5996
- PHP_FUNCTION (pg_send_flush_request )
5997
- {
5998
- zval * pgsql_link ;
5999
- pgsql_link_handle * pgsql_handle ;
6000
-
6001
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & pgsql_link , pgsql_link_ce ) == FAILURE ) {
6002
- RETURN_THROWS ();
6003
- }
6004
-
6005
- pgsql_handle = Z_PGSQL_LINK_P (pgsql_link );
6006
- CHECK_PGSQL_LINK (pgsql_handle );
6007
-
6008
- RETURN_BOOL (PQsendFlushRequest (pgsql_handle -> conn ));
6009
- }
6010
-
6011
- PHP_FUNCTION (pg_pipeline_sync )
6012
- {
6013
- zval * pgsql_link ;
6014
- pgsql_link_handle * pgsql_handle ;
6015
-
6016
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & pgsql_link , pgsql_link_ce ) == FAILURE ) {
6017
- RETURN_THROWS ();
6018
- }
6019
-
6020
- pgsql_handle = Z_PGSQL_LINK_P (pgsql_link );
6021
- CHECK_PGSQL_LINK (pgsql_handle );
6022
-
6023
- RETURN_BOOL (PQpipelineSync (pgsql_handle -> conn ));
6024
- }
6025
-
6026
- PHP_FUNCTION (pg_pipeline_status )
6027
- {
6028
- zval * pgsql_link ;
6029
- pgsql_link_handle * pgsql_handle ;
6030
-
6031
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "O" , & pgsql_link , pgsql_link_ce ) == FAILURE ) {
6032
- RETURN_THROWS ();
6033
- }
6034
-
6035
- pgsql_handle = Z_PGSQL_LINK_P (pgsql_link );
6036
- CHECK_PGSQL_LINK (pgsql_handle );
6037
-
6038
- RETURN_LONG (PQpipelineStatus (pgsql_handle -> conn ));
6039
- }
6040
- #endif
6041
-
6042
5881
#endif
0 commit comments