[ZeosLIB 7 + FB2.1] Error -104 Invalid Token [RESOLVED]

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
boreas
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 29.08.2011, 10:21

[ZeosLIB 7 + FB2.1] Error -104 Invalid Token [RESOLVED]

Post by boreas »

Hi, I'm sorry for my English is very bad.
While you can easily insert and delete operations to the database I use is easy, when I post after edit "Error Code -104 Invalid Token" error message, and it has been doing for all tables.
Last edited by boreas on 29.08.2011, 10:43, edited 1 time in total.
boreas
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 29.08.2011, 10:21

Post by boreas »

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.

http://zeos.firmos.at/viewtopic.php?t=2 ... alid+token
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

What zeoslib version were you using? Was it a snapshot or the very first alpha of 7.0?
The snapshots should be fixed already.

Mark

Mark
Image
Post Reply