Beispiel #1
0
 /// <summary>
 /// méthode  utilisée principalement pour des opérations de type UPDATE, INSERT, DELETE
 /// </summary>
 /// <param name="sqlCommand">Chaine SQL à exécuter</param>
 /// <returns>Nombre d'enregistrements traités</returns>
 public int ExecuteNonQuery(string sqlCommand)
 {
     try
     {
         int returnValue;
         OpenDBCnx();                                        // on ouvre une connexion a la base de donné
         OleDbCommand Command = Connexion.CreateCommand();   // on crée une nouvelle commande
         CurrentTransaction  = Connexion.BeginTransaction(); //
         Command.Connection  = Connexion;                    // on assoucie une commande a une connexion
         Command.Transaction = CurrentTransaction;
         Command.CommandType = CommandType.Text;             // on defenit le type de la commande a executer
         Command.CommandText = sqlCommand;                   //chaine sql a executer
         returnValue         = Command.ExecuteNonQuery();    // executer la requette
         CurrentTransaction.Commit();
         return(returnValue);                                //nombre d'enregistrements traités
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);// on genere un message d'echec en cas d'erreur
     }
     finally
     {
         CloseDbCnx();// on ferme la connection
     }
 }
Beispiel #2
0
 public void CommitTransaction()
 {
     using (CurrentTransaction)
     {
         CurrentTransaction.Commit();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Commit/Rollback existing transaction.
        /// Unregister current destination configuration.
        /// </summary>
        public void Dispose()
        {
            if (_destinationConfiguration != null)
            {
                if (CurrentTransaction != null)
                {
                    try
                    {
                        CurrentTransaction.Commit();

                        CurrentTransaction = null;
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceError(
                            "An error occurred when trying to commit current open transaction. Exception: {0}", ex);
                    }
                }

                try
                {
                    RfcDestinationManager.UnregisterDestinationConfiguration(_destinationConfiguration);
                }
                catch (Exception ex)
                {
                    Trace.TraceError("An error occurred when trying to unregister destination configuration. Exception: {0}", ex);
                }
            }

            GC.SuppressFinalize(this);
        }
Beispiel #4
0
 public void Commit()
 {
     if (CurrentTransaction != null)
     {
         CurrentTransaction.Commit();
         CurrentTransaction = null;
     }
 }
Beispiel #5
0
        /// <summary>
        ///     Commits all changes made to the database in the current transaction.
        /// </summary>
        public virtual void CommitTransaction()
        {
            if (CurrentTransaction == null)
            {
                throw new InvalidOperationException(RelationalStrings.NoActiveTransaction);
            }

            CurrentTransaction.Commit();
        }
 protected override Task Commit()
 {
     if (CurrentTransaction is object)
     {
         CurrentTransaction.Commit();
         _committed = true;
     }
     return(Task.CompletedTask);
 }
Beispiel #7
0
 public void Commit()
 {
     CurrentTransaction?.Commit();
     CurrentTransaction?.Dispose();
     if (CurrentConnection?.State == ConnectionState.Open)
     {
         CurrentConnection.Close();
     }
     CurrentConnection?.Dispose();
 }
Beispiel #8
0
 /// <summary>
 /// Commits a transaction
 /// </summary>
 /// <returns></returns>
 public virtual bool commit()
 {
     if (CurrentTransaction == null)
     {
         throw new PDOException("No active transaction");
     }
     CurrentTransaction.Commit();
     CurrentTransaction = null;
     return(true);
 }
Beispiel #9
0
        public void CommitTransaction( )
        {
            if (CurrentTransaction == null)
            {
                throw new InvalidOperationException("Can not commit a transaction that has not been started.");
            }

            CurrentTransaction.Commit();
            CurrentTransaction = null;
        }
Beispiel #10
0
        /// <summary>
        /// Commits a transaction
        /// </summary>
        /// <returns></returns>
        public virtual bool commit()
        {
            if (CurrentTransaction == null)
            {
                HandleError("No active transaction");
                return(false);
            }

            CurrentTransaction.Commit();
            CurrentTransaction = null;
            return(true);
        }
Beispiel #11
0
        public void Commit()
        {
            if (CurrentTransaction == null)
            {
                throw new InvalidOperationException();
            }

            lock (_transactionSyncRoot)
            {
                CurrentTransaction.Commit();
                CurrentTransaction.Dispose();
                CurrentTransaction = null;
            }
        }
Beispiel #12
0
 /// <summary>
 /// 提交事务
 /// </summary>
 public void Commit()
 {
     if (IsEnabledTransaction)
     {
         try
         {
             CurrentTransaction.Commit();
         }
         catch (Exception ex)
         {
             _logger.LogError("事务提交异常");
             throw new Exception(ex.Message);
         }
     }
     HasCommitted = true;
 }
Beispiel #13
0
 public void Dispose()
 {
     if (CurrentDbConnection != null)
     {
         if (CurrentDbConnection.State != ConnectionState.Closed)
         {
             if (CurrentTransaction != null)
             {
                 CurrentTransaction.Commit();
             }
             CurrentDbConnection.Close();
         }
         CurrentDbConnection.Dispose();
         CurrentTransaction = null;
     }
 }
Beispiel #14
0
        public void CommitTransaction()
        {
            if (!HasOpenTransation())
            {
                throw new Exception("Não existe transação aberta");
            }

            try
            {
                CurrentSession.Flush();
                CurrentTransaction.Commit();
            }
            catch (HibernateException)
            {
                RollbackTransaction();
                throw;
            }
            finally
            {
                CurrentTransaction = null;
            }
        }
Beispiel #15
0
 public override void Complete()
 {
     lock (_lock)
     {
         _db.SaveChanges();
         if (CurrentTransaction != null)
         {
             try
             {
                 CurrentTransaction.Commit();
             }
             catch (System.Exception)
             {
                 CurrentTransaction.Rollback();
             }
             finally
             {
                 CurrentTransaction.Dispose();
             }
         }
     }
 }
 public void CommitTransaction() => CurrentTransaction.Commit();
Beispiel #17
0
 public override void CommitTransaction() => CurrentTransaction.Commit();
 public void CommitTransaction()
 {
     CurrentTransaction?.Commit();
 }