@@ -499,7 +499,7 @@ test_pipeline_abort(PGconn *conn)
499499PQerrorMessage (conn ));
500500
501501/* Try to send two queries in one command */
502- if (PQsendQuery (conn ,"SELECT 1; SELECT 2" )!= 1 )
502+ if (PQsendQueryParams (conn ,"SELECT 1; SELECT 2" , 0 , NULL , NULL , NULL , NULL , 0 )!= 1 )
503503pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
504504if (PQpipelineSync (conn )!= 1 )
505505pg_fatal ("pipeline sync failed: %s" ,PQerrorMessage (conn ));
@@ -531,7 +531,8 @@ test_pipeline_abort(PGconn *conn)
531531fprintf (stderr ,"ok\n" );
532532
533533/* Test single-row mode with an error partways */
534- if (PQsendQuery (conn ,"SELECT 1.0/g FROM generate_series(3, -1, -1) g" )!= 1 )
534+ if (PQsendQueryParams (conn ,"SELECT 1.0/g FROM generate_series(3, -1, -1) g" ,
535+ 0 ,NULL ,NULL ,NULL ,NULL ,0 )!= 1 )
535536pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
536537if (PQpipelineSync (conn )!= 1 )
537538pg_fatal ("pipeline sync failed: %s" ,PQerrorMessage (conn ));
@@ -991,133 +992,10 @@ test_pipeline_idle(PGconn *conn)
991992
992993PQsetNoticeProcessor (conn ,notice_processor ,& n_notices );
993994
994- /*
995- * Cause a Close message to be sent to the server, and watch libpq's
996- * reaction to the resulting CloseComplete. libpq must not get in IDLE
997- * state until that has been received.
998- */
999- if (PQenterPipelineMode (conn )!= 1 )
1000- pg_fatal ("failed to enter pipeline mode: %s" ,PQerrorMessage (conn ));
1001-
1002- if (PQsendQuery (conn ,"SELECT 1" )!= 1 )
1003- pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
1004- PQsendFlushRequest (conn );
1005- res = PQgetResult (conn );
1006- if (res == NULL )
1007- pg_fatal ("PQgetResult returned null when there's a pipeline item: %s" ,
1008- PQerrorMessage (conn ));
1009- if (PQresultStatus (res )!= PGRES_TUPLES_OK )
1010- pg_fatal ("Unexpected result code %s from first pipeline item" ,
1011- PQresStatus (PQresultStatus (res )));
1012- PQclear (res );
1013-
1014- res = PQgetResult (conn );
1015- if (res != NULL )
1016- pg_fatal ("expected NULL result" );
1017-
1018- if (PQpipelineSync (conn )!= 1 )
1019- pg_fatal ("pipeline sync failed: %s" ,PQerrorMessage (conn ));
1020- res = PQgetResult (conn );
1021- if (res == NULL )
1022- pg_fatal ("PQgetResult returned null when there's a pipeline item: %s" ,
1023- PQerrorMessage (conn ));
1024- if (PQresultStatus (res )!= PGRES_PIPELINE_SYNC )
1025- pg_fatal ("Unexpected result code %s instead of PGRES_PIPELINE_SYNC, error: %s" ,
1026- PQresStatus (PQresultStatus (res )),PQerrorMessage (conn ));
1027- PQclear (res );
1028- res = NULL ;
1029-
1030- if (PQexitPipelineMode (conn )!= 1 )
1031- pg_fatal ("attempt to exit pipeline mode failed when it should've succeeded: %s" ,
1032- PQerrorMessage (conn ));
1033-
1034- /*
1035- * Must not have got any notices here; note bug as described in
1036- * https://postgr.es/m/CA+mi_8bvD0_CW3sumgwPvWdNzXY32itoG_16tDYRu_1S2gV2iw@mail.gmail.com
1037- */
1038- if (n_notices > 0 )
1039- pg_fatal ("got %d notice(s)" ,n_notices );
1040- fprintf (stderr ,"ok - 1\n" );
1041-
1042- /*
1043- * Verify that we can send a query using simple query protocol after one
1044- * in pipeline mode.
1045- */
1046- if (PQenterPipelineMode (conn )!= 1 )
1047- pg_fatal ("failed to enter pipeline mode: %s" ,PQerrorMessage (conn ));
1048- if (PQsendQuery (conn ,"SELECT 1" )!= 1 )
1049- pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
1050- PQsendFlushRequest (conn );
1051- res = PQgetResult (conn );
1052- if (res == NULL )
1053- pg_fatal ("PQgetResult returned null when there's a pipeline item: %s" ,
1054- PQerrorMessage (conn ));
1055- if (PQresultStatus (res )!= PGRES_TUPLES_OK )
1056- pg_fatal ("unexpected result code %s from first pipeline item" ,
1057- PQresStatus (PQresultStatus (res )));
1058- res = PQgetResult (conn );
1059- if (res != NULL )
1060- pg_fatal ("got unexpected non-null result" );
1061- /* We can exit pipeline mode now */
1062- if (PQexitPipelineMode (conn )!= 1 )
1063- pg_fatal ("attempt to exit pipeline mode failed when it should've succeeded: %s" ,
1064- PQerrorMessage (conn ));
1065- res = PQexec (conn ,"SELECT 2" );
1066- if (n_notices > 0 )
1067- pg_fatal ("got %d notice(s)" ,n_notices );
1068- if (res == NULL )
1069- pg_fatal ("PQexec returned NULL" );
1070- if (PQresultStatus (res )!= PGRES_TUPLES_OK )
1071- pg_fatal ("unexpected result code %s from non-pipeline query" ,
1072- PQresStatus (PQresultStatus (res )));
1073- res = PQgetResult (conn );
1074- if (res != NULL )
1075- pg_fatal ("did not receive terminating NULL" );
1076- if (n_notices > 0 )
1077- pg_fatal ("got %d notice(s)" ,n_notices );
1078- fprintf (stderr ,"ok - 2\n" );
1079-
1080- /*
1081- * Case 2: exiting pipeline mode is not OK if a second command is sent.
1082- */
1083-
1084- if (PQenterPipelineMode (conn )!= 1 )
1085- pg_fatal ("failed to enter pipeline mode: %s" ,PQerrorMessage (conn ));
1086- if (PQsendQuery (conn ,"SELECT 1" )!= 1 )
1087- pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
1088- PQsendFlushRequest (conn );
1089- res = PQgetResult (conn );
1090- if (res == NULL )
1091- pg_fatal ("PQgetResult returned null when there's a pipeline item: %s" ,
1092- PQerrorMessage (conn ));
1093- if (PQresultStatus (res )!= PGRES_TUPLES_OK )
1094- pg_fatal ("unexpected result code %s from first pipeline item" ,
1095- PQresStatus (PQresultStatus (res )));
1096- if (PQsendQuery (conn ,"SELECT 2" )!= 1 )
1097- pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
1098- PQsendFlushRequest (conn );
1099- /* read terminating null from first query */
1100- res = PQgetResult (conn );
1101- if (res != NULL )
1102- pg_fatal ("did not receive terminating NULL" );
1103- res = PQgetResult (conn );
1104- if (res == NULL )
1105- pg_fatal ("PQgetResult returned null when there's a pipeline item: %s" ,
1106- PQerrorMessage (conn ));
1107- if (PQresultStatus (res )!= PGRES_TUPLES_OK )
1108- pg_fatal ("unexpected result code %s from first pipeline item" ,
1109- PQresStatus (PQresultStatus (res )));
1110- res = PQgetResult (conn );
1111- if (res != NULL )
1112- pg_fatal ("did not receive terminating NULL" );
1113- if (PQexitPipelineMode (conn )!= 1 )
1114- pg_fatal ("attempt to exit pipeline mode failed when it should've succeeded: %s" ,
1115- PQerrorMessage (conn ));
1116-
1117995/* Try to exit pipeline mode in pipeline-idle state */
1118996if (PQenterPipelineMode (conn )!= 1 )
1119997pg_fatal ("failed to enter pipeline mode: %s" ,PQerrorMessage (conn ));
1120- if (PQsendQuery (conn ,"SELECT 1" )!= 1 )
998+ if (PQsendQueryParams (conn ,"SELECT 1" , 0 , NULL , NULL , NULL , NULL , 0 )!= 1 )
1121999pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
11221000PQsendFlushRequest (conn );
11231001res = PQgetResult (conn );
@@ -1131,7 +1009,7 @@ test_pipeline_idle(PGconn *conn)
11311009res = PQgetResult (conn );
11321010if (res != NULL )
11331011pg_fatal ("did not receive terminating NULL" );
1134- if (PQsendQuery (conn ,"SELECT 2" )!= 1 )
1012+ if (PQsendQueryParams (conn ,"SELECT 2" , 0 , NULL , NULL , NULL , NULL , 0 )!= 1 )
11351013pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
11361014if (PQexitPipelineMode (conn )== 1 )
11371015pg_fatal ("exiting pipeline succeeded when it shouldn't" );
@@ -1153,12 +1031,12 @@ test_pipeline_idle(PGconn *conn)
11531031
11541032if (n_notices > 0 )
11551033pg_fatal ("got %d notice(s)" ,n_notices );
1156- fprintf (stderr ,"ok -3 \n" );
1034+ fprintf (stderr ,"ok -1 \n" );
11571035
11581036/* Have a WARNING in the middle of a resultset */
11591037if (PQenterPipelineMode (conn )!= 1 )
11601038pg_fatal ("entering pipeline mode failed: %s" ,PQerrorMessage (conn ));
1161- if (PQsendQuery (conn ,"SELECT pg_catalog.pg_advisory_unlock(1,1)" )!= 1 )
1039+ if (PQsendQueryParams (conn ,"SELECT pg_catalog.pg_advisory_unlock(1,1)" , 0 , NULL , NULL , NULL , NULL , 0 )!= 1 )
11621040pg_fatal ("failed to send query: %s" ,PQerrorMessage (conn ));
11631041PQsendFlushRequest (conn );
11641042res = PQgetResult (conn );
@@ -1168,7 +1046,7 @@ test_pipeline_idle(PGconn *conn)
11681046pg_fatal ("unexpected result code %s" ,PQresStatus (PQresultStatus (res )));
11691047if (PQexitPipelineMode (conn )!= 1 )
11701048pg_fatal ("failed to exit pipeline mode: %s" ,PQerrorMessage (conn ));
1171- fprintf (stderr ,"ok -4 \n" );
1049+ fprintf (stderr ,"ok -2 \n" );
11721050}
11731051
11741052static void