IDASQLCommand用法(包含事务)

procedure DoLogout(const Session:TROSession; Connection:IDAConnection; ServerLog:TDAServerLog);
var
  Cmd : IDASQLCommand;
  CommandLog:TDASQLCommandLog;
  ErrorLog:TDASQLErrorLog;
begin
  if (LogoutCommand<>'')
    then Cmd := ServiceSchema.NewCommand(Connection, 'Logout', ['SessionID'],
                                         [GUIDToString(Session.SessionID)]);

  if Not Connection.InTransaction then
    Connection.BeginTransaction;
  try
    Cmd.Execute;
    Connection.CommitTransaction;

    CommandLog:=TDASQLCommandLog.Create(ServerLog, Session, Cmd, Cmd.SQL, 0);
  except
    on E:Exception do
    begin
      Connection.RollbackTransaction;

      ErrorLog:=TDASQLErrorLog.Create(ServerLog, Session, E, Cmd, Cmd.SQL);
    end;
  end;
end;

原文地址:https://www.cnblogs.com/leonkin/p/3208665.html