/// <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 } }
public void CommitTransaction() { using (CurrentTransaction) { CurrentTransaction.Commit(); } }
/// <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); }
public void Commit() { if (CurrentTransaction != null) { CurrentTransaction.Commit(); CurrentTransaction = null; } }
/// <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); }
public void Commit() { CurrentTransaction?.Commit(); CurrentTransaction?.Dispose(); if (CurrentConnection?.State == ConnectionState.Open) { CurrentConnection.Close(); } CurrentConnection?.Dispose(); }
/// <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); }
public void CommitTransaction( ) { if (CurrentTransaction == null) { throw new InvalidOperationException("Can not commit a transaction that has not been started."); } CurrentTransaction.Commit(); CurrentTransaction = null; }
/// <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); }
public void Commit() { if (CurrentTransaction == null) { throw new InvalidOperationException(); } lock (_transactionSyncRoot) { CurrentTransaction.Commit(); CurrentTransaction.Dispose(); CurrentTransaction = null; } }
/// <summary> /// 提交事务 /// </summary> public void Commit() { if (IsEnabledTransaction) { try { CurrentTransaction.Commit(); } catch (Exception ex) { _logger.LogError("事务提交异常"); throw new Exception(ex.Message); } } HasCommitted = true; }
public void Dispose() { if (CurrentDbConnection != null) { if (CurrentDbConnection.State != ConnectionState.Closed) { if (CurrentTransaction != null) { CurrentTransaction.Commit(); } CurrentDbConnection.Close(); } CurrentDbConnection.Dispose(); CurrentTransaction = null; } }
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; } }
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();
public override void CommitTransaction() => CurrentTransaction.Commit();
public void CommitTransaction() { CurrentTransaction?.Commit(); }