TZQuery and line comments

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
krzynio8
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 30.03.2014, 10:56

TZQuery and line comments

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: TZQuery and line comments

Post by EgonHugeist »

Hi,

could you attach a example, please?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: TZQuery and line comments

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: TZQuery and line comments

Post 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?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: TZQuery and line comments

Post by miab3 »

@Michael,

For example for Firebird
these two lines:

Code: Select all

-- Comment
select * from table
causes an error.

Michal
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: TZQuery and line comments

Post by EgonHugeist »

Should work now.
Patch done R3348 \testing-7.2 (SVN)
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: TZQuery and line comments

Post by miab3 »

@EgonHugeist ,

Bravo, you fixed!

Michal
Post Reply