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

Commit0af98a9

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

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
@@ -108,14 +108,14 @@ free_statement(struct statement *stmt)
108108
}
109109

110110
staticint
111-
next_insert(char*text,intpos,boolquestionmarks)
111+
next_insert(char*text,intpos,boolquestionmarks,boolstd_strings)
112112
{
113113
boolstring= false;
114114
intp=pos;
115115

116116
for (;text[p]!='\0';p++)
117117
{
118-
if (text[p]=='\\')/* escape character */
118+
if (string&& !std_strings&&text[p]=='\\')/* escape character */
119119
p++;
120120
elseif (text[p]=='\'')
121121
string=string ? false : true;
@@ -1109,6 +1109,13 @@ ecpg_build_params(struct statement *stmt)
11091109
structvariable*var;
11101110
intdesc_counter=0;
11111111
intposition=0;
1112+
constchar*value;
1113+
boolstd_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
{
13911398
ecpg_raise(stmt->lineno,ECPG_TOO_FEW_ARGUMENTS,
13921399
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS,NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp