private FunctionDefinition CreateFunction(string sql) { var processor = ((OracleProcessor)new OracleProcessorFactory().Create(ConnectionString, new DebugAnnouncer(), new ProcessorOptions())); processor.Execute(sql); var dumper = new OracleSchemaDumper(processor, new DebugAnnouncer()); var functions = dumper.ReadFunctions(); processor.CommitTransaction(); functions.Count.ShouldBe(1); return functions[0]; }
/// <summary> /// Creates a single column table using the spplied type and retruns its <see cref="ColumnDefinition"/> /// </summary> /// <param name="type">The Sql Server data type to apply to the column</param> /// <returns>The translated <see cref="ColumnDefinition"/></returns> private ViewDefinition GetView(string sql) { // Act var processor = ((OracleProcessor)new OracleProcessorFactory().Create(ConnectionString, new DebugAnnouncer(), new ProcessorOptions())); processor.Execute("CREATE VIEW Foo AS {0}", sql); var dumper = new OracleSchemaDumper(processor, new DebugAnnouncer()); var views = dumper.ReadViews(); processor.CommitTransaction(); views.Count.ShouldBe(1); return views[0]; }
/// <summary> /// Creates a single column table using the spplied type and retruns its <see cref="ColumnDefinition"/> /// </summary> /// <param name="type">The Sql Server data type to apply to the column</param> /// <returns>The translated <see cref="ColumnDefinition"/></returns> private ColumnDefinition GetTableColumn(string type) { IList<TableDefinition> tables; // Act var processor = ((OracleProcessor)new OracleProcessorFactory().Create(ConnectionString, new DebugAnnouncer(), new ProcessorOptions())); // Using explict PL/SQL syntax to make easier testing, could be converted to expression processor.Execute("CREATE TABLE Foo ( Data {0} NULL )", type); Assert.IsTrue(processor.TableExists(string.Empty, "Foo"), "Oracle"); var dumper = new OracleSchemaDumper(processor, new DebugAnnouncer()); tables = dumper.ReadDbSchema(); processor.CommitTransaction(); tables.Count.ShouldBe(1); return tables[0].Columns.ToList()[0]; }
private TableDefinition CreateTable(IEnumerable<ColumnDefinition> columns, CreateIndexExpression index) { // Act var processor = ((OracleProcessor)new OracleProcessorFactory().Create(ConnectionString, new DebugAnnouncer(), new ProcessorOptions())); var create = new CreateTableExpression {TableName = "Foo"}; foreach (var columnDefinition in columns) { columnDefinition.TableName = create.TableName; create.Columns.Add(columnDefinition); } processor.Process(create); processor.Process(index); Assert.IsTrue(processor.TableExists(string.Empty, "Foo"), "Oracle"); var dumper = new OracleSchemaDumper(processor, new DebugAnnouncer()); var tables = dumper.ReadDbSchema(); processor.CommitTransaction(); tables.Count.ShouldBe(1); return tables[0]; }