Delphi 2010 with Firebird 2.1: new bug in TZSqlProcessor

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
PabloRomero
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.10.2011, 14:04

Delphi 2010 with Firebird 2.1: new bug in TZSqlProcessor

Post 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
PabloRomero
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 20.10.2011, 14:04

Solution

Post 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;

papelhigienico
Expert Boarder
Expert Boarder
Posts: 113
Joined: 06.10.2006, 14:41
Location: Chapecó - Santa Catarina
Contact:

Post by papelhigienico »

Can you make a patch?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Even more important : what's the reason for the patch when the problem was the database dialect?
Image
Locked