/// <summary> /// Initializes a new instance of the <see cref="Database"/> class providing /// a given parent <see cref="IDatabaseContext"/>. /// </summary> /// <param name="context">The database context that provides the required /// configurations and services to the database.</param> public Database(IDatabaseContext context) { DatabaseContext = context; DiscoverDataVersion(); TableComposite = new TableSourceComposite(this); // Create the single row table var t = new TemporaryTable(context, "SINGLE_ROW_TABLE", new ColumnInfo[0]); t.NewRow(); SingleRowTable = t; TransactionFactory = new DatabaseTransactionFactory(this); }
public void TestSetUp() { var tableInfo = new TableInfo(new ObjectName("test_table")); tableInfo.AddColumn("id", PrimitiveTypes.Numeric()); tableInfo.AddColumn("name", PrimitiveTypes.String()); tableInfo.AddColumn("date", PrimitiveTypes.DateTime()); var cornerTime = DateTimeOffset.UtcNow; var tmpTable = new TemporaryTable(tableInfo); AddRow(tmpTable, 1, "test1", cornerTime); AddRow(tmpTable, 2, "test2", cornerTime.AddSeconds(2)); AddRow(tmpTable, 3, "test3", cornerTime.AddSeconds(5)); tmpTable.BuildIndexes(); table = tmpTable; }
public void TestSetUp() { var tableName = ObjectName.Parse("APP.test_table"); var tableInfo = new TableInfo(tableName); tableInfo.AddColumn("id", PrimitiveTypes.Numeric(), true); tableInfo.AddColumn("name", PrimitiveTypes.String(SqlTypeCode.VarChar)); tableInfo.AddColumn("date", PrimitiveTypes.DateTime()); cornerTime = DateTimeOffset.UtcNow; var tmpTable = new TemporaryTable(tableInfo); AddRow(tmpTable, 1, "test1", cornerTime); AddRow(tmpTable, 2, "test2", cornerTime.AddSeconds(2)); AddRow(tmpTable, 3, "test3", cornerTime.AddSeconds(5)); tmpTable.BuildIndexes(DefaultIndexTypes.BlindSearch); table = tmpTable; }
private void AddRow(TemporaryTable tmpTable, long id, string name, DateTimeOffset date) { var row = new DataObject[3]; row[0] = DataObject.BigInt(id); row[1] = DataObject.String(name); row[2] = DataObject.Date(date); tmpTable.NewRow(row); }