private void CheckIndexCreationStatement <DataType>(string columnName) { SqliteSchema actualIndex = Fixture.ReadIndexSchemaFromDatabase(TableName, columnName); Assert.NotNull(actualIndex); string statement = actualIndex.CreateStatement.ToLower(); Assert.False(string.IsNullOrWhiteSpace(statement)); var attribute = GetAttributeFromProperty <RdbTableIndexAttribute>(columnName, typeof(DataType)); Assert.NotNull(attribute); Assert.Contains(attribute.AdditionalSqlClauses, statement); switch (attribute.SortingOrder) { case ValueSortingOrder.Ascending: Assert.Contains("asc", statement); break; case ValueSortingOrder.Descending: Assert.Contains("desc", statement); break; } }
private void CheckTableCreationStatement <DataType>(string[] columnDefinitions) { SqliteSchema actualTable = Fixture.ReadActualTableSchemaFromDatabase(TableName); Assert.NotNull(actualTable); string statement = actualTable.CreateStatement.ToLower(); Assert.False(string.IsNullOrWhiteSpace(statement)); foreach (string column in columnDefinitions) { Assert.Contains(column.ToLower(), statement); } }
public SqliteSchema ReadActualTableSchemaFromDatabase(string tableName) { var databaseObjects = QueryDatabaseObjects(Connection); Assert.NotEmpty(databaseObjects); SqliteSchema actualTable = ( from x in databaseObjects where x.Type.ToLower() == "table" && x.EntityName.ToLower() == tableName.ToLower() select x ).FirstOrDefault(); return(actualTable); }
public SqliteSchema ReadIndexSchemaFromDatabase(string tableName, string columnName) { var databaseObjects = QueryDatabaseObjects(Connection); Assert.NotEmpty(databaseObjects); SqliteSchema actualTable = ( from x in databaseObjects where x.Type.ToLower() == "index" && x.TableName.ToLower() == tableName.ToLower() // die Reihen mit "sqlite_autoindex_*" weisen keine Anweisung auf && (x.CreateStatement ?? "").ToLower().Contains(columnName.ToLower()) select x ).FirstOrDefault(); return(actualTable); }