コード例 #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
     }
 }
コード例 #2
0
 public void CommitTransaction()
 {
     using (CurrentTransaction)
     {
         CurrentTransaction.Commit();
     }
 }
コード例 #3
0
ファイル: SapConnection.cs プロジェクト: zhusl/NSAPConnector
        /// <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);
        }
コード例 #4
0
 public void Commit()
 {
     if (CurrentTransaction != null)
     {
         CurrentTransaction.Commit();
         CurrentTransaction = null;
     }
 }
コード例 #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);
 }
コード例 #7
0
 public void Commit()
 {
     CurrentTransaction?.Commit();
     CurrentTransaction?.Dispose();
     if (CurrentConnection?.State == ConnectionState.Open)
     {
         CurrentConnection.Close();
     }
     CurrentConnection?.Dispose();
 }
コード例 #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);
 }
コード例 #9
0
ファイル: DatabaseConnector.cs プロジェクト: FallenAvatar/PIN
        public void CommitTransaction( )
        {
            if (CurrentTransaction == null)
            {
                throw new InvalidOperationException("Can not commit a transaction that has not been started.");
            }

            CurrentTransaction.Commit();
            CurrentTransaction = null;
        }
コード例 #10
0
ファイル: PDO.cs プロジェクト: tyty999/peachpie
        /// <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);
        }
コード例 #11
0
        public void Commit()
        {
            if (CurrentTransaction == null)
            {
                throw new InvalidOperationException();
            }

            lock (_transactionSyncRoot)
            {
                CurrentTransaction.Commit();
                CurrentTransaction.Dispose();
                CurrentTransaction = null;
            }
        }
コード例 #12
0
 /// <summary>
 /// 提交事务
 /// </summary>
 public void Commit()
 {
     if (IsEnabledTransaction)
     {
         try
         {
             CurrentTransaction.Commit();
         }
         catch (Exception ex)
         {
             _logger.LogError("事务提交异常");
             throw new Exception(ex.Message);
         }
     }
     HasCommitted = true;
 }
コード例 #13
0
 public void Dispose()
 {
     if (CurrentDbConnection != null)
     {
         if (CurrentDbConnection.State != ConnectionState.Closed)
         {
             if (CurrentTransaction != null)
             {
                 CurrentTransaction.Commit();
             }
             CurrentDbConnection.Close();
         }
         CurrentDbConnection.Dispose();
         CurrentTransaction = null;
     }
 }
コード例 #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;
            }
        }
コード例 #15
0
 public override void Complete()
 {
     lock (_lock)
     {
         _db.SaveChanges();
         if (CurrentTransaction != null)
         {
             try
             {
                 CurrentTransaction.Commit();
             }
             catch (System.Exception)
             {
                 CurrentTransaction.Rollback();
             }
             finally
             {
                 CurrentTransaction.Dispose();
             }
         }
     }
 }
コード例 #16
0
 public void CommitTransaction() => CurrentTransaction.Commit();
コード例 #17
0
 public override void CommitTransaction() => CurrentTransaction.Commit();
コード例 #18
0
 public void CommitTransaction()
 {
     CurrentTransaction?.Commit();
 }