Page 1 of 1
Delphi 2010 with Firebird 2.1: new bug in TZSqlProcessor
Posted: 14.11.2011, 21:22
by PabloRomero
-- SQL Error: Dynamic SQL Error SQL error code = -206 Column unknown I1HyzRwgIcLIoozFpmslqloFuE23G5vABtQnow7nFDgK8PdmcQ/igLB At line 1, column 173. Error Code: -206. Column does not belong to referenced table
The SQL: INSERT INTO MENU (CODIGOMENU, DESCRIPCION, ..) VALUES ( 389, "I1HyzRwgIcLIoozFpmslqloFuE23G5vABtQnow7nFDgK8PdmcQ/igLB" )
It seems that strings containing the / character, confuses the parser. The string is returned without the '"'.
Any Ideas?
Regards
Solution
Posted: 15.11.2011, 15:36
by PabloRomero
The problem was solved setting the db dialect on 1. I was using dialect 3 on a DB dialect 1. This must be done on TZConnection, "properties".
Dialect=1
The error WAS NOT in the parser, although, i used this modified section on the ZGenericSqlToken unit.
Code: Select all
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 = '"' ) or (FirstChar = #39) 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;
Posted: 15.11.2011, 16:22
by papelhigienico
Can you make a patch?
Posted: 17.12.2011, 20:51
by mdaems
Even more important : what's the reason for the patch when the problem was the database dialect?