Script without end delimiter

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply

Should statements not ending in a delimiter at the end of a script be executed by a TZSqlProcessor or not?

Poll ended at 23.04.2006, 14:03

Yes (Execute)
5
83%
No (Ignore statement)
1
17%
 
Total votes: 6

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Script without end delimiter

Post by mdaems »

Hi,

I have a little design question. If I feed a query without end delimiter to a TZSQLprocessor it does not execute this query. That's because when he parses the string the StementCount is 0.

So this code does nothing :

Code: Select all

    Updater.Clear;
    Updater.Script.Append('Update Cfg set id=1 where id = 1');
    Updater.Execute;
You may say, 'set id=1 where id = 1' does nothing. Well, in my opinion at least it should send an update statement to the server. (I do that to check whether the user has update rights.)

Another possible remark is : 'You're lazy... Just put a delimiter.' That's also right. But you can debug quite a time as there's no error but no result.

So I have a poll : Should statements not ending in a delimiter at the end of a script be executed by a TZSqlProcessor or not?
Last edited by mdaems on 10.04.2006, 11:57, edited 1 time in total.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

In the example did you mean to leave out the ; ? Otherwise I don't understand the question.

Ben
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

:oopsp: Of course Ben.
Copied my fixed code after I'd found the problem. And forgot to remove the semicolon in the question. Edited the question.
BTW. If everybody says change I will give it a try myself and send the patch.

Sorry.
Mark
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

I'm not sure if it should execute or raise an error. Either way it shouldn't just ignore. I'll vote for Execute :-)

Ben
TonyG
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 01.04.2006, 13:39

Post by TonyG »

I've voted 'No (Ignore statement)' because I think that it should raise an error better than execute the script.

Well, It's just my opinion.
Post Reply