Problem with ZeosLib 8.00 Delphi Alexandria ZDbcCache
Posted: 02.12.2021, 22:01
Hello,
my code worked fine with Delphi 10.4 and ZeosLib 7.2.14 and Firebird 2.5. But I need ZeosLib for Delphi 11 and only found 8.00-beta. Maybe there is a stable version I didn't find?
In ZeosLib 8.00 I get a problem with ZDBcCache using this code which uses a prepared SQL-String, adds a where-clause and reopen the query:
The resulting sql is this if theFilter is 'JOHN':
The open of the query leads to an access violation in Unit ZDbcCache procedure TZRowAccessor.SetNull(ColumnIndex: Integer);
I use the same way of coding (take a prepared sql, close the query, add "where" to the sql and reopen it) with ZeosLib 8.0.0-beta for 5 other tables and it workes. Any Idea what goes wrong here?
Thanks for any hint to solve this problem.
Siegbert
my code worked fine with Delphi 10.4 and ZeosLib 7.2.14 and Firebird 2.5. But I need ZeosLib for Delphi 11 and only found 8.00-beta. Maybe there is a stable version I didn't find?
In ZeosLib 8.00 I get a problem with ZDBcCache using this code which uses a prepared SQL-String, adds a where-clause and reopen the query:
Code: Select all
with theDataset as TZQuery do
begin
Close;
SQL.Clear;
SQL.Add(ReaderSQL +
' where upper(coalesce(Barcode,'''') || coalesce(LastName,'''') ||coalesce(firstname,'''')||coalesce(username,'''')) like ''%' + theFilter + '%''');
open;
Code: Select all
select r.*,
(select cu.lastname from readers cu where cu.id = r.createuser) as CreateUserName,
(select uu.lastname from readers uu where uu.id = r.updateuser) as UpdateUserName,
left(cast(r.info as varchar(4000)),100) InfoAsString
from readers r
where upper(coalesce(Barcode,'') || coalesce(LastName,'') ||coalesce(firstname,'')||coalesce(username,'')) like '%JOHN%';
Code: Select all
procedure TZRowAccessor.SetNull(ColumnIndex: Integer);
var Data: PPointer;
begin
{$IFNDEF DISABLE_CHECKING}
CheckColumnIndex(ColumnIndex);
{$ENDIF}
{$R-}
if (FBuffer.Columns[FColumnOffsets[ColumnIndex{$IFNDEF GENERIC_INDEX} - 1{$ENDIF}]] = bIsNotNull) then begin <<-- Access violation in this line
Data := @FBuffer.Columns[FColumnOffsets[ColumnIndex{$IFNDEF GENERIC_INDEX} - 1{$ENDIF}] + 1];
FBuffer.Columns[FColumnOffsets[ColumnIndex{$IFNDEF GENERIC_INDEX} - 1{$ENDIF}]] := bIsNull;
{$IFDEF RangeCheckEnabled}{$R+}{$ENDIF}
case FColumnTypes[ColumnIndex{$IFNDEF GENERIC_INDEX} - 1{$ENDIF}] of
stAsciiStream, stBinaryStream, stUnicodeStream:
PIZLob(Data)^ := nil;
stBytes, stString, stUnicodeString:
if Data^ <> nil then begin
System.FreeMem(Data^);
Data^ := nil;
end;
{$IFDEF WITH_CASE_WARNING}else ;{$ENDIF}
end;
end;
end;
Thanks for any hint to solve this problem.
Siegbert