-
Notifications
You must be signed in to change notification settings - Fork 6
/
db_assembly_create.bat
47 lines (31 loc) · 1.08 KB
/
db_assembly_create.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@SETLOCAL
@ECHO %~nx0
CHCP
@REM Seting UTF-8 encoding.
@REM CHCP 65001
CALL %env_qUtil%\exit_if_error
SET assemblyName=%1
IF [%assemblyName%] EQU [] GOTO BrokenInputParameter
SET dllPath=%2
IF [%dllPath%] EQU [] GOTO BrokenInputParameter
IF [%dllPath%] EQU [""] GOTO BrokenInputParameter
SET accumAssemblyPath=%3
IF [%accumAssemblyPath%] EQU [] GOTO BrokenInputParameter
IF [%accumAssemblyPath%] EQU [""] GOTO BrokenInputParameter
SET sqlScript=%accumAssemblyPath%\assemblies.register.sql
@ECHO.>> %sqlScript%
@ECHO CREATE ASSEMBLY [%assemblyName%]>> %sqlScript%
@ECHO AUTHORIZATION dbo>> %sqlScript%
@ECHO FROM>> %sqlScript%
CALL %env_qUtil%\AssemblyToSqlHexadecimal.exe %dllPath%>> %sqlScript%
@ECHO.>> %sqlScript%
@ECHO WITH PERMISSION_SET = SAFE>> %sqlScript%
@ECHO GO>> %sqlScript%
@ECHO GRANT ALTER ON ASSEMBLY::[%assemblyName%] TO [PUBLIC]>> %sqlScript%
@ECHO GO>> %sqlScript%
@ECHO.>> %sqlScript%
@GOTO :EOF
:BrokenInputParameter
ECHO !#! Interrupted. Not all input parameters have been set to call this script!
ECHO.
EXIT 1000