Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4175360

Browse files
author
Michael Meskes
committed
Fixed handling of escape character in libecpg.
Patch by Tsunakawa Takayuki <tsunakawa.takay@jp.fujitsu.com>
1 parent7dc66a2 commit4175360

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎src/interfaces/ecpg/ecpglib/execute.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ free_statement(struct statement * stmt)
109109
}
110110

111111
staticint
112-
next_insert(char*text,intpos,boolquestionmarks)
112+
next_insert(char*text,intpos,boolquestionmarks,boolstd_strings)
113113
{
114114
boolstring= false;
115115
intp=pos;
116116

117117
for (;text[p]!='\0';p++)
118118
{
119-
if (text[p]=='\\')/* escape character */
119+
if (string&& !std_strings&&text[p]=='\\')/* escape character */
120120
p++;
121121
elseif (text[p]=='\'')
122122
string=string ? false : true;
@@ -1110,6 +1110,13 @@ ecpg_build_params(struct statement * stmt)
11101110
structvariable*var;
11111111
intdesc_counter=0;
11121112
intposition=0;
1113+
constchar*value;
1114+
boolstd_strings= false;
1115+
1116+
/* Get standard_conforming_strings setting. */
1117+
value=PQparameterStatus(stmt->connection->connection,"standard_conforming_strings");
1118+
if (value&&strcmp(value,"on")==0)
1119+
std_strings= true;
11131120

11141121
/*
11151122
* If the type is one of the fill in types then we take the argument and
@@ -1300,7 +1307,7 @@ ecpg_build_params(struct statement * stmt)
13001307
* now tobeinserted points to an area that contains the next
13011308
* parameter; now find the position in the string where it belongs
13021309
*/
1303-
if ((position=next_insert(stmt->command,position,stmt->questionmarks)+1)==0)
1310+
if ((position=next_insert(stmt->command,position,stmt->questionmarks,std_strings)+1)==0)
13041311
{
13051312
/*
13061313
* We have an argument but we dont have the matched up placeholder
@@ -1387,7 +1394,7 @@ ecpg_build_params(struct statement * stmt)
13871394
}
13881395

13891396
/* Check if there are unmatched things left. */
1390-
if (next_insert(stmt->command,position,stmt->questionmarks) >=0)
1397+
if (next_insert(stmt->command,position,stmt->questionmarks,std_strings) >=0)
13911398
{
13921399
ecpg_raise(stmt->lineno,ECPG_TOO_FEW_ARGUMENTS,
13931400
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS,NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp