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