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