/// <summary> /// Runs the sql code to create the database. /// </summary> public void Execute() { if (!DbConnectionManager.SupportDatabases) { throw new ETLBoxNotSupportedException("This task is not supported!"); } bool doesExist = new IfDatabaseExistsTask(DatabaseName) { DisableLogging = true, ConnectionManager = ConnectionManager }.DoesExist; if (!doesExist) { new SqlTask(this, Sql).ExecuteNonQuery(); } }
internal void Execute() { if (!DbConnectionManager.SupportDatabases) { throw new NotSupportedException($"This task is not supported with the current connection manager ({ConnectionType})"); } bool doesExist = new IfDatabaseExistsTask(DatabaseName) { DisableLogging = true, ConnectionManager = ConnectionManager }.Exists(); if (doesExist && ThrowOnError) { throw new ETLBoxException($"Database {DatabaseName} already exists - can't create the database!"); } if (!doesExist) { new SqlTask(this, Sql).ExecuteNonQuery(); } }