[patch_done] Patch for TZMySQLCachedResolver

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
Ostfriese
Junior Boarder
Junior Boarder
Posts: 25
Joined: 12.05.2009, 10:48
Location: Coburg
Contact:

[patch_done] Patch for TZMySQLCachedResolver

Post 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;
Thomas Jefferson wrote:Information ist die Währung der Demokratie
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Commit to 6.6-patches. SVN rev 647.

Mark
Image
Post Reply