Page 1 of 1

Bug on TZSQLScriptParser.ParseText procedure

Posted: 14.09.2009, 18:07
by josimarz
Hello!

I founded a bug on ParseText method of TZSQLScriptParser class:

I founded a error where the lenght of delimiter of statement is less then the last token of the statement.

Example:

Code: Select all

SET GLOBAL log_bin_trust_function_creators = 1//
The method concat the delimiter ("//") with the token "1", because the lenght of token "1" is less then lenght of the delimiter "//".

Quick solutions:

Solution 1:

Separate the delimiter of the last token.

Code: Select all

SET GLOBAL log_bin_trust_function_creators = 1 //
Solution 2:

Concating the last token ("1") with equals symbol ("="), making that the last token equals or greater then lenght of the delimiter ("//").

Code: Select all

SET GLOBAL log_bin_trust_function_creators =1 //
Solution 3:

Use a delimiter with size 1:

Code: Select all

SET GLOBAL log_bin_trust_function_creators = 1&
How can I fix this bug ? There's any prevision of any release of zeos with this bug fix?

Thanks.

Posted: 22.09.2009, 23:43
by mdaems
josimarz,

Did you post a bug in the bug tracker for this? If you don't this post will go out of sight...

Mark

Posted: 23.09.2009, 15:10
by josimarz
Sorry!

I posted the bug on http://zeosbugs.firmos.at/

Thanks.

Posted: 24.09.2009, 11:52
by mdaems
Hi,

The patch below may fix your problem.
Can you please test and report?

Code: Select all

Index: ZScriptParser.pas
===================================================================
--- ZScriptParser.pas	(revision 684)
+++ ZScriptParser.pas	(working copy)
@@ -279,7 +279,8 @@
             begin
               Temp := TokenValue;
               Extract := True;
-              while (Length(Delimiter) > Length(Temp))
+              while (Delimiter[1]=Temp[1]) and
+                    (Length(Delimiter) > Length(Temp))
                 and not (TokenType in [ttWhitespace, ttEOF]) do
               begin
                 TokenValue := Tokens[TokenIndex];
Mark

Posted: 24.09.2009, 22:28
by mdaems
SVN Rev. 699 (testing branch)
I plan to backport this fix to 6.6-patches as well.

Mark

Posted: 28.09.2009, 15:21
by josimarz
Hello!

The first test that I executed was successfully.

Tested with this script:

Code: Select all

SET GLOBAL log_bin_trust_function_creators = 1// 
Tested with several scripts using the delimiters "/ /" and ";": Success!

Thanks!