Page 1 of 1
TZQuery and line comments
Posted: 02.07.2014, 06:55
by krzynio8
Hello!
To make my queries stored in TZQuery or loaded runtime from text files more understandable in the future I leave comments in them.
Comment /* */ works fine, but two minuses -- for commenting to end of line seems to be not working.
Especially when parameters with colon : are included in the query.
Can you look at this and fix it in any future version, please.
Best regards,
Krzysztof
Re: TZQuery and line comments
Posted: 02.08.2014, 17:02
by EgonHugeist
Hi,
could you attach a example, please?
Re: TZQuery and line comments
Posted: 06.08.2014, 20:15
by marsupilami
Hello Michael,
I had similar issues with one of my programs. It is like this:
Code: Select all
/* This comment is no problem */
insert into testtable (Nr, Name) values (1, 'Test'); -- this comment will give a problem. It is introduced by two dashes and extends until the end of the line
insert into testtable (Nr, Name) values (2, 'Test'); /* whereas this kind of commenting works without problems */
-- this comment will also give a problem
Zeos will accept the comments of style /* */ but not the ones introduced by dashes (--). Also it will pass these comments on to the DBMS but remove the line breaks before doing so. At least for Firebird. That in turn will make the RDBMS very unhappy...
Best regards,
Jan
Re: TZQuery and line comments
Posted: 18.08.2014, 10:29
by EgonHugeist
Jan,
did test your example with current 7.2 (SVN)
All issues i could see are the multiple stmts to execute.
Code: Select all
procedure ZTestCompCoreBugReport.TestLineComments;
var
Query: TZQuery;
Executed: Boolean;
begin
if SkipForReason(srClosedBug) then Exit;
Query := CreateQuery;
try
Query.SQL.Add('/* This comment is no problem */');
Query.SQL.Add('insert into string_values (s_id, s_varchar) values (100000, ''TestLineComment''); -- whereas this kind of commenting works without problems');
Query.SQL.Add('-- this comment will also give a problem');
Query.ExecSQL;
Executed := True;
finally
Query.SQL.Text := 'delete from string_values where s_id = 100000';
Query.ExecSQL;
Query.Free;
end;
Check(Executed, 'Executed with line comments successfully');
end;
Am i doing something wrong here?
Re: TZQuery and line comments
Posted: 18.08.2014, 11:11
by miab3
@Michael,
For example for Firebird
these two lines:
causes an error.
Michal
Re: TZQuery and line comments
Posted: 27.09.2014, 14:28
by EgonHugeist
Should work now.
Patch done R3348 \testing-7.2 (SVN)
Re: TZQuery and line comments
Posted: 27.09.2014, 16:01
by miab3
@EgonHugeist ,
Bravo, you fixed!
Michal