Tokenizer EConvertError - DateTime

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
thcom
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 29.06.2007, 12:51

Tokenizer EConvertError - DateTime

Post by thcom »

hi, i am using Delphi 7 lite on Windows 7 with MySQL 5.1.41

when i use SQL statement like this DATE_FORMAT(test,"%H:%i:%s") AS test

i get error EConvertError in IDE, in runtime is it OK

i try to debug this strange thing, and i found ZGenericSqlToken.pas

there is a method TZGenericSQLQuoteState.NextToken, which decodes part of SQL which contains two semicolons as a date, but in my case it is "%H:%i:%s" string decoded as a date and the conversion produces this error

can u help me, with this strange behaviour ??

i attach D7 example with sql dump
but enough is open a query whch contains DATE_FORMAT with format string containing 2 semicolons

thx Tomas, Prague
You do not have the required permissions to view the files attached to this post.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Hi, at the moment I can't test, but Can you try changing DateSeparator to - and TimeSeparator to : (on ZGenericSqlToken.pas) ?

If it works correctly the problem is related to the way ZMySQLToken.pas set those functions
thcom
Fresh Boarder
Fresh Boarder
Posts: 7
Joined: 29.06.2007, 12:51

Post by thcom »

hi, sorry for late answer, i try to change date and time separator, i use 'x' character, because we in czech republic use ':' as time separator and '.' as date separator.

my application is now working properly, but i have strange feeling ...
should i leave this hack in zeos source ?

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

Post by mdaems »

What about changing the tokenizer so that it only interprete strings containing double '/' and/or double ':' as date/time when there are no other characters than numbers and spaces involved? Maybe that won't cover all valid date/time strings? But changing the rule to 'only 0 or 2 numbers allowed between // and ::' would already be a much stronger test than we have now.

Do you feel like making this work?

Please post your changes to TZGenericSQLQuoteState.NextToken here so we can add this to the zeoslib source code.

Mark
Image
Locked