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.
[ZeosLIB 7 + FB2.1] Error -104 Invalid Token [RESOLVED]
Moderators: gto, cipto_kh, EgonHugeist
[ZeosLIB 7 + FB2.1] Error -104 Invalid Token [RESOLVED]
Last edited by boreas on 29.08.2011, 10:43, edited 1 time in total.
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
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