problem with procedure TZGenericCachedResolver.PostUpdates
Posted: 20.01.2012, 18:10
Hello !
problem with procedure TZGenericCachedResolver.PostUpdates
When i'm use an edit/post method and on the before post event an other edit/post
Sample
qy.Edit;
qy.FieldbyName('id').asInteger := Getid;
qy.post;
And the GetId method is
function getid:integer;
Var
qy : TZquery;
begin
qy := TZquery.Create(application);
qy.connection := Datamodule1.DATABASE;
qy.sql.text := 'select id from mytable where code="num" ';
qy.Open;
Result := qy.fieldbyName('id').asinteger + 1;
qy.edit
qy.fiedlbyname('id').asInteger := resut;
qy.post;
End;
In the procedure TZGenericCachedResolver.PostUpdates
...
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']); // modif O.B 21/01/2012 }
lUpdateCount := Statement.ExecuteUpdatePrepared;
if (lValidateUpdateCount)
and (lUpdateCount <> 1 ) then
raise EZSQLException.Create(Format(SInvalidUpdateCount, [lUpdateCount])); // modif O.B 21/01/2012}
end;
finally
SQLParams.Free;
end;
IN THAT CASE THE lUpdateCount = 2 do ERROR
Have you a similar problem?
Thank you for help
problem with procedure TZGenericCachedResolver.PostUpdates
When i'm use an edit/post method and on the before post event an other edit/post
Sample
qy.Edit;
qy.FieldbyName('id').asInteger := Getid;
qy.post;
And the GetId method is
function getid:integer;
Var
qy : TZquery;
begin
qy := TZquery.Create(application);
qy.connection := Datamodule1.DATABASE;
qy.sql.text := 'select id from mytable where code="num" ';
qy.Open;
Result := qy.fieldbyName('id').asinteger + 1;
qy.edit
qy.fiedlbyname('id').asInteger := resut;
qy.post;
End;
In the procedure TZGenericCachedResolver.PostUpdates
...
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']); // modif O.B 21/01/2012 }
lUpdateCount := Statement.ExecuteUpdatePrepared;
if (lValidateUpdateCount)
and (lUpdateCount <> 1 ) then
raise EZSQLException.Create(Format(SInvalidUpdateCount, [lUpdateCount])); // modif O.B 21/01/2012}
end;
finally
SQLParams.Free;
end;
IN THAT CASE THE lUpdateCount = 2 do ERROR
Have you a similar problem?
Thank you for help