예제 #1
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         UtlDataReader target = null;
         if (this._activeReader != null)
         {
             try
             {
                 target = this._activeReader.Target as UtlDataReader;
             }
             catch (InvalidOperationException)
             {
             }
         }
         if (target != null)
         {
             target.DisposeCommand = true;
             this._activeReader    = null;
         }
         else
         {
             this.Connection = null;
         }
     }
 }
예제 #2
0
        public UtlDataReader ExecuteReader(CommandBehavior behavior)
        {
            this.InitializeForReader();
            UtlDataReader target = new UtlDataReader(this, behavior);

            this._activeReader = new WeakReference(target, false);
            return(target);
        }
예제 #3
0
 public override int ExecuteNonQuery()
 {
     using (UtlDataReader reader = this.ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))
     {
         while (reader.NextResult())
         {
         }
         return(reader.RecordsAffected);
     }
 }
예제 #4
0
 public override object ExecuteScalar()
 {
     this.InitializeForReader();
     using (UtlDataReader reader = this.ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))
     {
         if (reader.Read())
         {
             return(reader[0]);
         }
     }
     return(null);
 }
예제 #5
0
 public void ClearCommands()
 {
     if (this._activeReader != null)
     {
         UtlDataReader target = null;
         try
         {
             target = this._activeReader.Target as UtlDataReader;
         }
         catch (InvalidOperationException)
         {
         }
         if (target != null)
         {
             target.Close();
         }
         this._activeReader = null;
     }
     if (this.Statement != null)
     {
         this.Statement.Dispose();
     }
     this.Statement = null;
 }