Page 1 of 1

[patch_done] cvs-26.09 : small bug in TZSQLProcessor

Posted: 04.10.2005, 14:00
by swierzbicki
Hi,

Take this exemple :

[syntax="sql"]DROP TEMPORARY TABLE IF EXISTS tmp_rates;
CREATE TEMPORARY TABLE tmp_rates
SELECT * From rates;

DROP TEMPORARY TABLE IF EXISTS tmp_rates2;
CREATE TEMPORARY TABLE tmp_rates2
SELECT * From rates2;

Update tmp_rates,tmp_rates2
Set tmp_rates.rate = tmp_rates2.rate
Where tmp_rates.id = tmp_rates2.id[/syntax]

The lastest Statement wont be executed : the ";" is mising at the end of the statement.It should be

[syntax="sql"]Update tmp_rates,tmp_rates2
Set tmp_rates.rate = tmp_rates2.rate
Where tmp_rates.id = tmp_rates2.id;[/syntax]

Without the ";" StatementCount return 4 instead of 5.

Quick and dirty solution :

Edit the procedure TZSQLScriptParser.ParseText(Text: string);


[syntax="delphi"]if Tokenizer = nil then
raise Exception.Create(STokenizerIsNotDefined);

//Check if the last caracter is a delimiter. If not, we add it.
if Text[length(Text)] <> Delimiter then
Text:=Text+Delimiter;


if CleanupStatements then
Tokens := Tokenizer.TokenizeBufferToList(Text, [toSkipComments])
else Tokens := Tokenizer.TokenizeBufferToList(Text, []);
[/syntax]

[edit="Michael"]Moved to forum "User Patches" and changed Syntax Highlighting [/edit]

Posted: 08.08.2008, 12:26
by mdaems
Should be fixed in 6.6.3 by fixing Mantis bug 48.
SVN revision 276

Mark