Page 1 of 1

Script without end delimiter

Posted: 09.04.2006, 14:03
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?

Posted: 10.04.2006, 10:15
by btrewern
In the example did you mean to leave out the ; ? Otherwise I don't understand the question.

Ben

Posted: 10.04.2006, 11:56
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

Posted: 10.04.2006, 14:30
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

Posted: 11.04.2006, 16:46
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.