public bool ContainsObject(ObjectName name) { return(cache.ContainsKey(name)); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DropObject(DbObjectType.Table, ObjectName.Parse("APP.test_table")); return(true); }
public static IDbObject GetObject(this ISession session, DbObjectType objectType, ObjectName objectName, AccessType accessType) { var obj = session.Transaction.GetObject(objectType, objectName); if (obj != null) { session.Access(obj, accessType); } return(obj); }
public void SetObject(ObjectName name, TCached obj) { ignoreCaseNames[name] = name; cache[name] = obj; }
public static ConstraintInfo QueryTablePrimaryKey(this ISession session, ObjectName tableName) { return(session.Transaction.QueryTablePrimaryKey(tableName)); }
public static void CheckConstraintViolations(this ISession session, ObjectName tableName) { throw new NotImplementedException(); }
public static ObjectName ResolveTableName(this ISession session, ObjectName tableName) { return(session.Transaction.ResolveTableName(tableName)); }
public static ObjectName[] QueryTablesRelationallyLinkedTo(this ISession session, ObjectName tableName) { return(session.Transaction.QueryTablesRelationallyLinkedTo(tableName)); }
public static void DropObject(this ISession session, DbObjectType objectType, ObjectName objectName) { session.Transaction.DropObject(objectType, objectName); }
public static ObjectName ResolveObjectName(this ISession session, DbObjectType objectType, ObjectName objectName) { return(session.Transaction.ResolveObjectName(objectType, objectName)); }
public static IDbObject FindObject(this ISession session, ObjectName objectName) { return(session.Transaction.FindObject(objectName)); }
private static void CreateTestTable(string testName, IQuery context) { var tableName1 = ObjectName.Parse("APP.test_table"); context.Access().CreateTable(table => table .Named(tableName1) .WithColumn(column => column .Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant(tableName1.FullName) }))) .WithColumn("first_name", PrimitiveTypes.String()) .WithColumn("last_name", PrimitiveTypes.String()) .WithColumn("birth_date", PrimitiveTypes.DateTime()) .WithColumn("active", PrimitiveTypes.Boolean())); context.Session.Access().AddPrimaryKey(tableName1, "id", "PK_TEST_TABLE"); if (testName.EndsWith("ConstraintCheck") || testName.EndsWith("Violation")) { var tableName2 = ObjectName.Parse("APP.test_table2"); context.Access().CreateTable(table => { table .Named(tableName2) .WithColumn(column => column .Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant(tableName2.FullName) }))); if (testName.StartsWith("SetDefault")) { table.WithColumn(column => column .Named("person_id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.Constant(0))); } else { table.WithColumn(column => column .Named("person_id") .HavingType(PrimitiveTypes.Integer()) .NotNull(testName.EndsWith("Violation"))); } table.WithColumn("dept_no", PrimitiveTypes.Integer()); }); context.Access().AddPrimaryKey(tableName2, "id", "PK_TEST_TABLE2"); ForeignKeyAction?onUpdate = null; if (testName.StartsWith("SetNull")) { onUpdate = ForeignKeyAction.SetNull; } else if (testName.StartsWith("SetDefault")) { onUpdate = ForeignKeyAction.SetDefault; } else if (testName.StartsWith("Cascade")) { onUpdate = ForeignKeyAction.Cascade; } if (onUpdate != null) { context.Access() .AddForeignKey(tableName2, new[] { "person_id" }, tableName1, new[] { "id" }, ForeignKeyAction.NoAction, onUpdate.Value, "FKEY_TEST_TABLE2"); } } }
protected Field Select(ObjectName functionName, params SqlExpression[] args) { return(AdminQuery.SelectFunction(functionName, args)); }
public static int DropTableConstraint(this ISession session, ObjectName tableName, string constraintName) { return(session.Transaction.DropTableConstraint(tableName, constraintName)); }
public static ITable GetTable(this ISession session, ObjectName tableName) { tableName = session.ResolveTableName(tableName); return(session.GetObject(DbObjectType.Table, tableName) as ITable); }
public static bool DropTablePrimaryKey(this ISession session, ObjectName tableName, string constraintName) { return(session.Transaction.DropTablePrimaryKey(tableName, constraintName)); }
public static TableInfo GetTableInfo(this ISession session, ObjectName tableName) { return(session.Transaction.GetTableInfo(tableName)); }
public static ConstraintInfo[] QueryTableCheckExpressions(this ISession session, ObjectName tableName) { return(session.Transaction.QueryTableCheckExpressions(tableName)); }
public static string GetTableType(this ISession session, ObjectName tableName) { return(session.Transaction.GetTableType(tableName)); }
public static ConstraintInfo[] QueryTableForeignKeys(this ISession session, ObjectName tableName) { return(session.Transaction.QueryTableForeignKeys(tableName)); }
public static void AddForeignKey(this ISession session, ObjectName table, string[] columns, ObjectName refTable, string[] refColumns, ForeignKeyAction deleteRule, ForeignKeyAction updateRule, ConstraintDeferrability deferred, String constraintName) { session.Transaction.AddForeignKey(table, columns, refTable, refColumns, deleteRule, updateRule, deferred, constraintName); }
public static IDbObject GetObject(this ISession session, DbObjectType objectType, ObjectName objectName) { return(GetObject(session, objectType, objectName, AccessType.ReadWrite)); }
public static void AddUniqueKey(this ISession session, ObjectName tableName, string[] columns, ConstraintDeferrability deferrability, string constraintName) { session.Transaction.AddUniqueKey(tableName, columns, deferrability, constraintName); }
public static bool ObjectExists(this ISession session, ObjectName objectName) { return(session.Transaction.ObjectExists(objectName)); }
public static void AddCheck(this ISession session, ObjectName tableName, SqlExpression expression, ConstraintDeferrability deferrability, string constraintName) { session.Transaction.AddCheck(tableName, expression, deferrability, constraintName); }
public bool TryGetObject(ObjectName name, out TCached obj) { return(cache.TryGetValue(name, out obj)); }
public static void DropAllTableConstraints(this ISession session, ObjectName tableName) { session.Transaction.DropAllTableConstraints(tableName); }
public bool RemoveObject(ObjectName name) { return(ignoreCaseNames.Remove(name) && cache.Remove(name)); }
protected override bool OnSetUp(string testName, IQuery query) { triggerName = ObjectName.Parse("APP.trigger1"); query.Access().CreateTrigger(new ProcedureTriggerInfo(triggerName, ObjectName.Parse("APP.table1"), TriggerEventTime.After, TriggerEventType.Delete, ObjectName.Parse("APP.proc1"))); return(true); }