diff options
Diffstat (limited to 'build/webpi/install')
-rw-r--r-- | build/webpi/install/mssql.sql | 78 | ||||
-rw-r--r-- | build/webpi/install/mysql.sql | 30 |
2 files changed, 54 insertions, 54 deletions
diff --git a/build/webpi/install/mssql.sql b/build/webpi/install/mssql.sql index 390b4ffc02..9c0b46678a 100644 --- a/build/webpi/install/mssql.sql +++ b/build/webpi/install/mssql.sql @@ -1,39 +1,39 @@ -/**********************************************************************/
-/* Install.SQL */
-/* Creates a login and makes the user a member of db roles */
-/* */
-/**********************************************************************/
-
--- Declare variables for database name, username and password
-DECLARE @dbName sysname,
- @dbUser sysname,
- @dbPwd nvarchar(max);
-
--- Set variables for database name, username and password
-SET @dbName = 'PlaceHolderForDb';
-SET @dbUser = 'PlaceHolderForUser';
-SET @dbPwd = 'PlaceHolderForPassword';
-
-DECLARE @cmd nvarchar(max)
-
--- Create login
-IF( SUSER_SID(@dbUser) is null )
-BEGIN
- print '-- Creating login '
- SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N''''
- EXEC(@cmd)
-END
-
--- Create database user and map to login
--- and add user to the datareader, datawriter, ddladmin and securityadmin roles
---
-SET @cmd = N'USE ' + quotename(@DBName) + N';
-IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N'''))
-BEGIN
- print ''-- Creating user'';
- CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N';
- print ''-- Adding user'';
- EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N''';
-END'
-EXEC(@cmd)
-GO
+/**********************************************************************/ +/* Install.SQL */ +/* Creates a login and makes the user a member of db roles */ +/* */ +/**********************************************************************/ + +-- Declare variables for database name, username and password +DECLARE @dbName sysname, + @dbUser sysname, + @dbPwd nvarchar(max); + +-- Set variables for database name, username and password +SET @dbName = 'PlaceHolderForDb'; +SET @dbUser = 'PlaceHolderForUser'; +SET @dbPwd = 'PlaceHolderForPassword'; + +DECLARE @cmd nvarchar(max) + +-- Create login +IF( SUSER_SID(@dbUser) is null ) +BEGIN + print '-- Creating login ' + SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N'''' + EXEC(@cmd) +END + +-- Create database user and map to login +-- and add user to the datareader, datawriter, ddladmin and securityadmin roles +-- +SET @cmd = N'USE ' + quotename(@DBName) + N'; +IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N''')) +BEGIN + print ''-- Creating user''; + CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N'; + print ''-- Adding user''; + EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N'''; +END' +EXEC(@cmd) +GO diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql index 8c1ae2e550..5c9d8cd922 100644 --- a/build/webpi/install/mysql.sql +++ b/build/webpi/install/mysql.sql @@ -1,15 +1,15 @@ -USE PlaceHolderForDb$$
-
-DROP PROCEDURE IF EXISTS add_user $$
-
-CREATE PROCEDURE add_user()
-BEGIN
-DECLARE EXIT HANDLER FOR 1044 BEGIN END;
-GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword';
-FLUSH PRIVILEGES;
-END
-$$
-
-CALL add_user() $$
-
-DROP PROCEDURE IF EXISTS add_user $$
+USE PlaceHolderForDb$$ + +DROP PROCEDURE IF EXISTS add_user $$ + +CREATE PROCEDURE add_user() +BEGIN +DECLARE EXIT HANDLER FOR 1044 BEGIN END; +GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; +FLUSH PRIVILEGES; +END +$$ + +CALL add_user() $$ + +DROP PROCEDURE IF EXISTS add_user $$ |