Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
65ba1b5c
Commit
65ba1b5c
authored
7 years ago
by
Michael Meskes
Browse files
Options
Downloads
Patches
Plain Diff
Fixed handling of escape character in libecpg.
Patch by Tsunakawa Takayuki <tsunakawa.takay@jp.fujitsu.com>
parent
51e9fffb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/interfaces/ecpg/ecpglib/execute.c
+11
-4
11 additions, 4 deletions
src/interfaces/ecpg/ecpglib/execute.c
with
11 additions
and
4 deletions
src/interfaces/ecpg/ecpglib/execute.c
+
11
−
4
View file @
65ba1b5c
...
@@ -108,14 +108,14 @@ free_statement(struct statement *stmt)
...
@@ -108,14 +108,14 @@ free_statement(struct statement *stmt)
}
}
static
int
static
int
next_insert
(
char
*
text
,
int
pos
,
bool
questionmarks
)
next_insert
(
char
*
text
,
int
pos
,
bool
questionmarks
,
bool
std_strings
)
{
{
bool
string
=
false
;
bool
string
=
false
;
int
p
=
pos
;
int
p
=
pos
;
for
(;
text
[
p
]
!=
'\0'
;
p
++
)
for
(;
text
[
p
]
!=
'\0'
;
p
++
)
{
{
if
(
text
[
p
]
==
'\\'
)
/* escape character */
if
(
string
&&
!
std_strings
&&
text
[
p
]
==
'\\'
)
/* escape character */
p
++
;
p
++
;
else
if
(
text
[
p
]
==
'\''
)
else
if
(
text
[
p
]
==
'\''
)
string
=
string
?
false
:
true
;
string
=
string
?
false
:
true
;
...
@@ -1109,6 +1109,13 @@ ecpg_build_params(struct statement *stmt)
...
@@ -1109,6 +1109,13 @@ ecpg_build_params(struct statement *stmt)
struct
variable
*
var
;
struct
variable
*
var
;
int
desc_counter
=
0
;
int
desc_counter
=
0
;
int
position
=
0
;
int
position
=
0
;
const
char
*
value
;
bool
std_strings
=
false
;
/* Get standard_conforming_strings setting. */
value
=
PQparameterStatus
(
stmt
->
connection
->
connection
,
"standard_conforming_strings"
);
if
(
value
&&
strcmp
(
value
,
"on"
)
==
0
)
std_strings
=
true
;
/*
/*
* If the type is one of the fill in types then we take the argument and
* 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)
...
@@ -1299,7 +1306,7 @@ ecpg_build_params(struct statement *stmt)
* now tobeinserted points to an area that contains the next
* now tobeinserted points to an area that contains the next
* parameter; now find the position in the string where it belongs
* parameter; now find the position in the string where it belongs
*/
*/
if
((
position
=
next_insert
(
stmt
->
command
,
position
,
stmt
->
questionmarks
)
+
1
)
==
0
)
if
((
position
=
next_insert
(
stmt
->
command
,
position
,
stmt
->
questionmarks
,
std_strings
)
+
1
)
==
0
)
{
{
/*
/*
* We have an argument but we dont have the matched up placeholder
* We have an argument but we dont have the matched up placeholder
...
@@ -1386,7 +1393,7 @@ ecpg_build_params(struct statement *stmt)
...
@@ -1386,7 +1393,7 @@ ecpg_build_params(struct statement *stmt)
}
}
/* Check if there are unmatched things left. */
/* Check if there are unmatched things left. */
if
(
next_insert
(
stmt
->
command
,
position
,
stmt
->
questionmarks
)
>=
0
)
if
(
next_insert
(
stmt
->
command
,
position
,
stmt
->
questionmarks
,
std_strings
)
>=
0
)
{
{
ecpg_raise
(
stmt
->
lineno
,
ECPG_TOO_FEW_ARGUMENTS
,
ecpg_raise
(
stmt
->
lineno
,
ECPG_TOO_FEW_ARGUMENTS
,
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS
,
NULL
);
ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS
,
NULL
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment