/// <summary> /// Compiles the specified SQL DOM query. /// </summary> /// <param name="query">Query to compile.</param> /// <returns>Compiled query.</returns> public SqlCompilationResult CompileQuery(ISqlCompileUnit query) { ArgumentValidator.EnsureArgumentNotNull(query, "query"); var upgradeContext = UpgradeContext.GetCurrent(Session.Domain.UpgradeContextCookie); if (upgradeContext != null) { return(driver.Compile(query, upgradeContext.NodeConfiguration)); } return(driver.Compile(query, Session.StorageNode.Configuration)); }
private static void DropTables(StorageDriver driver, IEnumerable <Table> tables, ISqlExecutor executor) { var statements = BreakEvery(tables .Select(t => driver.Compile(SqlDdl.Drop(t)).GetCommandText()), 25); executor.ExecuteMany(statements); }
private static void DropSequences(StorageDriver driver, IEnumerable <Sequence> sequences, ISqlExecutor executor) { var statements = BreakEvery(sequences .Select(s => driver.Compile(SqlDdl.Drop(s)).GetCommandText()), 25).ToChainedBuffer(); executor.ExecuteMany(statements); }
private static void DropForeignKeys(StorageDriver driver, IEnumerable <Table> tables, ISqlExecutor executor) { var statements = BreakEvery(tables .SelectMany(t => t.TableConstraints.OfType <ForeignKey>()) .Select(fk => driver.Compile(SqlDdl.Alter(fk.Table, SqlDdl.DropConstraint(fk))).GetCommandText()), 25); executor.ExecuteMany(statements); }
private static Task DropTablesAsync( StorageDriver driver, IEnumerable <Table> tables, ISqlExecutor executor, CancellationToken token) { var statements = tables .Select(t => driver.Compile(SqlDdl.Drop(t)).GetCommandText()) .ToList(); return(executor.ExecuteManyAsync(statements, token)); }
private static Task DropForeignKeysAsync( StorageDriver driver, IEnumerable <Table> tables, ISqlExecutor executor, CancellationToken token) { var statements = tables .SelectMany(t => t.TableConstraints.OfType <ForeignKey>()) .Select(fk => driver.Compile(SqlDdl.Alter(fk.Table, SqlDdl.DropConstraint(fk))).GetCommandText()) .ToList(); return(executor.ExecuteManyAsync(statements, token)); }
public void RegisterCommand(ISqlCompileUnit command) { output.Add(driver.Compile(command).GetCommandText()); }