//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// DataHelpers.SQL satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using u = user_rtx;

namespace DataHelpers.SQL {

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static SqlDataReader ExecuteReader( [u.req] ref SqlCommand? command )
{
   u.arg_check.NN( command, nameof(command) );
   return ExecuteReader( ref command, CommandBehavior.Default );
}

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static SqlDataReader ExecuteReader( [u.req][u.reset_dispose] ref SqlCommand? command,
                                           [u.opt] CommandBehavior behaviour )
{
   u.arg_check.NN( command, nameof(command) );
   using ( var cmd = u.ops.NullExchange( ref command ).NN() )
      return cmd.ExecuteReader( behaviour );
}

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

/// <exception cref="ArgumentNullException" />
/// <exception cref="ObjectDisposedException" />
public static int ExecuteNonQuery( [u.req][u.reset_dispose] ref SqlCommand? command )
{
   u.arg_check.NN( command, nameof(command) );
   using ( var cmd = u.ops.NullExchange( ref command ).NN() )
      return cmd.ExecuteNonQuery();
}

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

} // DataHelpers.SQL
