You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the text of the SQL query executed in the execute statement contains comments "-", then starting with the "-" characters, all text is ignored to the end.
For example:
create or alter procedure STMT_ERR
returns (
LEN integer,
NAME varchar(100))
as
declare variable SQL blob;
begin
SQL =
'select RDB$FIELD_LENGTH, RDB$FIELD_NAME
from RDB$FIELDS
where not RDB$FIELD_NAME is null
-- comment
and RDB$FIELD_LENGTH > 2
order by RDB$FIELD_LENGTH
';
for
execute statement ( :SQL )
into :LEN, :NAME
do
suspend;
end
a) when EXEC STMT get SQL query text from binary BLOB variable (as in this test case), engine uses special blob filter to convert binary blob to text (filter_text).
I don't know why, but this blob filter uses \n (new-line) as segment boundary and *removes* it from output !
Thus EXEC STMT got SQL query text with plain \r as line endings (if there was \r\n stored at blob - as in this case)
Correspondingly, there is a simple workaround - use BLOB SUB_TYPE TEXT (or VARCHAR) for SQL text.
b) EXEC STMT preprocessor doesn't handle \r as end of line, thus it can't find end of single-line comment
c) same problem exists at DSQL lexer - it also can't handle plain \r as end of line
I going to fix both (b) and (c) but not going to change blob filter at (a)
Submitted by: Polesov (polesov)
If the text of the SQL query executed in the execute statement contains comments "-", then starting with the "-" characters, all text is ignored to the end.
For example:
create or alter procedure STMT_ERR
returns (
LEN integer,
NAME varchar(100))
as
declare variable SQL blob;
begin
SQL =
'select RDB$FIELD_LENGTH, RDB$FIELD_NAME
from RDB$FIELDS
where not RDB$FIELD_NAME is null
-- comment
and RDB$FIELD_LENGTH > 2
order by RDB$FIELD_LENGTH
';
for
execute statement ( :SQL )
into :LEN, :NAME
do
suspend;
end
Commits: a9b8442
The text was updated successfully, but these errors were encountered: