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

namespace DataHelpers.SQL {

/// <summary>
/// </summary>
[h_db_orm_type]
public abstract partial class HSPOutputBase: u.property_nn_base {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result][u.opt_result]
protected static T GET<T>( SqlParameter parameter, bool treatNullAsDefaultValue=false ) =>
   HSPOutputReader.GET<T>( parameter, treatNullAsDefaultValue );

/// <exception cref="u.EGenericType" />
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result][u.opt_result]
protected static T VAL<T>( SqlParameter parameter, bool treatNullAsDefaultValue=false )
where T: struct =>
   HSPOutputReader.VAL<T>( parameter, treatNullAsDefaultValue );

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static string STR( SqlParameter parameter, bool treatNullAsEmpty=false ) =>
   HSPOutputReader.STR( parameter, treatNullAsEmpty );
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static string NS( SqlParameter parameter, bool treatNullAsEmpty=false ) =>
   HSPOutputReader.NS( parameter, treatNullAsEmpty );

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static int INT( SqlParameter parameter, bool treatNullAsZero=false ) =>
   HSPOutputReader.INT( parameter, treatNullAsZero );
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static long BIGINT( SqlParameter parameter, bool treatNullAsZero=false ) =>
   HSPOutputReader.BIGINT( parameter, treatNullAsZero );

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static double FP( SqlParameter parameter, bool treatNullAsZero=false ) =>
   HSPOutputReader.FP( parameter, treatNullAsZero );

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static decimal DEC( SqlParameter parameter, bool treatNullAsZero=false ) =>
   HSPOutputReader.DEC( parameter, treatNullAsZero );

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static bool BOOL( SqlParameter parameter, bool treatNullAsFalse=false ) =>
   HSPOutputReader.BOOL( parameter, treatNullAsFalse );

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static DateTime DT( SqlParameter parameter ) =>
   HSPOutputReader.DT( parameter );
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static DateTime UTC( SqlParameter parameter ) =>
   HSPOutputReader.UTC( parameter );

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static Guid GUID( SqlParameter parameter, bool treatNullAsEmpty=false ) =>
   HSPOutputReader.GUID( parameter, treatNullAsEmpty );

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

/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static byte[] BINARY( SqlParameter parameter, bool treatNullAsEmpty=false ) =>
   HSPOutputReader.BINARY( parameter, treatNullAsEmpty ) ?? Array.Empty<byte>();

//--------------------------------------------------------------------------------------------------
/*
/// <exception cref="InvalidOperationException" />
/// <exception cref="InvalidCastException" />
/// <exception cref="HDatabaseException" />
[u.async_local][u.strict_result]
protected static ... ...( SqlParameter parameter, bool treatNullAs...=false ) =>
   HSPOutputReader....( parameter, treatNullAs... );
*/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HSPOutputBase

} // DataHelpers.SQL
