Page 1 of 1
Delphi 2010 - Firebird 2.1 - bug in TZSqlProcessor
Posted: 20.10.2011, 14:16
by PabloRomero
Hi fellas,
I have this instruction
Code: Select all
INSERT INTO MENU (CODIGOMENU, DESCRIPCION... )
VALUES
( 429, "CJhhewvGCUrUW3yGKc/aT00Y+fEYjBtdKGCsHYA4nSgt5uN/NdOPNdee0gyDKF34Tgy7AYWSFA" )
Using TZSqlProcessor, i get
Code: Select all
-- SQL Error: Dynamic SQL Error SQL error code = -206 Column unknown CJHHEWVGCURUW3YGKC At line 1, column 186. Error Code: -206.
Debugging, Parser method gave me this:
Code: Select all
INSERT INTO MENU (CODIGOMENU, DESCRIPCION ... )
VALUES
( 429, CJhhewvGCUrUW3yGKc/aT00Y+fEYjBtdKGCsHYA4nSgt5uN/NdOPNdee0gyDKF34Tgy7AYWSFA )
There are not " on the second field ( a compressed string data ). It seems that the "/" character or the "+" character confuse the parser and the quote character is dropped.
Any ideas? I try to fix it but...I'm a newbie using Zeos and this component is marvelous to work.
Regards
Pablo
Posted: 20.10.2011, 15:56
by PabloRomero
Luciano DeGiorgi, my coworker, suggested to me this change inside
the unit ZGenericSqlToken
the
Code: Select all
function TZGenericSQLQuoteState.NextToken(Stream: TStream;
FirstChar: Char; Tokenizer: TZTokenizer): TZToken;
becomes
Code: Select all
{ TZGenericSQLQuoteState }
{**
Return a quoted string token from a reader. This method
will collect characters until it sees a match to the
character that the tokenizer used to switch to this state.
@return a quoted string token from a reader
}
function TZGenericSQLQuoteState.NextToken(Stream: TStream;
FirstChar: Char; Tokenizer: TZTokenizer): TZToken;
var
ReadChar: Char;
ReadCharAnt : Char;
LastChar: Char;
CountFormat, CountDoublePoint,CountSlash : integer;
begin
Result.Value := FirstChar;
LastChar := #0;
CountDoublePoint := 0;
CountSlash := 0; CountFormat := 0;
ReadCharAnt := #0;
while Stream.Read(ReadChar, SizeOf(Char)) > 0 do
begin
if (LastChar = FirstChar) and (ReadChar <> FirstChar) then
begin
Stream.Seek(-SizeOf(Char), soFromCurrent);
Break;
end;
if ReadChar = TimeSeparator then
inc(CountDoublePoint);
if ReadChar = DateSeparator then
inc(CountSlash);
if (ReadCharAnt = '%') and (Pos( AnsiLowerCase(ReadChar), '/:0124356789abcdefhijklprstuvwxy') > 0) then
inc(CountFormat);
Result.Value := Result.Value + ReadChar;
if (LastChar = FirstChar) and (ReadChar = FirstChar) then
LastChar := #0
else LastChar := ReadChar;
ReadCharAnt := ReadChar;
end;
if FirstChar = '"' then
Result.TokenType := ttWord
else Result.TokenType := ttQuoted;
// Time constant
if (CountFormat <> 0) and (CountDoublePoint = 2) and (CountSlash = 0) then
begin
try
Result.Value := DecodeString(Result.Value,'"');
Result.TokenType := ttTime;
except
end;
end;
// Date constant
if (CountFormat <> 0) and (CountDoublePoint = 0) and (CountSlash = 2) then
begin
try
Result.Value := DecodeString(Result.Value,'"');
Result.TokenType := ttDate;
except
end;
end;
// DateTime constant
if (CountFormat <> 0) and (CountDoublePoint = 2) and (CountSlash = 2) then
begin
try
Result.Value := DecodeString(Result.Value,'"');
Result.TokenType := ttDateTime;
except
end;
end;
end;
This solved the problem and does not affect the issue that another post suggested with DATE_FORMAT, in this forum.
Regards
Luciano DeGiorgi
Pablo Romero
Flexxus S.A. - Cordoba, Argentina