Page 1 of 1

[patch_done] Patch for TZMySQLCachedResolver

Posted: 15.05.2009, 13:06
by Ostfriese
I've removed two compiler hints for TZMySQLCachedResolver by modifying

Code: Select all

procedure TZMySQLCachedResolver.UpdateAutoIncrementFields(
  Sender: IZCachedResultSet; UpdateType: TZRowUpdateType; OldRowAccessor,
  NewRowAccessor: TZRowAccessor; Resolver: IZCachedResolver);
var
  Statement: IZStatement;
  ResultSet: IZResultSet;
  Plaindriver : IZMysqlPlainDriver;
begin
  inherited UpdateAutoIncrementFields(Sender, UpdateType, OldRowAccessor, NewRowAccessor, Resolver);
  if not ((FAutoColumnIndex > 0) and
          (OldRowAccessor.IsNull(FAutoColumnIndex) or (OldRowAccessor.GetValue(FAutoColumnIndex).VInteger=0))) then
     exit;
  Plaindriver := (Connection as IZMysqlConnection).GetPlainDriver;
  NewRowAccessor.SetLong(FAutoColumnIndex, PlainDriver.GetLastInsertID(FHandle));
{  Statement := Connection.CreateStatement;
  ResultSet := Statement.ExecuteQuery('SELECT LAST_INSERT_ID()');
  try
    if ResultSet.Next then
      NewRowAccessor.SetLong(FAutoColumnIndex, ResultSet.GetLong(1));
  finally
    ResultSet.Close;
    Statement.Close;
  end;
}
end;
to

Code: Select all

procedure TZMySQLCachedResolver.UpdateAutoIncrementFields(
  Sender: IZCachedResultSet; UpdateType: TZRowUpdateType; OldRowAccessor,
  NewRowAccessor: TZRowAccessor; Resolver: IZCachedResolver);
var
  //HA 090515 remove unused variables ..
  //Statement: IZStatement;
  //ResultSet: IZResultSet;
  //..
  Plaindriver : IZMysqlPlainDriver;
begin
  inherited UpdateAutoIncrementFields(Sender, UpdateType, OldRowAccessor, NewRowAccessor, Resolver);
  if not ((FAutoColumnIndex > 0) and
          (OldRowAccessor.IsNull(FAutoColumnIndex) or (OldRowAccessor.GetValue(FAutoColumnIndex).VInteger=0))) then
     exit;
  Plaindriver := (Connection as IZMysqlConnection).GetPlainDriver;
  NewRowAccessor.SetLong(FAutoColumnIndex, PlainDriver.GetLastInsertID(FHandle));
{  Statement := Connection.CreateStatement;
  ResultSet := Statement.ExecuteQuery('SELECT LAST_INSERT_ID()');
  try
    if ResultSet.Next then
      NewRowAccessor.SetLong(FAutoColumnIndex, ResultSet.GetLong(1));
  finally
    ResultSet.Close;
    Statement.Close;
  end;
}
end;

Posted: 20.05.2009, 21:52
by mdaems
Commit to 6.6-patches. SVN rev 647.

Mark