Bug on TZSQLScriptParser.ParseText procedure

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Bug on TZSQLScriptParser.ParseText procedure

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Post by josimarz »

Sorry!

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

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

Post 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
Image
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

SVN Rev. 699 (testing branch)
I plan to backport this fix to 6.6-patches as well.

Mark
Image
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Post 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!
Post Reply