//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace CommonHelpers {

//**************************************************************************************************
/// <summary>
/// </summary>
public static partial class HSqlCommandDispose {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static SqlDataReader ExecuteReader( [HRequired] ref SqlCommand? command )
{
   HArgChecking.VerifyNotNull( command );
   return ExecuteReader( ref command, CommandBehavior.Default );
}

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static SqlDataReader ExecuteReader( [HRequired] ref SqlCommand? command,
                                           [HOptional] CommandBehavior behaviour )
{
   HArgChecking.VerifyNotNull( command );
   using (var cmd = HOps.NullExchange(ref command).NN())
      return cmd.ExecuteReader( behaviour );
}

//==================================================================================================

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static int ExecuteNonQuery( [HRequired] ref SqlCommand? command )
{
   HArgChecking.VerifyNotNull( command );
   using (var cmd = HOps.NullExchange(ref command).NN())
      return cmd.ExecuteNonQuery();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HSqlCommandDispose
//**************************************************************************************************

} // CommonHelpers
