@@ -47,37 +47,47 @@ if (!pg_enter_pipeline_mode($db)) {
47
47
}
48
48
49
49
if (!pg_send_query_params ($ db , "select $1 as index, now() + ($1||' day')::interval as time " , array (1 ))) {
50
- die ('pg_send_query_params{} ' );
50
+ die ('pg_send_query_params failed ' );
51
51
}
52
52
53
53
if (!pg_pipeline_sync ($ db )) {
54
- die ('pg_pipeline_sync{} ' );
54
+ die ('pg_pipeline_sync failed ' );
55
55
}
56
56
57
57
if (pg_pipeline_status ($ db ) !== PGSQL_PIPELINE_ON ) {
58
- die ('pg_pipeline_status{} ' );
58
+ die ('pg_pipeline_status failed ' );
59
59
}
60
60
61
61
if (!($ result = pg_get_result ($ db ))) {
62
- die ('pg_get_result() ' );
62
+ die ('pg_get_result ' );
63
+ }
64
+
65
+ if (pg_result_status ($ result ) !== PGSQL_TUPLES_OK ) {
66
+ die ('pg_result_status failed ' );
63
67
}
64
68
65
69
if (pg_num_rows ($ result ) == -1 ) {
66
- die ('pg_num_rows() ' );
70
+ die ('pg_num_rows failed ' );
67
71
}
68
72
69
73
if (!pg_fetch_row ($ result , null )) {
70
- die ('pg_fetch_row() ' );
74
+ die ('pg_fetch_row failed ' );
71
75
}
72
76
73
77
pg_free_result ($ result );
74
- while (pg_connection_busy ($ db )) {
75
- nb_flush ($ db , $ db_socket );
76
- nb_consume ($ db , $ db_socket );
78
+
79
+ if (pg_get_result ($ db ) !== false ) {
80
+ die ('pg_get_result failed ' );
81
+ }
82
+
83
+ if (($ result = pg_get_result ($ db )) !== false ) {
84
+ if (pg_result_status ($ result ) !== PGSQL_PIPELINE_SYNC ) {
85
+ die ('pg_result_status failed ' );
86
+ }
77
87
}
78
88
79
89
if (!pg_exit_pipeline_mode ($ db )) {
80
- die ('pg_exit_pipeline_mode{} ' );
90
+ die ('pg_exit_pipeline_mode failed ' );
81
91
}
82
92
83
93
echo "OK " ;
0 commit comments