Hi,
I have a lot of troubles while working with TZQuery objects that use tables with names that start with a number, ie. 01TabName.
Trying to debug the code I noticed that a query like:
"SELECT * FROM 01TabName"
gets tokenized wrongly and the table name becomes only "TabName", leaving "01" as an independent token.
That's because TZNumberState.NextToken gets called while tokenizing the table name.
Actually I'm using 'ado' on a MsAccess db on the 'testing' branch but I suppose this is db independent. The problems I have is that I cannot update any field because they are ReadOnly by default. From what I understand this is due to the fact that zeos cannot build updates because it hasn't the correct table name.
Thanks,
Frank
[patch_done] Possible bug with ZTokenizer and table names
Moderators: gto, cipto_kh, EgonHugeist, mdaems
I did some hacking and made a patch to TZTokenizer.TokenizeStreamToList that joins two tokens if the first is a ttInteger and the next a ttWord. I'm testing it and it looks like it works in my environment.
Thanks,
Frank
Code: Select all
Index: ZTokenizer.pas
===================================================================
--- ZTokenizer.pas (revisione 384)
+++ ZTokenizer.pas (copia locale)
@@ -1317,6 +1317,11 @@
and (toUnifyNumbers in Options) then
Token.TokenType := ttNumber;
{ Add a read token. }
+ if ((Token.TokenType = ttWord)and(LastTokenType = ttInteger)) then
+ begin
+ Token.Value := Result[Result.Count-1] + Token.Value;
+ Result.Delete(Result.Count-1);
+ end;
LastTokenType := Token.TokenType;
Result.AddObject(Token.Value, TObject(Ord(Token.TokenType)));
end
Frank