Beispiel #1
0
        internal static string DropDatabaseScript(string databaseName)
        {
            var builder = new DdlBuilder();

            builder.AppendSql("drop database ");
            builder.AppendIdentifier(databaseName);
            return(builder.stringBuilder.ToString());
        }
Beispiel #2
0
        internal static string CreateDatabaseScript(string databaseName, string dataFileName, string logFileName)
        {
            var builder = new DdlBuilder();

            builder.AppendSql("create database ");
            builder.AppendIdentifier(databaseName);
            if (null != dataFileName)
            {
                builder.AppendSql(" on primary ");
                builder.AppendFileName(dataFileName);
                builder.AppendSql(" log on ");
                builder.AppendFileName(logFileName);
            }
            return(builder.stringBuilder.ToString());
        }
Beispiel #3
0
        private void AppendCreateSchema(string schema)
        {
            AppendSql("if (schema_id(");
            AppendStringLiteral(schema);
            AppendSql(") is null) exec(");

            // need to create a sub-command and escape it as a string literal as well...
            DdlBuilder schemaBuilder = new DdlBuilder();

            schemaBuilder.AppendSql("create schema ");
            schemaBuilder.AppendIdentifier(schema);

            AppendStringLiteral(schemaBuilder.stringBuilder.ToString());
            AppendSql(");");
            AppendNewLine();
        }