Skip to content

Commit

Permalink
Automation: Format and Build SQL File
Browse files Browse the repository at this point in the history
  • Loading branch information
Darling Data committed Jun 19, 2024
1 parent 23a3eb7 commit 0acce16
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 110 deletions.
122 changes: 61 additions & 61 deletions Install-All/DarlingData.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Compile Date: 06/19/2024 14:59:27 UTC
-- Compile Date: 06/19/2024 15:27:16 UTC
SET ANSI_NULLS ON;
SET ANSI_PADDING ON;
SET ANSI_WARNINGS ON;
Expand Down Expand Up @@ -66,8 +66,8 @@ BEGIN
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT
@version = '1.5',
@version_date = '20240401';
@version = '1.7',
@version_date = '20240701';

IF @help = 1
BEGIN
Expand Down Expand Up @@ -2960,8 +2960,8 @@ SET XACT_ABORT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT
@version = '5.5',
@version_date = '20240401';
@version = '5.7',
@version_date = '20240701';

IF @help = 1
BEGIN
Expand Down Expand Up @@ -7687,8 +7687,8 @@ SET XACT_ABORT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT
@version = '3.5',
@version_date = '20240401';
@version = '3.7',
@version_date = '20240701';

IF @help = 1
BEGIN
Expand Down Expand Up @@ -10510,20 +10510,20 @@ SET STATISTICS TIME, IO OFF;
GO

/*
██╗ ██████╗ ██████╗
██║ ██╔═══██╗██╔════╝
██║ ██║ ██║██║ ███╗
██║ ██║ ██║██║ ██║
███████╗╚██████╔╝╚██████╔╝
╚══════╝ ╚═════╝ ╚═════╝
██╗ ██████╗ ██████╗
██║ ██╔═══██╗██╔════╝
██║ ██║ ██║██║ ███╗
██║ ██║ ██║██║ ██║
███████╗╚██████╔╝╚██████╔╝
╚══════╝ ╚═════╝ ╚═════╝

██╗ ██╗██╗ ██╗███╗ ██╗████████╗███████╗██████╗
██║ ██║██║ ██║████╗ ██║╚══██╔══╝██╔════╝██╔══██╗
███████║██║ ██║██╔██╗ ██║ ██║ █████╗ ██████╔╝
██╔══██║██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██╔══██╗
██║ ██║╚██████╔╝██║ ╚████║ ██║ ███████╗██║ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝

Copyright 2024 Darling Data, LLC
https://www.erikdarling.com/

Expand All @@ -10542,10 +10542,10 @@ EXEC sp_LogHunter;

*/

IF OBJECT_ID('dbo.sp_LogHunter') IS NULL
BEGIN
EXEC ('CREATE PROCEDURE dbo.sp_LogHunter AS RETURN 138;');
END;
IF OBJECT_ID('dbo.sp_LogHunter') IS NULL
BEGIN
EXEC ('CREATE PROCEDURE dbo.sp_LogHunter AS RETURN 138;');
END;
GO

ALTER PROCEDURE
Expand All @@ -10565,15 +10565,15 @@ ALTER PROCEDURE
)
WITH RECOMPILE
AS
SET STATISTICS XML OFF;
SET STATISTICS XML OFF;
SET NOCOUNT ON;
SET XACT_ABORT ON;
SET XACT_ABORT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

BEGIN
SELECT
@version = '1.5',
@version_date = '20240401';
@version = '1.7',
@version_date = '20240701';

IF @help = 1
BEGIN
Expand All @@ -10583,7 +10583,7 @@ BEGIN
SELECT 'you can use me to look through your error logs for bad stuff' UNION ALL
SELECT 'all scripts and documentation are available here: https://github.com/erikdarlingdata/DarlingData/tree/main/sp_LogHunter' UNION ALL
SELECT 'from your loving sql server consultant, erik darling: https://erikdarling.com';

SELECT
parameter_name =
ap.name,
Expand Down Expand Up @@ -10638,38 +10638,38 @@ BEGIN
AND ap.user_type_id = t.user_type_id
WHERE o.name = N'sp_LogHunter'
OPTION(RECOMPILE);

SELECT
mit_license_yo = 'i am MIT licensed, so like, do whatever'

UNION ALL

SELECT
mit_license_yo = 'see printed messages for full license';

RAISERROR('
MIT License

Copyright 2024 Darling Data, LLC

https://www.erikdarling.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
', 0, 1) WITH NOWAIT;

RETURN;
END;

/*Check if we have sa permissisions*/
IF
(
Expand Down Expand Up @@ -10715,7 +10715,7 @@ BEGIN
RAISERROR(N'%i is not not a valid language_id in sys.messages.', 11, 1, @language_id) WITH NOWAIT;
RETURN;
END;

/*Fix days back a little bit*/
IF @days_back = 0
BEGIN
Expand All @@ -10728,7 +10728,7 @@ BEGIN
SELECT
@days_back *= -1;
END;

IF @start_date IS NOT NULL
AND @end_date IS NOT NULL
AND @days_back IS NOT NULL
Expand Down Expand Up @@ -10777,7 +10777,7 @@ BEGIN
@t_searches int = 0 /*total number of searches to run*/,
@l_count int = 1 /*loop count*/,
@stopper bit = 0 /*stop loop execution safety*/;

/*temp tables for holding temporary things*/
CREATE TABLE
#error_log
Expand All @@ -10786,7 +10786,7 @@ BEGIN
process_info nvarchar(100),
text nvarchar(4000)
);

CREATE TABLE
#enum
(
Expand Down Expand Up @@ -10857,7 +10857,7 @@ BEGIN
AND e.archive > 0
OPTION(RECOMPILE);
END;

/*filter out log files we won't use, if @start_date and @end_date are set*/
IF @start_date IS NOT NULL
AND @end_date IS NOT NULL
Expand Down Expand Up @@ -10966,7 +10966,7 @@ BEGIN
N'"' + CONVERT(nvarchar(30), @end_date) + N'"'
) AS c
WHERE @custom_message_only = 0
OPTION(RECOMPILE);
OPTION(RECOMPILE);

/*deal with a custom search string here*/
INSERT
Expand Down Expand Up @@ -10999,7 +10999,7 @@ BEGIN
BEGIN
SELECT table_name = '#search', s.* FROM #search AS s;
END;

/*Set the min and max logs we're getting for the loop*/
SELECT
@l_log = MIN(e.archive),
Expand All @@ -11016,7 +11016,7 @@ BEGIN
END;

IF @debug = 1 BEGIN RAISERROR('Declaring cursor', 0, 1) WITH NOWAIT; END;

/*start the loops*/
WHILE @l_log <= @h_log
BEGIN
Expand All @@ -11031,17 +11031,17 @@ BEGIN
SELECT
command
FROM #search;

IF @debug = 1 BEGIN RAISERROR('Opening cursor', 0, 1) WITH NOWAIT; END;

OPEN c;

FETCH FIRST
FROM c
INTO @c;

IF @debug = 1 BEGIN RAISERROR('Entering WHILE loop', 0, 1) WITH NOWAIT; END;
WHILE @@FETCH_STATUS = 0 AND @stopper = 0
WHILE @@FETCH_STATUS = 0 AND @stopper = 0
BEGIN
IF @debug = 1 BEGIN RAISERROR('Entering cursor', 0, 1) WITH NOWAIT; END;
/*Replace the canary value with the log number we're working in*/
Expand All @@ -11058,9 +11058,9 @@ BEGIN
BEGIN
RAISERROR('log %i of %i', 0, 1, @l_log, @h_log) WITH NOWAIT;
RAISERROR('search %i of %i', 0, 1, @l_count, @t_searches) WITH NOWAIT;
RAISERROR('@c: %s', 0, 1, @c) WITH NOWAIT;
RAISERROR('@c: %s', 0, 1, @c) WITH NOWAIT;
END;

IF @debug = 1 BEGIN RAISERROR('Inserting to error log', 0, 1) WITH NOWAIT; END;
BEGIN
BEGIN TRY
Expand All @@ -11085,10 +11085,10 @@ BEGIN
VALUES
(
@c
);
);
END CATCH;
END;

IF @debug = 1 BEGIN RAISERROR('Fetching next', 0, 1) WITH NOWAIT; END;
/*Get the next search command*/
FETCH NEXT
Expand All @@ -11100,7 +11100,7 @@ BEGIN
@l_count += 1;

END;

IF @debug = 1 BEGIN RAISERROR('Getting next log', 0, 1) WITH NOWAIT; END;
/*Increment the log numbers*/
SELECT
Expand All @@ -11112,18 +11112,18 @@ BEGIN

IF @debug = 1
BEGIN
RAISERROR('log %i of %i', 0, 1, @l_log, @h_log) WITH NOWAIT;
RAISERROR('log %i of %i', 0, 1, @l_log, @h_log) WITH NOWAIT;
END;

/*Stop the loop if this is NULL*/
IF @l_log IS NULL
BEGIN
IF @debug = 1 BEGIN RAISERROR('Breaking', 0, 1) WITH NOWAIT; END;
IF @debug = 1 BEGIN RAISERROR('Breaking', 0, 1) WITH NOWAIT; END;
SET @stopper = 1;
BREAK;
END;
END;
IF @debug = 1 BEGIN RAISERROR('Ended WHILE loop', 0, 1) WITH NOWAIT; END;

/*Close out the cursor*/
CLOSE c;
DEALLOCATE c;
Expand Down Expand Up @@ -11179,7 +11179,7 @@ BEGIN
1/0
FROM #errors AS e
)
BEGIN
BEGIN
SELECT
table_name =
'#errors',
Expand Down Expand Up @@ -11264,8 +11264,8 @@ SET XACT_ABORT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT
@version = '4.5',
@version_date = '20240401';
@version = '4.7',
@version_date = '20240701';


IF @help = 1
Expand Down Expand Up @@ -14322,8 +14322,8 @@ END;
These are for your outputs.
*/
SELECT
@version = '4.5',
@version_date = '20240401';
@version = '4.7',
@version_date = '20240701';

/*
Helpful section! For help.
Expand Down
Loading

0 comments on commit 0acce16

Please sign in to comment.