@@ -108,14 +108,14 @@ free_statement(struct statement *stmt)
108108}
109109
110110static int
111- next_insert (char * text ,int pos ,bool questionmarks )
111+ next_insert (char * text ,int pos ,bool questionmarks , bool std_strings )
112112{
113113bool string = false;
114114int p = pos ;
115115
116116for (;text [p ]!= '\0' ;p ++ )
117117{
118- if (text [p ]== '\\' )/* escape character */
118+ if (string && ! std_strings && text [p ]== '\\' )/* escape character */
119119p ++ ;
120120else if (text [p ]== '\'' )
121121string = string ? false : true;
@@ -1109,6 +1109,13 @@ ecpg_build_params(struct statement *stmt)
11091109struct variable * var ;
11101110int desc_counter = 0 ;
11111111int position = 0 ;
1112+ const char * value ;
1113+ bool std_strings = false;
1114+
1115+ /* Get standard_conforming_strings setting. */
1116+ value = PQparameterStatus (stmt -> connection -> connection ,"standard_conforming_strings" );
1117+ if (value && strcmp (value ,"on" )== 0 )
1118+ std_strings = true;
11121119
11131120/*
11141121 * If the type is one of the fill in types then we take the argument and
@@ -1299,7 +1306,7 @@ ecpg_build_params(struct statement *stmt)
12991306 * now tobeinserted points to an area that contains the next
13001307 * parameter; now find the position in the string where it belongs
13011308 */
1302- if ((position = next_insert (stmt -> command ,position ,stmt -> questionmarks )+ 1 )== 0 )
1309+ if ((position = next_insert (stmt -> command ,position ,stmt -> questionmarks , std_strings )+ 1 )== 0 )
13031310{
13041311/*
13051312 * We have an argument but we dont have the matched up placeholder
@@ -1386,7 +1393,7 @@ ecpg_build_params(struct statement *stmt)
13861393}
13871394
13881395/* Check if there are unmatched things left. */
1389- if (next_insert (stmt -> command ,position ,stmt -> questionmarks ) >=0 )
1396+ if (next_insert (stmt -> command ,position ,stmt -> questionmarks , std_strings ) >=0 )
13901397{
13911398ecpg_raise (stmt -> lineno ,ECPG_TOO_FEW_ARGUMENTS ,
13921399ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS ,NULL );