public void OnTableCompositeCreate(IQuery systemQuery) { // SYSTEM.SEQUENCE_INFO var tableInfo = new TableInfo(SequenceManager.SequenceInfoTableName); tableInfo.AddColumn("id", PrimitiveTypes.Numeric()); tableInfo.AddColumn("schema", PrimitiveTypes.String()); tableInfo.AddColumn("name", PrimitiveTypes.String()); tableInfo.AddColumn("type", PrimitiveTypes.Numeric()); tableInfo = tableInfo.AsReadOnly(); systemQuery.Access().CreateTable(tableInfo); // SYSTEM.SEQUENCE tableInfo = new TableInfo(SequenceManager.SequenceTableName); tableInfo.AddColumn("seq_id", PrimitiveTypes.Numeric()); tableInfo.AddColumn("last_value", PrimitiveTypes.Numeric()); tableInfo.AddColumn("increment", PrimitiveTypes.Numeric()); tableInfo.AddColumn("minvalue", PrimitiveTypes.Numeric()); tableInfo.AddColumn("maxvalue", PrimitiveTypes.Numeric()); tableInfo.AddColumn("start", PrimitiveTypes.Numeric()); tableInfo.AddColumn("cache", PrimitiveTypes.Numeric()); tableInfo.AddColumn("cycle", PrimitiveTypes.Boolean()); tableInfo = tableInfo.AsReadOnly(); systemQuery.Access().CreateTable(tableInfo); }
private static void Create(IQuery systemQuery) { // SYSTEM.ROUTINE systemQuery.Access() .CreateTable(table => table .Named(RoutineManager.RoutineTableName) .WithColumn("id", PrimitiveTypes.Numeric()) .WithColumn("schema", PrimitiveTypes.String()) .WithColumn("name", PrimitiveTypes.String()) .WithColumn("type", PrimitiveTypes.String()) .WithColumn("location", PrimitiveTypes.String()) .WithColumn("body", PrimitiveTypes.Binary()) .WithColumn("return_type", PrimitiveTypes.String()) .WithColumn("username", PrimitiveTypes.String())); // SYSTEM.ROUTINE_PARAM systemQuery.Access().CreateTable(table => table .Named(RoutineManager.RoutineParameterTableName) .WithColumn("routine_id", PrimitiveTypes.Numeric()) .WithColumn("arg_name", PrimitiveTypes.String()) .WithColumn("arg_type", PrimitiveTypes.String()) .WithColumn("arg_attrs", PrimitiveTypes.Numeric()) .WithColumn("in_out", PrimitiveTypes.Integer()) .WithColumn("offset", PrimitiveTypes.Integer())); }
private static void CreateTestTable(IQuery query) { var tableName1 = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => table .Named(tableName1) .WithColumn(column => column .Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant(tableName1.FullName) })) .NotNull()) .WithColumn("first_name", PrimitiveTypes.String()) .WithColumn("last_name", PrimitiveTypes.String()) .WithColumn("birth_date", PrimitiveTypes.DateTime()) .WithColumn("active", PrimitiveTypes.Boolean())); query.Session.Access().AddPrimaryKey(tableName1, "id", "PK_TEST_TABLE"); query.Access().CreateTable(table => table .Named("APP.test_table2") .WithColumn("person_id", PrimitiveTypes.Integer()) .WithColumn("value", PrimitiveTypes.Boolean())); var body = new PlSqlBlockStatement(); body.Statements.Add(new CallStatement(ObjectName.Parse("system.output"), new[] { new InvokeArgument(SqlExpression.Constant("One row was inserted")) })); var procedureInfo = new PlSqlProcedureInfo(ObjectName.Parse("APP.proc1"), new RoutineParameter[0], body); query.Access().CreateObject(procedureInfo); }
protected override bool OnTearDown(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().DropAllTableConstraints(tableName); query.Access().DropObject(DbObjectType.Table, tableName); return true; }
private void Create(IQuery systemQuery) { // SYSTEM.ROUTINE var tableInfo = new TableInfo(RoutineManager.RoutineTableName); tableInfo.AddColumn("id", PrimitiveTypes.Numeric()); tableInfo.AddColumn("schema", PrimitiveTypes.String()); tableInfo.AddColumn("name", PrimitiveTypes.String()); tableInfo.AddColumn("type", PrimitiveTypes.String()); tableInfo.AddColumn("location", PrimitiveTypes.String()); tableInfo.AddColumn("body", PrimitiveTypes.Binary()); tableInfo.AddColumn("return_type", PrimitiveTypes.String()); tableInfo.AddColumn("username", PrimitiveTypes.String()); systemQuery.Access().CreateTable(tableInfo); // SYSTEM.ROUTINE_PARAM tableInfo = new TableInfo(RoutineManager.RoutineParameterTableName); tableInfo.AddColumn("routine_id", PrimitiveTypes.Numeric()); tableInfo.AddColumn("arg_name", PrimitiveTypes.String()); tableInfo.AddColumn("arg_type", PrimitiveTypes.String()); tableInfo.AddColumn("arg_attrs", PrimitiveTypes.Numeric()); tableInfo.AddColumn("in_out", PrimitiveTypes.Integer()); tableInfo.AddColumn("offset", PrimitiveTypes.Integer()); systemQuery.Access().CreateTable(tableInfo); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DropObject(DbObjectType.Routine, procName); query.Access().DropObject(DbObjectType.Routine, funcName); return(true); }
private static void CreateTestTable(IQuery query, string testName) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => { table .Named(tableName) .WithColumn(column => column.Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant(tableName.FullName) }))) .WithColumn("first_name", PrimitiveTypes.String()) .WithColumn("last_name", PrimitiveTypes.String()) .WithColumn("birth_date", PrimitiveTypes.DateTime()) .WithColumn(column => column .Named("active") .HavingType(PrimitiveTypes.Boolean()) .NotNull(testName.Equals("NotNullColumnViolation"))); if (testName.EndsWith("WithLob")) { table.WithColumn("bio", PrimitiveTypes.Clob(2048)); } else if (testName.EndsWith("WithUserType")) { var userType = query.Access().ResolveUserType("type1"); table.WithColumn("user_obj", userType); } }); query.Access().AddPrimaryKey(tableName, "id", "PK_TEST_TABLE"); }
protected override bool OnSetUp(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); var tableInfo = new TableInfo(tableName); tableInfo.AddColumn("a", PrimitiveTypes.Integer()); tableInfo.AddColumn("b", PrimitiveTypes.String()); query.Access().CreateObject(tableInfo); var table = query.Access().GetMutableTable(tableName); for (int i = 0; i < 15; i++) { var aValue = Field.Integer(i * i); var bValue = Field.String(i.ToString()); var row = table.NewRow(); row.SetValue(0, aValue); row.SetValue(1, bValue); table.AddRow(row); } return(true); }
private static void CreateSystemRoles(IQuery query) { query.Access().CreateRole(SystemRoles.SecureAccessRole); query.Access().CreateRole(SystemRoles.UserManagerRole); query.Access().CreateRole(SystemRoles.SchemaManagerRole); query.Access().CreateRole(SystemRoles.LockedRole); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DropRole("role2"); query.Access().DropRole("test_role1"); query.Access().DeleteUser("test_user"); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DropObject(DbObjectType.Routine, ObjectName.Parse("APP.proc1")); query.Access().DropObject(DbObjectType.Routine, ObjectName.Parse("APP.proc2")); query.Access().DropObject(DbObjectType.Routine, ObjectName.Parse("APP.proc3")); query.Access().DropObject(DbObjectType.Routine, ObjectName.Parse("APP.extProc")); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { var tableName = ObjectName.Parse("SYSTEM.test_table"); query.Access().RevokeAllGrantsOn(DbObjectType.Table, tableName); query.Access().DropObject(DbObjectType.Table, tableName); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { var viewName = ObjectName.Parse("APP.text_view1"); query.Access().DropObject(DbObjectType.View, viewName); query.Access().DropObject(DbObjectType.Table, ObjectName.Parse("APP.test_table")); return true; }
protected override bool OnTearDown(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().DropAllTableConstraints(tableName); query.Access().DropObject(DbObjectType.Table, tableName); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().RevokeAllGrantsOn(DbObjectType.Table, tableName); query.Access().DropRole("test_role"); query.Access().DeleteUser("test_user"); query.Access().DropObject(DbObjectType.Table, tableName); return true; }
protected override bool OnTearDown(string testName, IQuery query) { var viewName = ObjectName.Parse("APP.text_view1"); query.Access().DropObject(DbObjectType.View, viewName); query.Access().DropObject(DbObjectType.Table, ObjectName.Parse("APP.test_table")); return(true); }
protected override bool OnSetUp(string testName, IQuery query) { query.Access().CreateUser("test_user", "0123456789"); query.Access().CreateRole("test_role1"); query.Access().CreateRole("role2"); if (testName == "Unlock") query.Access().SetUserStatus("test_user", UserStatus.Locked); return true; }
protected override bool OnSetUp(string testName, IQuery query) { query.Access().CreateUser("test_user", "0123456789"); query.Access().CreateRole("test_role1"); query.Access().CreateRole("role2"); if (testName == "Unlock") { query.Access().SetUserStatus("test_user", UserStatus.Locked); } return(true); }
private void CreateTables(IQuery query) { query.Access().CreateTable(table => table .Named("APP.test_table") .WithColumn("a", PrimitiveTypes.Integer()) .WithColumn("b", PrimitiveTypes.String())); query.Access().CreateTable(table => table .Named("APP.dest_table") .WithColumn("a", PrimitiveTypes.Integer()) .WithColumn("b", PrimitiveTypes.String())); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DeleteUser("test_user"); query.Access().DropRole("test_role"); var tableName1 = ObjectName.Parse("APP.test_table"); var tableName2 = ObjectName.Parse("APP.test_table2"); query.Access().DropAllTableConstraints(tableName1); query.Access().DropObject(DbObjectType.Table, tableName1); query.Access().DropObject(DbObjectType.Table, tableName2); return(true); }
protected override bool OnSetUp(string testName, IQuery query) { var tableName = ObjectName.Parse("SYSTEM.test_table"); var tableInfo = new TableInfo(tableName); tableInfo.AddColumn("a", PrimitiveTypes.Integer()); tableInfo.AddColumn("b", PrimitiveTypes.String()); query.Access().CreateObject(tableInfo); query.Access().GrantOnTable(tableName, User.PublicName, PrivilegeSets.TableAll); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DropObject(DbObjectType.Sequence, ObjectName.Parse("APP.seq1")); if (testName.EndsWith("TableId")) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().DropAllTableConstraints(tableName); query.Access().DropObject(DbObjectType.Table, tableName); } return(true); }
protected override bool OnTearDown(string testName, IQuery query) { query.Access().DeleteUser("test_user"); query.Access().DropRole("test_role"); var tableName1 = ObjectName.Parse("APP.test_table"); var tableName2 = ObjectName.Parse("APP.test_table2"); query.Access().DropAllTableConstraints(tableName1); query.Access().DropObject(DbObjectType.Table, tableName1); query.Access().DropObject(DbObjectType.Table, tableName2); return true; }
protected override bool OnTearDown(string testName, IQuery query) { var triggerName1 = ObjectName.Parse("APP.trigger1"); var triggerName2 = ObjectName.Parse("APP.trigger2"); var tableName = ObjectName.Parse("APP.test_table"); var procedurName = ObjectName.Parse("APP.proc1"); query.Access().DropObject(DbObjectType.Trigger, triggerName1); query.Access().DropObject(DbObjectType.Trigger, triggerName2); query.Access().DropObject(DbObjectType.Table, tableName); query.Access().DropObject(DbObjectType.Routine, procedurName); return(true); }
protected override bool OnSetUp(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => table .Named(tableName) .WithColumn("id", PrimitiveTypes.Integer())); query.Access().CreateUser("test_user", "0123456789"); query.Access().GrantOnTable(tableName, "test_user", Privileges.Alter); query.Access().CreateRole("test_role"); query.Access().AddUserToRole("test_user", "test_role"); return(true); }
protected override bool OnSetUp(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => table .Named(tableName) .WithColumn("id", PrimitiveTypes.Integer())); query.Access().CreateUser("test_user", "0123456789"); query.Access().GrantOnTable(tableName, "test_user", Privileges.Alter); query.Access().CreateRole("test_role"); query.Access().AddUserToRole("test_user", "test_role"); return true; }
protected override bool OnTearDown(string testName, IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().DropAllTableConstraints(tableName); query.Access().DropObject(DbObjectType.Table, tableName); if (testName.EndsWith("Violation") || testName.EndsWith("ConstraintCheck")) { tableName = ObjectName.Parse("APP.test_table2"); query.Access().DropAllTableConstraints(tableName); query.Access().DropObject(DbObjectType.Table, tableName); } return(true); }
private void CreateTable(IQuery query) { query.Access().CreateTable(table => table .Named("APP.test_table") .WithColumn("a", PrimitiveTypes.Integer()) .WithColumn("b", PrimitiveTypes.String())); }
protected override bool OnTearDown(string testName, IQuery query) { var procName = ObjectName.Parse("APP.proc1"); query.Access().DropObject(DbObjectType.Routine, procName); return(true); }
protected override bool OnSetUp(string testName, IQuery query) { var seqName = ObjectName.Parse("APP.seq1"); query.Access().CreateObject(new SequenceInfo(seqName, SqlNumber.Zero, SqlNumber.One, SqlNumber.Zero, new SqlNumber(Int64.MaxValue), Int32.MaxValue)); return true; }
protected override bool OnSetUp(string testName, IQuery query) { var seqName = ObjectName.Parse("APP.seq1"); query.Access().CreateObject(new SequenceInfo(seqName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int16.MaxValue), 256)); return true; }
private void CreateTestTable(IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => table .Named(tableName) .WithColumn(column => column .Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant("APP.test_table") }))) .WithColumn("name", PrimitiveTypes.String())); query.Access().AddPrimaryKey(tableName, "id"); }
private void InsertData(IQuery query) { var tableName = ObjectName.Parse("APP.persons"); var table = query.Access().GetMutableTable(tableName); var row = table.NewRow(); row["name"] = Field.String("Antonello Provenzano"); row["age"] = Field.Integer(36); row.SetDefault(query); table.AddRow(row); row = table.NewRow(); row["name"] = Field.String("Sebastiano Provenzano"); row["age"] = Field.Integer(35); row.SetDefault(query); table.AddRow(row); row = table.NewRow(); row["name"] = Field.String("Mart Rosmaa"); row["age"] = Field.Integer(33); row.SetDefault(query); table.AddRow(row); row = table.NewRow(); row["name"] = Field.String("Karl Inge Stensson"); row["age"] = Field.Integer(54); row.SetDefault(query); table.AddRow(row); }
private static void OpenAndAdvanceCursor(IQuery query) { var cursor = (Cursor)query.Access().GetObject(DbObjectType.Cursor, new ObjectName("c1")); cursor.Open(query); cursor.Fetch(FetchDirection.Next); }
protected override bool OnTearDown(string testName, IQuery query) { var seqName = ObjectName.Parse("APP.seq1"); query.Access().DropObject(DbObjectType.Sequence, seqName); return(true); }
private static void AddTestData(IQuery context) { var table = context.Access().GetMutableTable(ObjectName.Parse("APP.test_table")); var row = table.NewRow(); // row.SetValue("id", Field.Integer(0)); row.SetDefault(0, context); row.SetValue("first_name", Field.String("John")); row.SetValue("last_name", Field.String("Doe")); row.SetValue("birth_date", Field.Date(new SqlDateTime(1977, 01, 01))); row.SetValue("active", Field.Boolean(false)); table.AddRow(row); row = table.NewRow(); // row.SetValue("id", Field.Integer(1)); row.SetDefault(0, context); row.SetValue("first_name", Field.String("Jane")); row.SetValue("last_name", Field.String("Doe")); row.SetValue("birth_date", Field.Date(new SqlDateTime(1978, 11, 01))); row.SetValue("active", Field.Boolean(true)); table.AddRow(row); row = table.NewRow(); // row.SetValue("id", Field.Integer(2)); row.SetDefault(0, context); row.SetValue("first_name", Field.String("Roger")); row.SetValue("last_name", Field.String("Rabbit")); row.SetValue("birth_date", Field.Date(new SqlDateTime(1985, 05, 05))); row.SetValue("active", Field.Boolean(true)); table.AddRow(row); }
protected override bool OnTearDown(string testName, IQuery query) { var typeName = ObjectName.Parse("APP.type1"); query.Access().DropObject(DbObjectType.Type, typeName); return(true); }
private void CreateTable(IQuery query) { var tableName = ObjectName.Parse("APP.test_table"); query.Access().CreateTable(table => table .Named(tableName) .WithColumn(column => column .Named("id") .HavingType(PrimitiveTypes.Integer()) .WithDefault(SqlExpression.FunctionCall("UNIQUEKEY", new SqlExpression[] { SqlExpression.Constant(tableName.FullName) }))) .WithColumn("a", PrimitiveTypes.Integer()) .WithColumn("b", PrimitiveTypes.String())); query.Access().AddPrimaryKey(tableName, "id", "PK_TEST_TABLE"); }
private static void CreatePublicUser(IQuery query) { var userName = User.PublicName; var userId = new UserIdentification(KnownUserIdentifications.ClearText, "###"); var userInfo = new UserInfo(userName, userId); query.Access().CreateUser(userInfo); }
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; }
protected override bool OnSetUp(string testName, IQuery query) { var seqName = ObjectName.Parse("APP.seq1"); query.Access().CreateObject(new SequenceInfo(seqName, SqlNumber.Zero, SqlNumber.One, SqlNumber.Zero, new SqlNumber(Int64.MaxValue), Int32.MaxValue)); return(true); }
protected override bool OnTearDown(string testName, IQuery query) { if (testName != "RollbackTableCreate") { query.Access().DropObject(DbObjectType.Table, ObjectName.Parse("APP.test_table")); } return true; }
protected override bool OnSetUp(string testName, IQuery query) { query.Access().CreateTable(table => table .Named("APP.test_table") .WithColumn("a", PrimitiveTypes.Integer()) .WithColumn("b", PrimitiveTypes.String())); return true; }
protected override bool OnSetUp(string testName, IQuery query) { var tableInfo = new TableInfo(ObjectName.Parse("APP.test_table")); tableInfo.AddColumn("a", PrimitiveTypes.Integer()); query.Access().CreateObject(tableInfo); return true; }
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); }
private void CreateFunction(IQuery query) { var functionName = ObjectName.Parse("APP.func1"); var body = new PlSqlBlockStatement(); body.Statements.Add(new ReturnStatement(SqlExpression.Constant(200))); var functionInfo = new PlSqlFunctionInfo(functionName, new RoutineParameter[0], PrimitiveTypes.Integer(), body); query.Access().CreateRoutine(functionInfo); }
protected override bool OnSetUp(string testName, IQuery query) { if (testName == "Authenticate_Success") { query.Access().CreateUser("tester", "123456789"); } return true; }
private static void CreateTables(IQuery context) { var tableInfo = new TableInfo(UserManager.UserTableName); tableInfo.AddColumn("name", PrimitiveTypes.String()); // TODO: User table must be completed ... tableInfo = tableInfo.AsReadOnly(); context.Access().CreateTable(tableInfo); context.Access().AddPrimaryKey(UserManager.UserTableName, new[] { "name" }, "SYSTEM_USER_PK"); tableInfo = new TableInfo(UserManager.PasswordTableName); tableInfo.AddColumn("user", PrimitiveTypes.String()); tableInfo.AddColumn("method", PrimitiveTypes.String()); tableInfo.AddColumn("method_args", PrimitiveTypes.Binary()); tableInfo.AddColumn("identifier", PrimitiveTypes.String()); tableInfo = tableInfo.AsReadOnly(); context.Access().CreateTable(tableInfo); tableInfo = new TableInfo(UserManager.UserRoleTableName); tableInfo.AddColumn("user", PrimitiveTypes.String()); tableInfo.AddColumn("role", PrimitiveTypes.String()); tableInfo.AddColumn("admin", PrimitiveTypes.Boolean()); tableInfo = tableInfo.AsReadOnly(); context.Access().CreateTable(tableInfo); tableInfo = new TableInfo(UserManager.RoleTableName); tableInfo.AddColumn("name", PrimitiveTypes.String(), true); tableInfo = tableInfo.AsReadOnly(); context.Access().CreateTable(tableInfo); context.Access().AddPrimaryKey(UserManager.RoleTableName, new[] { "name" }, "SYSTEM_ROLE_PK"); var fkCol = new[] { "user" }; var rfkCol = new[] { "role" }; var refCol = new[] { "name" }; const ForeignKeyAction onUpdate = ForeignKeyAction.NoAction; const ForeignKeyAction onDelete = ForeignKeyAction.Cascade; context.Access().AddForeignKey(UserManager.PasswordTableName, fkCol, UserManager.UserTableName, refCol, onDelete, onUpdate, "USER_PASSWORD_FK"); context.Access().AddForeignKey(UserManager.UserRoleTableName, fkCol, UserManager.UserTableName, refCol, onDelete, onUpdate, "USER_PRIV_FK"); context.Access().AddForeignKey(UserManager.UserRoleTableName, rfkCol, UserManager.RoleTableName, refCol, onDelete, onUpdate, "USER_ROLE_FK"); }
private void AddForeignKeys(IQuery systemQuery) { var fkCol = new[] { "routine_id" }; var refCol = new[] { "id" }; const ForeignKeyAction onUpdate = ForeignKeyAction.NoAction; const ForeignKeyAction onDelete = ForeignKeyAction.Cascade; systemQuery.Access().AddForeignKey(RoutineManager.RoutineParameterTableName, fkCol, RoutineManager.RoutineTableName, refCol, onDelete, onUpdate, "ROUTINE_PARAMS_FK"); }
protected override bool OnSetUp(string testName, IQuery query) { var typeName = ObjectName.Parse("APP.type1"); var typeInfo = new UserTypeInfo(typeName); typeInfo.AddMember("a", PrimitiveTypes.Integer()); typeInfo.AddMember("b", PrimitiveTypes.DateTime()); query.Access().CreateObject(typeInfo); return true; }
private static void OnCompositeCreate(IQuery systemQuery) { // SYSTEM.SEQUENCE_INFO systemQuery.Access().CreateTable(table => table .Named(SequenceManager.SequenceInfoTableName) .WithColumn("id", PrimitiveTypes.Numeric()) .WithColumn("schema", PrimitiveTypes.String()) .WithColumn("name", PrimitiveTypes.String()) .WithColumn("type", PrimitiveTypes.Numeric())); //var tableInfo = new TableInfo(SequenceManager.SequenceInfoTableName); //tableInfo.AddColumn("id", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("schema", PrimitiveTypes.String()); //tableInfo.AddColumn("name", PrimitiveTypes.String()); //tableInfo.AddColumn("type", PrimitiveTypes.Numeric()); //tableInfo = tableInfo.AsReadOnly(); //systemQuery.Access().CreateTable(tableInfo); // SYSTEM.SEQUENCE systemQuery.Access().CreateTable(table => table .Named(SequenceManager.SequenceTableName) .WithColumn("seq_id", PrimitiveTypes.Numeric()) .WithColumn("last_value", PrimitiveTypes.Numeric()) .WithColumn("increment", PrimitiveTypes.Numeric()) .WithColumn("minvalue", PrimitiveTypes.Numeric()) .WithColumn("maxvalue", PrimitiveTypes.Numeric()) .WithColumn("start", PrimitiveTypes.Numeric()) .WithColumn("cache", PrimitiveTypes.Numeric()) .WithColumn("cycle", PrimitiveTypes.Boolean())); //tableInfo = new TableInfo(SequenceManager.SequenceTableName); //tableInfo.AddColumn("seq_id", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("last_value", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("increment", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("minvalue", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("maxvalue", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("start", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("cache", PrimitiveTypes.Numeric()); //tableInfo.AddColumn("cycle", PrimitiveTypes.Boolean()); //tableInfo = tableInfo.AsReadOnly(); //systemQuery.Access().CreateTable(tableInfo); }
protected override bool OnSetUp(string testName, IQuery query) { var procName = ObjectName.Parse("APP.proc1"); var body = new PlSqlBlockStatement(); body.Statements.Add(new AssignVariableStatement(SqlExpression.VariableReference("a"), SqlExpression.Constant(34))); var funtionInfo = new PlSqlProcedureInfo(procName, new RoutineParameter[0], body); query.Access().CreateObject(funtionInfo); return true; }
private static void OnCompositeCreate(IQuery systemQuery) { systemQuery.Access().CreateTable(table => table .Named(ViewManager.ViewTableName) .WithColumn("schema", PrimitiveTypes.String()) .WithColumn("name", PrimitiveTypes.String()) .WithColumn("query", PrimitiveTypes.String()) .WithColumn("plan", PrimitiveTypes.Binary())); // TODO: Columns... }
public void OnTableCompositeSetup(IQuery systemQuery) { var tableInfo = new TableInfo(SystemSchema.GrantsTableName); tableInfo.AddColumn("priv_bit", PrimitiveTypes.Numeric()); tableInfo.AddColumn("object", PrimitiveTypes.Numeric()); tableInfo.AddColumn("name", PrimitiveTypes.String()); tableInfo.AddColumn("grantee", PrimitiveTypes.String()); tableInfo.AddColumn("grant_option", PrimitiveTypes.Boolean()); tableInfo.AddColumn("granter", PrimitiveTypes.String()); tableInfo = tableInfo.AsReadOnly(); systemQuery.Access().CreateSystemTable(tableInfo); }
protected override bool OnSetUp(string testName, IQuery query) { var funcName = ObjectName.Parse("APP.func1"); var returnType = PrimitiveTypes.String(); var body = new PlSqlBlockStatement(); body.Statements.Add(new ReturnStatement(SqlExpression.Constant("Hello!"))); var funtionInfo = new PlSqlFunctionInfo(funcName, new RoutineParameter[0], returnType, body); query.Access().CreateObject(funtionInfo); return true; }
public void OnTableCompositeCreate(IQuery systemQuery) { var tableInfo = new TableInfo(TypeManager.TypeTableName); tableInfo.AddColumn("id", PrimitiveTypes.Integer()); tableInfo.AddColumn("schema", PrimitiveTypes.String(), true); tableInfo.AddColumn("name", PrimitiveTypes.String(), true); tableInfo.AddColumn("parent", PrimitiveTypes.String()); tableInfo.AddColumn("sealed", PrimitiveTypes.Boolean()); tableInfo.AddColumn("abstract", PrimitiveTypes.Boolean()); tableInfo.AddColumn("owner", PrimitiveTypes.String()); systemQuery.Access().CreateTable(tableInfo); tableInfo = new TableInfo(TypeManager.TypeMemberTableName); tableInfo.AddColumn("type_id", PrimitiveTypes.Integer()); tableInfo.AddColumn("name", PrimitiveTypes.String(), true); tableInfo.AddColumn("type", PrimitiveTypes.String()); systemQuery.Access().CreateTable(tableInfo); systemQuery.Access().AddPrimaryKey(TypeManager.TypeTableName, new[] { "id" }, "PK_TYPE"); systemQuery.Access().AddForeignKey(TypeManager.TypeMemberTableName, new[] { "type_id" }, TypeManager.TypeTableName, new[] { "id" }, ForeignKeyAction.Cascade, ForeignKeyAction.Cascade, "FK_MEMBER_TYPE"); }
public void OnTableCompositeCreate(IQuery systemQuery) { var tableInfo = new TableInfo(ViewManager.ViewTableName); tableInfo.AddColumn("schema", PrimitiveTypes.String()); tableInfo.AddColumn("name", PrimitiveTypes.String()); tableInfo.AddColumn("query", PrimitiveTypes.String()); tableInfo.AddColumn("plan", PrimitiveTypes.Binary()); // TODO: Columns... systemQuery.Access().CreateTable(tableInfo); }