Exemple #1
0
 public override object ExecuteScalar()
 {
     if (this._transaction != null)
     {
         this._transaction.BeginCommand(this);
         // The transaction should already have the transaction lock
         object result = InnerCommand.ExecuteScalar();
         this._transaction.EndCommand();
         return result;
     }
     else
     {
         // Take the transaction lock for the duration of this command
         using (var txnlock = new SQLiteTxnLockED())
         {
             txnlock.Open();
             txnlock.BeginCommand(this);
             object result = InnerCommand.ExecuteScalar();
             txnlock.EndCommand();
             return result;
         }
     }
 }
Exemple #2
0
 protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
 {
     if (this._transaction != null)
     {
         // The transaction should already have the transaction lock
         return new SQLiteDataReaderED(this.InnerCommand, behavior, txn: this._transaction);
     }
     else
     {
         // Take the transaction lock for the duration of this command
         using (var txnlock = new SQLiteTxnLockED())
         {
             txnlock.Open();
             return new SQLiteDataReaderED(this.InnerCommand, behavior, txnlock: txnlock);
         }
     }
 }
 public DbTransaction BeginTransaction()
 {
     // Take the transaction lock before beginning the
     // transaction to avoid a deadlock
     var txnlock = new SQLiteTxnLockED();
     txnlock.Open();
     return new SQLiteTransactionED(_cn.BeginTransaction(), txnlock);
 }