:v: Firebird 2.1 , Zeos7dev, ZTable.Post error

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
SlavoF
Junior Boarder
Junior Boarder
Posts: 29
Joined: 12.02.2009, 15:31
Location: Nitra, Slovakia
Contact:

:v: Firebird 2.1 , Zeos7dev, ZTable.Post error

Post by SlavoF »

Hi,
ZEOSLIB_TESTING_REV617
D2009
Firebird 2.1
ZTable.Edit;
ZTable.FieldByName('x').Value := 1;
ZTable.Post;
ZTable.Edit;
ZTable.FieldByName('x').Value := 2; // if value changed -> OK
ZTable.Post;
ZTable.Edit;
ZTable.FieldByName('x').Value := 2; // if value is same -> error
ZTable.Post;
//---------------
ZTable.Edit;
ZTable.Post; // also error - "-104 Token unknown"
Last edited by SlavoF on 29.04.2009, 08:41, edited 1 time in total.
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Open ZDbcGenericResolver.pas and do this changes

procedure TZGenericCachedResolver.PostUpdates(Sender: IZCachedResultSet;
UpdateType: TZRowUpdateType; OldRowAccessor, NewRowAccessor: TZRowAccessor);
var
Statement : IZPreparedStatement;
SQL : string;
SQLParams : TObjectList;
lUpdateCount : Integer;
lValidateUpdateCount : Boolean;

Temp: TStrings;
begin
if (UpdateType = utDeleted)
and (OldRowAccessor.RowBuffer.UpdateType = utInserted) then
Exit;

SQLParams := TObjectList.Create;
try
case UpdateType of
utInserted:
begin
SQL := FormInsertStatement(SQLParams, NewRowAccessor);
If Assigned(InsertStatement) and (SQL <> InsertStatement.GetSQL) then
InsertStatement := nil;
If (not Assigned(InsertStatement)) and (Trim(SQL) <> '') then
InsertStatement := CreateResolverStatement(SQL);
If Assigned(InsertStatement) then
Statement := InsertStatement;
end;
utDeleted:
begin
SQL := FormDeleteStatement(SQLParams, OldRowAccessor);
If Assigned(DeleteStatement) and (SQL <> DeleteStatement.GetSQL) then
DeleteStatement := nil;
If (not Assigned(DeleteStatement)) and (Trim(SQL) <> '') then
DeleteStatement := CreateResolverStatement(SQL);
If Assigned(DeleteStatement) then
Statement := DeleteStatement;
end;
utModified:
begin
SQL := FormUpdateStatement(SQLParams, OldRowAccessor, NewRowAccessor);
If Assigned(UpdateStatement) and (SQL <> UpdateStatement.GetSQL) then
UpdateStatement := nil;
If (not Assigned(UpdateStatement)) and (Trim(SQL) <> '') then
UpdateStatement := CreateResolverStatement(SQL);
If Assigned(UpdateStatement) then
Statement := UpdateStatement;
end;
else
Exit;
end;

if SQL <> '' then
begin

FillStatement(Statement, SQLParams, OldRowAccessor, NewRowAccessor);
// if Property ValidateUpdateCount isn't set : assume it's true
lValidateUpdateCount := (Sender.GetStatement.GetParameters.IndexOfName('ValidateUpdateCount') = -1)
or StrToBoolEx(Sender.GetStatement.GetParameters.Values['ValidateUpdateCount']);

lUpdateCount := Statement.ExecuteUpdatePrepared;
if (lValidateUpdateCount)
and (lUpdateCount <> 1 ) then
raise EZSQLException.Create(Format(SInvalidUpdateCount, [lUpdateCount]));
end;
finally
SQLParams.Free;
end;
end;

It looks like when you do a
ZTable.Edit;
ZTable.Post;

variable SQL is equal to '' so CreateResolverStatement raise an error
because threre no insert/update/delete to do.
SlavoF
Junior Boarder
Junior Boarder
Posts: 29
Joined: 12.02.2009, 15:31
Location: Nitra, Slovakia
Contact:

Post by SlavoF »

yes,
resolved
:thanks:
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

SVN rev. 631.
(Attention, when marking a thread as [bug_fixed] I usually think nothing should be done anymore)

Mark
Image
Locked