//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// 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 {

partial class HSqlParam {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static SqlParameter In( string paramName, SqlDbType dbType, object value ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Direction = ParameterDirection.Input,
      IsNullable = false,
      Value = value };

public static SqlParameter Out( string paramName, SqlDbType dbType ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Direction = ParameterDirection.Output,
      IsNullable = false };

public static SqlParameter InOut( string paramName, SqlDbType dbType, object value ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Direction = ParameterDirection.InputOutput,
      IsNullable = false,
      Value = value };

public static SqlParameter RetValue( SqlDbType dbType ) =>
   new SqlParameter(){
      SqlDbType = dbType,
      Direction = ParameterDirection.ReturnValue,
      IsNullable = false };

//--------------------------------------------------------------------------------------------------

public static SqlParameter In( string paramName, SqlDbType dbType, int size, object value ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Size = size,
      Direction = ParameterDirection.Input,
      IsNullable = false,
      Value = value };

public static SqlParameter Out( string paramName, SqlDbType dbType, int size ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Size = size,
      Direction = ParameterDirection.Output,
      IsNullable = false };

public static SqlParameter InOut( string paramName, SqlDbType dbType, int size, object value ) =>
   new SqlParameter(){
      ParameterName = paramName,
      SqlDbType = dbType,
      Size = size,
      Direction = ParameterDirection.InputOutput,
      IsNullable = false,
      Value = value };

public static SqlParameter RetValue( SqlDbType dbType, int size ) =>
   new SqlParameter(){
      SqlDbType = dbType,
      Size = size,
      Direction = ParameterDirection.ReturnValue,
      IsNullable = false };

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

public static SqlParameter AddIn( SqlCommand command, string paramName,
                                  SqlDbType dbType, object value ) =>
   command.Parameters.Add( In( paramName, dbType, value ) );

public static SqlParameter AddOut( SqlCommand command, string paramName, SqlDbType dbType ) =>
   command.Parameters.Add( Out( paramName, dbType ) );

public static SqlParameter AddInOut( SqlCommand command, string paramName,
                                     SqlDbType dbType, object value ) =>
   command.Parameters.Add( InOut( paramName, dbType, value ) );

public static SqlParameter AddRetValue( SqlCommand command, SqlDbType dbType ) =>
   command.Parameters.Add( RetValue( dbType ) );

//--------------------------------------------------------------------------------------------------

public static SqlParameter AddIn( SqlCommand command, string paramName,
                                  SqlDbType dbType, int size, object value ) =>
   command.Parameters.Add( In( paramName, dbType, size, value ) );

public static SqlParameter AddOut( SqlCommand command, string paramName,
                                   SqlDbType dbType, int size ) =>
   command.Parameters.Add( Out( paramName, dbType, size ) );

public static SqlParameter AddInOut( SqlCommand command, string paramName,
                                     SqlDbType dbType, int size, object value ) =>
   command.Parameters.Add( InOut( paramName, dbType, size, value ) );

public static SqlParameter AddRetValue( SqlCommand command, SqlDbType dbType, int size ) =>
   command.Parameters.Add( RetValue( dbType, size ) );

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HSqlParam

} // DataHelpers.SQL
