public static void ThrowExceptionIfNotExists(IConnectionManager connectionManager, string tableName) { bool tableExists = new IfTableOrViewExistsTask(tableName) { ConnectionManager = connectionManager, DisableLogging = true }.Exists(); if (!tableExists) { throw new ETLBoxException($"An table {tableName} does not exists in the database!"); } }
public void Execute() { IsExisting = new IfTableOrViewExistsTask(ViewName) { ConnectionManager = this.ConnectionManager, DisableLogging = true }.Exists(); if ((ConnectionType == ConnectionManagerType.SQLite || ConnectionType == ConnectionManagerType.Postgres) && IsExisting) { new DropViewTask(ViewName) { ConnectionManager = this.ConnectionManager, DisableLogging = true } }
public void Execute() { bool tableExists = new IfTableOrViewExistsTask(TableName) { ConnectionManager = this.ConnectionManager, DisableLogging = true }.Exists(); if (tableExists && ThrowErrorIfTableExists) { throw new ETLBoxException($"Table {TableName} already exists!"); } if (!tableExists) { new SqlTask(this, Sql).ExecuteNonQuery(); } }