Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
41c377f5
Commit
41c377f5
authored
Jun 18, 2001
by
Hiroshi Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix *escape* handling in copy_statement_with_parameters(was my fault).
parent
6054b332
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.c
+23
-20
No files found.
src/interfaces/odbc/convert.c
View file @
41c377f5
...
@@ -945,7 +945,7 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -945,7 +945,7 @@ copy_statement_with_parameters(StatementClass *stmt)
int
param_number
;
int
param_number
;
Int2
param_ctype
,
Int2
param_ctype
,
param_sqltype
;
param_sqltype
;
char
*
old_statement
=
stmt
->
statement
;
char
*
old_statement
=
stmt
->
statement
,
oldchar
;
char
*
new_statement
=
stmt
->
stmt_with_params
;
char
*
new_statement
=
stmt
->
stmt_with_params
;
unsigned
int
new_stsize
=
0
;
unsigned
int
new_stsize
=
0
;
SIMPLE_TIME
st
;
SIMPLE_TIME
st
;
...
@@ -999,10 +999,11 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -999,10 +999,11 @@ copy_statement_with_parameters(StatementClass *stmt)
for
(
opos
=
0
;
opos
<
oldstmtlen
;
opos
++
)
for
(
opos
=
0
;
opos
<
oldstmtlen
;
opos
++
)
{
{
oldchar
=
old_statement
[
opos
];
#ifdef MULTIBYTE
#ifdef MULTIBYTE
if
(
multibyte_char_check
(
old
_statement
[
opos
]
)
!=
0
)
if
(
multibyte_char_check
(
old
char
)
!=
0
)
{
{
CVT_APPEND_CHAR
(
old
_statement
[
opos
]
);
CVT_APPEND_CHAR
(
old
char
);
continue
;
continue
;
}
}
/*
/*
...
@@ -1010,35 +1011,37 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -1010,35 +1011,37 @@ copy_statement_with_parameters(StatementClass *stmt)
* 1-byte character.
* 1-byte character.
*/
*/
#endif
#endif
/* Squeeze carriage-return/linefeed pairs to linefeed only */
if
(
old_statement
[
opos
]
==
'\r'
&&
opos
+
1
<
oldstmtlen
&&
old_statement
[
opos
+
1
]
==
'\n'
)
continue
;
else
if
(
in_escape
)
/* escape check */
if
(
in_escape
)
/* escape check */
{
{
in_escape
=
FALSE
;
in_escape
=
FALSE
;
CVT_APPEND_CHAR
(
old
_statement
[
opos
]
);
CVT_APPEND_CHAR
(
old
char
);
continue
;
continue
;
}
}
else
if
(
in_quote
||
in_dquote
)
/* quote/double quote check */
else
if
(
in_quote
||
in_dquote
)
/* quote/double quote check */
{
{
if
(
old_statement
[
opos
]
==
'\''
&&
in_quote
)
if
(
oldchar
==
'\\'
)
in_escape
=
TRUE
;
else
if
(
oldchar
==
'\''
&&
in_quote
)
in_quote
=
FALSE
;
in_quote
=
FALSE
;
else
if
(
old
_statement
[
opos
]
==
'\"'
&&
in_dquote
)
else
if
(
old
char
==
'\"'
&&
in_dquote
)
in_dquote
=
FALSE
;
in_dquote
=
FALSE
;
CVT_APPEND_CHAR
(
old
_statement
[
opos
]
);
CVT_APPEND_CHAR
(
old
char
);
continue
;
continue
;
}
}
/*
/*
* From here we are guranteed to be in neither
* From here we are guranteed to be in neither
* an escape
nor
a quote nor a double quote.
* an escape
,
a quote nor a double quote.
*/
*/
/* Squeeze carriage-return/linefeed pairs to linefeed only */
else
if
(
oldchar
==
'\r'
&&
opos
+
1
<
oldstmtlen
&&
old_statement
[
opos
+
1
]
==
'\n'
)
continue
;
/*
/*
* Handle literals (date, time, timestamp) and ODBC scalar
* Handle literals (date, time, timestamp) and ODBC scalar
* functions
* functions
*/
*/
else
if
(
old
_statement
[
opos
]
==
'{'
)
else
if
(
old
char
==
'{'
)
{
{
char
*
esc
;
char
*
esc
;
char
*
begin
=
&
old_statement
[
opos
+
1
];
char
*
begin
=
&
old_statement
[
opos
+
1
];
...
@@ -1064,7 +1067,7 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -1064,7 +1067,7 @@ copy_statement_with_parameters(StatementClass *stmt)
else
else
{
/* it's not a valid literal so just copy */
{
/* it's not a valid literal so just copy */
*
end
=
'}'
;
*
end
=
'}'
;
CVT_APPEND_CHAR
(
old
_statement
[
opos
]
);
CVT_APPEND_CHAR
(
old
char
);
continue
;
continue
;
}
}
...
@@ -1078,15 +1081,15 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -1078,15 +1081,15 @@ copy_statement_with_parameters(StatementClass *stmt)
* so. All the queries I've seen expect the driver to put quotes
* so. All the queries I've seen expect the driver to put quotes
* if needed.
* if needed.
*/
*/
else
if
(
old
_statement
[
opos
]
==
'?'
)
else
if
(
old
char
==
'?'
)
;
/* ok */
;
/* ok */
else
else
{
{
if
(
old
_statement
[
opos
]
==
'\''
)
if
(
old
char
==
'\''
)
in_quote
=
TRUE
;
in_quote
=
TRUE
;
else
if
(
old
_statement
[
opos
]
==
'\\'
)
else
if
(
old
char
==
'\\'
)
in_escape
=
TRUE
;
in_escape
=
TRUE
;
else
if
(
old
_statement
[
opos
]
==
'\"'
)
else
if
(
old
char
==
'\"'
)
in_dquote
=
TRUE
;
in_dquote
=
TRUE
;
else
if
(
check_select_into
&&
/* select into check */
else
if
(
check_select_into
&&
/* select into check */
opos
>
0
&&
opos
>
0
&&
...
@@ -1097,7 +1100,7 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -1097,7 +1100,7 @@ copy_statement_with_parameters(StatementClass *stmt)
memmove
(
new_statement
,
new_statement
+
declare_pos
,
npos
-
declare_pos
);
memmove
(
new_statement
,
new_statement
+
declare_pos
,
npos
-
declare_pos
);
npos
-=
declare_pos
;
npos
-=
declare_pos
;
}
}
CVT_APPEND_CHAR
(
old
_statement
[
opos
]
);
CVT_APPEND_CHAR
(
old
char
);
continue
;
continue
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment