/***************************************************************************************************
# T-SQL LANGUAGE EXTENSIONS AS PREPROCESSOR MACROS (FOR IMPORT THROUGH "SQLAUX.cmd"):
# --------------------------------------------------------------------------------------------------
# SQLAUX scripting library | Author: Sergei Y.Kitáev
# -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/

/*==================================================================================================
# MAIN KEYWORDS (SQL-EXTENSIONS):
----------------------------------------------------------------------------------------------------
*/
$(NOP_AUX)     -- no operation (synctatically non-empty construction)
$(LOOP_AUX)    -- loop cycle, for termination via break/return/… (from “begin...end” code block)

$(TRUE_AUX)    -- true condition (to use in conditional expressions)
$(FALSE_AUX)   -- false condition (to use in conditional expressions)

$(YES_AUX)     -- flag value 1 of [bit] type
$(NO_AUX)      -- flag value 0 of [bit] type

$(SUCCESS_AUX) = 0 -- general successful exist code (from stored procedure)
$(FAILURE_AUX) = 1 -- commonly used failure exist code (from stored procedure)

$(FLOAT_1_AUX) -- value 1 of [float] type (of maximum FP type)

----------------------------------------------------------------------------------------------------

$(BEGIN_AUX)                     -- beginning of stored procedure or batch implementation
$(BEGIN_WITH_XACT_ABORT_ON_AUX)  -- beginning of SP/batch implementation, with active XACT_ABORT
$(BEGIN_WITH_XACT_ABORT_OFF_AUX) -- beginning of SP/batch implementation, with inactive XACT_ABORT
$(BEGIN_WITHOUT_XACT_ABORT_AUX)  -- beginning of SP/batch implementation, without XACT_ABORT setting
$(END_AUX)                       -- ending of stored procedure or batch implementation

$(BEGIN_TRANSACTION_AUX)         -- opening of local transaction
$(COMMIT_TRANSACTION_AUX)        -- commiting of local transaction
$(COMMIT_OPEN_LT_AUX)            -- commiting of local transaction, if was previously open

$(ROLLBACK_TRANSACTION_AUX)      -- local transaction rollback
$(ROLLBACK_OPEN_LT_AUX)          -- local transaction rollback, if was previously open
$(ROLLBACK_UNCOMMITTABLE_LT_AUX) -- rollback of non-commited local transaction, if not commited

$(INITIAL_TRANCOUNT_AUX)         -- initial transaction count (saved by $(BEGIN_AUX) macro)
$(IS_IN_OPEN_LT_AUX)             -- checking, if local transaction is open
$(RESET_OPEN_LT_FLAG_AUX)        -- resetting open local transaction flag

-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$(IS_XACT_ABORT_ON_AUX)                -- activity condition for XACT_ABORT
$(IS_NUMERIC_ROUNDABORT_ON_AUX)        -- activity condition for NUMERIC_ROUNDABORT
$(IS_CONCAT_NULL_YIELDS_NULL_ON_AUX)   -- activity condition for CONCAT_NULL_YIELDS_NULL
$(IS_ANSI_NULL_DFLT_OFF_ON_AUX)        -- activity condition for ANSI_NULL_DFLT_OFF
$(IS_ANSI_NULL_DFLT_ON_ON_AUX)         -- activity condition for ANSI_NULL_DFLT_ON
$(IS_NOCOUNT_ON_AUX)                   -- activity condition for NOCOUNT
$(IS_QUOTED_IDENTIFIER_ON_AUX)         -- activity condition for QUOTED_IDENTIFIER
$(IS_ARITHIGNORE_ON_AUX)               -- activity condition for ARITHIGNORE
$(IS_ARITHABORT_ON_AUX)                -- activity condition for ARITHABORT
$(IS_ANSI_NULLS_ON_AUX)                -- activity condition for ANSI_NULLS
$(IS_ANSI_PADDING_ON_AUX)              -- activity condition for ANSI_PADDING
$(IS_ANSI_WARNING_ON_AUX)              -- activity condition for ANSI_WARNING
$(IS_CURSOR_CLOSE_ON_COMMIT_ON_AUX)    -- activity condition for CURSOR_CLOSE_ON_COMMIT
$(IS_IMPLICIT_TRANSACTIONS_ON_AUX)     -- activity condition for IMPLICIT_TRANSACTIONS
$(IS_DISABLE_DEF_CNST_CHK_ON_AUX)      -- activity condition for DISABLE_DEF_CNST_CHK

$(XACT_ABORT_AUX)                      -- effective bit value of XACT_ABORT
$(NUMERIC_ROUNDABORT_AUX)              -- effective bit value of NUMERIC_ROUNDABORT
$(CONCAT_NULL_YIELDS_NULL_AUX)         -- effective bit value of CONCAT_NULL_YIELDS_NULL
$(ANSI_NULL_DFLT_OFF_AUX)              -- effective bit value of ANSI_NULL_DFLT_OFF
$(ANSI_NULL_DFLT_ON_AUX)               -- effective bit value of ANSI_NULL_DFLT_ON
$(NOCOUNT_AUX)                         -- effective bit value of NOCOUNT
$(QUOTED_IDENTIFIER_AUX)               -- effective bit value of QUOTED_IDENTIFIER
$(ARITHIGNORE_AUX)                     -- effective bit value of ARITHIGNORE
$(ARITHABORT_AUX)                      -- effective bit value of ARITHABORT
$(ANSI_NULLS_AUX)                      -- effective bit value of ANSI_NULLS
$(ANSI_PADDING_AUX)                    -- effective bit value of ANSI_PADDING
$(ANSI_WARNING_AUX)                    -- effective bit value of ANSI_WARNING
$(CURSOR_CLOSE_ON_COMMIT_AUX)          -- effective bit value of CURSOR_CLOSE_ON_COMMIT
$(IMPLICIT_TRANSACTIONS_AUX)           -- effective bit value of IMPLICIT_TRANSACTIONS
$(DISABLE_DEF_CNST_CHK_AUX)            -- effective bit value of DISABLE_DEF_CNST_CHK

----------------------------------------------------------------------------------------------------
-- CONDITIONAL “TEST” AND “NONTEST” BLOCKS (SEE “SQL_extensions.AUX.cmd”):

$(TEST_IMPLEMENTATION_AUX) -- condition of “test implementation”: $(TRUE_AUX) / $(FALSE_AUX)
$(BEGIN_TEST_AUX)          -- beginning of “test implementation”
$(END_TEST_AUX)            -- ending of “test implementation”
$(BEGIN_NONTEST_AUX)       -- beginning of “non-test implementation”
$(END_NONTEST_AUX)         -- ending of “non-test implementation”

----------------------------------------------------------------------------------------------------
-- CONDITIONAL “METAIMPLEMENTATION” BLOCK SUPPORT (SEE “SQL_extensions.AUX.cmd”):

$(META_IMPLEMENTATION_AUX) -- condition of “meta-implementation”: $(TRUE_AUX) / $(FALSE_AUX)
$(BEGIN_META_AUX)          -- beginning of “meta-implementation”
$(END_META_AUX)            -- ending of “meta-implementation”
$(BEGIN_NONMETA_AUX)       -- beginning of “non-meta-implementation”
$(END_NONMETA_AUX)         -- ending of “non-meta-implementation”

/*==================================================================================================
# WIDELY USED SPECIAL CHARACTERS AND SEQUENCIES:
----------------------------------------------------------------------------------------------------
*/
$(LAQUO_AUX)   -- '«' U+00AB char(171)
$(RAQUO_AUX)   -- '»' U+00BB char(187)

$(LANG_AUX)    -- '‹' U+2039 char(139)
$(RANG_AUX)    -- '›' U+203A char(155)

$(LSQM_AUX)    -- '‘' U+8216 char(145)
$(RSQM_AUX)    -- '’' U+8217 char(146)

$(LDQUO_AUX)   -- '“' U+201C char(147)
$(RDQUO_AUX)   -- '”' U+201D char(148)

$(BULL_AUX)    -- '•' U+2022 char(149)
$(MIDDOT_AUX)  -- '·' U+00B7 char(183)

$(PLUSMN_AUX)  -- '±' U+00B1 char(177)
$(HELLIP_AUX)  -- '…' U+2026 char(133)
$(DEG_AUX)     -- '°' U+00B0 char(176)
$(SECT_AUX)    -- '§' U+00A7 char(167)

$(COPY_AUX)    -- '©' U+00A9 char(169)
$(REG_AUX)     -- '®' U+00AE char(174)

$(MDASH_AUX)   -- '—' U+2014 char(151)
$(NDASH_AUX)   -- '–' U+2013 char(150)

$(CR_AUX)      -- carriage return: char(13)
$(LF_AUX)      -- line feed: char(10)

$(CR_LF_AUX)   -- carriage return and line feed as list through comma: $(CR_AUX),$(LF_AUX)

$(NL_AUX)      -- new line: (CR+LF)
$(NLNL_AUX)    -- double new line: (CR+LF+CR+LF)

$(LARROW_AUX)  -- '<—' (on base of “mdash”)
$(RARROW_AUX)  -- '—>' (on base of “mdash”)

$(BACKSLASH_AUX)  -- '\' U+5C char(92)

/*==================================================================================================
# NAKED CHARACTERS AND SEQUENCIES (NOT EMBRACED WITH SINGLE QUOTES):
----------------------------------------------------------------------------------------------------
*/
$(_BACKSLASH_AUX) -- \ U+5C char(92)
$(_DOLLAR_AUX)    -- $ U+24 char(36)

/*==================================================================================================
# AUXILIARY INSERTIONS TO SQL:
----------------------------------------------------------------------------------------------------
*/
$(NewLineAndErrorMessage_AUX) -- $(NL_AUX)+ERROR_MESSAGE()
$(AppendErrorMessageLine_AUX) -- @ErrorMessage = case when ISNULL(@ErrorMessage,'')<>'' then ISNULL(@ErrorMessage,'')+$(NL_AUX) else '' end +
$(AppendScriptLine_AUX)       -- @ScriptText = case when ISNULL(@ScriptText,'')<>'' then ISNULL(@ScriptText,'')+$(NL_AUX) else '' end +

/*================================================================================================*/
