예제 #1
0
        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);
        }
        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()));
        }
예제 #3
0
        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...
        }
예제 #4
0
        protected override void OnInit()
        {
            Register(config => config.Named("from_wkb")
                     .WithParameter(p => p.Named("source").OfType(PrimitiveTypes.Binary()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.FromWkb(args[0])))
                     .ReturnsType(SpatialType.Geometry()));

            Register(config => config.Named("from_wkt")
                     .WithParameter(p => p.Named("source").OfType(PrimitiveTypes.String()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.FromWkt(context.Request, args[0])))
                     .ReturnsType(SpatialType.Geometry()));

            Register(config => config.Named("to_wkt")
                     .WithParameter(p => p.Named("g").OfType(SpatialType.Geometry()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.ToWkt(args[0])))
                     .ReturnsString());

            Register(config => config.Named("to_wkb")
                     .WithParameter(p => p.Named("g").OfType(SpatialType.Geometry()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.ToWkb(args[0])))
                     .ReturnsBinary());

            Register(config => config.Named("envelope")
                     .WithParameter(p => p.Named("g").OfType(SpatialType.Geometry()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.Envelope(args[0])))
                     .ReturnsType(SpatialType.Geometry()));

            Register(config => config.Named("distance")
                     .WithParameter(p => p.Named("g1").OfType(SpatialType.Geometry()))
                     .WithParameter(p => p.Named("g2").OfType(SpatialType.Geometry()))
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.Distance(args[0], args[1])))
                     .ReturnsNumeric());

            Register(config => config.Named("contains")
                     .WithSpatialParameter("g1")
                     .WithSpatialParameter("g2")
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.Contains(args[0], args[1])))
                     .ReturnsBoolean());

            Register(config => config.Named("area")
                     .WithSpatialParameter("g")
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.Area(args[0])))
                     .ReturnsSpatialType());

            Register(config => config.Named("boundary")
                     .WithSpatialParameter("g")
                     .WhenExecute(context => Simple(context, args => SpatialSystemFunctions.Boundary(args[0])))
                     .ReturnsSpatialType());


            // TODO: Implement the functions
        }
        internal SqlType GetSqlType()
        {
            switch (SqlType)
            {
            case SqlTypeCode.Boolean:
            case SqlTypeCode.Bit:
                return(PrimitiveTypes.Boolean(SqlType));

            case SqlTypeCode.TinyInt:
            case SqlTypeCode.SmallInt:
            case SqlTypeCode.Integer:
            case SqlTypeCode.BigInt:
                return(PrimitiveTypes.Numeric(SqlType));

            case SqlTypeCode.Real:
            case SqlTypeCode.Float:
            case SqlTypeCode.Decimal:
            case SqlTypeCode.Double:
            case SqlTypeCode.Numeric:
                return(PrimitiveTypes.Numeric(SqlType, Precision, Scale));

            case SqlTypeCode.String:
            case SqlTypeCode.Char:
            case SqlTypeCode.VarChar:
                return(PrimitiveTypes.String(SqlType, Size));

            case SqlTypeCode.Binary:
            case SqlTypeCode.VarBinary:
                return(PrimitiveTypes.Binary(SqlType, Size));

            case SqlTypeCode.Time:
            case SqlTypeCode.Date:
            case SqlTypeCode.DateTime:
            case SqlTypeCode.TimeStamp:
                return(PrimitiveTypes.DateTime(SqlType));

            case SqlTypeCode.DayToSecond:
            case SqlTypeCode.YearToMonth:
                return(PrimitiveTypes.Interval(SqlType));

            case SqlTypeCode.Clob:
            case SqlTypeCode.LongVarChar:
                return(PrimitiveTypes.Clob(Size));

            case SqlTypeCode.Blob:
            case SqlTypeCode.LongVarBinary:
                return(PrimitiveTypes.Blob(Size));

            default:
                throw new NotSupportedException();
            }
        }
예제 #6
0
        public void Create()
        {
            var tableInfo = new TableInfo(SystemSchema.TriggerTableName);

            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("type", PrimitiveTypes.Integer());
            tableInfo.AddColumn("on_object", PrimitiveTypes.String());
            tableInfo.AddColumn("action", PrimitiveTypes.Integer());
            tableInfo.AddColumn("procedure_name", PrimitiveTypes.String());
            tableInfo.AddColumn("args", PrimitiveTypes.Binary());
            transaction.CreateTable(tableInfo);
        }
예제 #7
0
        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);
        }
예제 #8
0
        public void Create()
        {
            var tableInfo = new TableInfo(SystemSchema.ViewTableName);

            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("query", PrimitiveTypes.String());
            tableInfo.AddColumn("plan", PrimitiveTypes.Binary());

            // TODO: Columns...

            Transaction.CreateTable(tableInfo);
        }
        private void ConversionFunctions()
        {
            Register(config => config.Named("cast")
                     .WithDynamicParameter("value")
                     .WithStringParameter("destType")
                     .WhenExecute(Cast.Execute)
                     .ReturnsType(Cast.ReturnType));

            Register(config => config.Named("tonumber")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToNumber(args[0])))
                     .ReturnsNumeric());

            Register(config => config.Named("tostring")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToString(args[0])))
                     .ReturnsString());

            Register(config => config.Named("tobinary")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToBinary(args[0])))
                     .ReturnsType(PrimitiveTypes.Binary()));

            // Date Conversions
            Register(config => config.Named("todate")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, objects => SystemFunctions.ToDate(objects[0])))
                     .ReturnsType(PrimitiveTypes.Date()));

            Register(config => config.Named("todatetime")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToDateTime(args[0])))
                     .ReturnsType(PrimitiveTypes.DateTime()));

            Register(config => config.Named("totimestamp")
                     .WithParameter(p => p.Named("value").OfStringType())
                     .WithParameter(p => p.Named("ts").OfStringType())
                     .WhenExecute(context => {
                if (context.ArgumentCount == 1)
                {
                    return(Simple(context, args => SystemFunctions.ToTimeStamp(args[0])));
                }
                if (context.ArgumentCount == 2)
                {
                    return(Simple(context, args => SystemFunctions.ToTimeStamp(args[0], args[1])));
                }

                throw new InvalidOperationException("Invalid number of arguments for TOTIMESTAMP function");
            })
                     .ReturnsType(PrimitiveTypes.TimeStamp()));
        }
 private static void OnCompositeCreate(IQuery systemQuery)
 {
     systemQuery.Access().CreateTable(table => table
                                      .Named(TriggerManager.TriggerTableName)
                                      .WithColumn("schema", PrimitiveTypes.String())
                                      .WithColumn("name", PrimitiveTypes.String())
                                      .WithColumn("type", PrimitiveTypes.Integer())
                                      .WithColumn("on_object", PrimitiveTypes.String())
                                      .WithColumn("time", PrimitiveTypes.Integer())
                                      .WithColumn("action", PrimitiveTypes.Integer())
                                      .WithColumn("procedure_name", PrimitiveTypes.String())
                                      .WithColumn("args", PrimitiveTypes.Binary())
                                      .WithColumn("body", PrimitiveTypes.Binary())
                                      .WithColumn("status", PrimitiveTypes.TinyInt()));
 }
예제 #11
0
        public void OnTableCompositeCreate(IQuery systemQuery)
        {
            var tableInfo = new TableInfo(TriggerManager.TriggerTableName);

            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("type", PrimitiveTypes.Integer());
            tableInfo.AddColumn("on_object", PrimitiveTypes.String());
            tableInfo.AddColumn("time", PrimitiveTypes.Integer());
            tableInfo.AddColumn("action", PrimitiveTypes.Integer());
            tableInfo.AddColumn("procedure_name", PrimitiveTypes.String());
            tableInfo.AddColumn("args", PrimitiveTypes.Binary());
            tableInfo.AddColumn("body", PrimitiveTypes.Binary());
            tableInfo.AddColumn("status", PrimitiveTypes.TinyInt());
            systemQuery.Access().CreateTable(tableInfo);
        }
예제 #12
0
        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");
        }
예제 #13
0
        public static DataObject ExtractValue(DataObject obj, DataObject xpath)
        {
            var result = ExtractValue(GetXmlNode(obj), GetXPath(xpath));

            SqlType resultType = PrimitiveTypes.String();

            if (result is ISqlBinary)
            {
                resultType = PrimitiveTypes.Binary();
            }
            else if (result is SqlNumber)
            {
                resultType = PrimitiveTypes.Numeric();
            }

            // TODO: Support more types

            return(new DataObject(resultType, result));
        }
예제 #14
0
        private void AddConversionFunctions()
        {
            Register(config => config.Named("cast")
                     .WithDynamicParameter("value")
                     .WithStringParameter("destType")
                     .WhenExecute(Cast.Execute)
                     .ReturnsType(Cast.ReturnType));

            Register(config => config.Named("tonumber")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToNumber(args[0])))
                     .ReturnsNumeric());

            Register(config => config.Named("tostring")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToString(args[0])))
                     .ReturnsString());

            Register(config => config.Named("tobinary")
                     .WithDynamicParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToBinary(args[0])))
                     .ReturnsType(PrimitiveTypes.Binary()));

            // Date Conversions
            Register(config => config.Named("todate")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, objects => SystemFunctions.ToDate(objects[0])))
                     .ReturnsType(PrimitiveTypes.Date()));

            Register(config => config.Named("todatetime")
                     .WithStringParameter("value")
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToDateTime(args[0])))
                     .ReturnsType(PrimitiveTypes.DateTime()));

            Register(config => config.Named("totimestamp")
                     .WithParameter(p => p.Named("value").OfStringType())
                     .WhenExecute(context => Simple(context, args => SystemFunctions.ToTimeStamp(args[0])))
                     .ReturnsType(PrimitiveTypes.TimeStamp()));
        }
예제 #15
0
        private static void CreateSecurityTables(IQuery context)
        {
            var tableInfo = new TableInfo(UserTableName);

            tableInfo.AddColumn("name", PrimitiveTypes.String());
            // TODO: User table must be completed ...
            tableInfo = tableInfo.AsReadOnly();
            context.CreateSystemTable(tableInfo);

            context.AddPrimaryKey(UserTableName, new [] { "name" }, "SYSTEM_USER_PK");

            tableInfo = new TableInfo(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.CreateSystemTable(tableInfo);

            tableInfo = new TableInfo(UserGroupTableName);
            tableInfo.AddColumn("user", PrimitiveTypes.String());
            tableInfo.AddColumn("group", PrimitiveTypes.String());
            tableInfo.AddColumn("admin", PrimitiveTypes.Boolean());
            tableInfo = tableInfo.AsReadOnly();
            context.CreateSystemTable(tableInfo);

            tableInfo = new TableInfo(GroupsTableName);
            tableInfo.AddColumn("name", PrimitiveTypes.String(), true);
            tableInfo = tableInfo.AsReadOnly();
            context.CreateSystemTable(tableInfo);

            context.AddPrimaryKey(GroupsTableName, new[] { "name" }, "SYSTEM_GROUP_PK");

            tableInfo = new TableInfo(UserGrantsTableName);
            tableInfo.AddColumn("priv_bit", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("object", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("user", PrimitiveTypes.String());
            tableInfo.AddColumn("grant_option", PrimitiveTypes.Boolean());
            tableInfo.AddColumn("granter", PrimitiveTypes.String());
            tableInfo = tableInfo.AsReadOnly();
            context.CreateSystemTable(tableInfo);

            tableInfo = new TableInfo(GroupGrantsTable);
            tableInfo.AddColumn("priv_bit", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("object", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("group", PrimitiveTypes.String());
            tableInfo.AddColumn("grant_option", PrimitiveTypes.Boolean());
            tableInfo.AddColumn("granter", PrimitiveTypes.String());

            var fkCol  = new[] { "user" };
            var gfkCol = new[] { "group" };
            var refCol = new[] { "name" };
            const ForeignKeyAction onUpdate = ForeignKeyAction.NoAction;
            const ForeignKeyAction onDelete = ForeignKeyAction.Cascade;

            context.AddForeignKey(PasswordTableName, fkCol, UserTableName, refCol, onDelete, onUpdate, "USER_PASSWORD_FK");
            context.AddForeignKey(UserGroupTableName, fkCol, UserTableName, refCol, onDelete, onUpdate, "USER_PRIV_FK");
            context.AddForeignKey(UserGroupTableName, gfkCol, GroupsTableName, refCol, onDelete, onUpdate, "USER_GROUP_FK");
            context.AddForeignKey(UserGrantsTableName, fkCol, UserTableName, refCol, onDelete, onUpdate, "USER_GRANTS_FK");
            context.AddForeignKey(GroupGrantsTable, gfkCol, GroupsTableName, refCol, onDelete, onUpdate, "GROUP_GRANTS_FK");
        }
예제 #16
0
 public static Field ToBinary(Field value)
 {
     return(value.CastTo(PrimitiveTypes.Binary()));
 }
 public static IFunctionConfiguration ReturnsBinary(this IFunctionConfiguration configuration)
 {
     return(configuration.ReturnsType(PrimitiveTypes.Binary()));
 }
        private static void OnCompositeCreate(IQuery systemQuery)
        {
            // SYSTEM.PKEY_INFO
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.PrimaryKeyInfoTableName)
                                             .WithColumn("id", PrimitiveTypes.Numeric())
                                             .WithColumn("name", PrimitiveTypes.String())
                                             .WithColumn("schema", PrimitiveTypes.String())
                                             .WithColumn("table", PrimitiveTypes.String())
                                             .WithColumn("deferred", PrimitiveTypes.Numeric()));

            // SYSTEM.PKEY_COLS
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.PrimaryKeyColumnsTableName)
                                             .WithColumn("pk_id", PrimitiveTypes.Numeric())
                                             .WithColumn("column", PrimitiveTypes.String())
                                             .WithColumn("seq_no", PrimitiveTypes.Numeric()));

            // SYSTEM.FKEY_INFO
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.ForeignKeyInfoTableName)
                                             .WithColumn("id", PrimitiveTypes.Numeric())
                                             .WithColumn("name", PrimitiveTypes.String())
                                             .WithColumn("schema", PrimitiveTypes.String())
                                             .WithColumn("table", PrimitiveTypes.String())
                                             .WithColumn("ref_schema", PrimitiveTypes.String())
                                             .WithColumn("ref_table", PrimitiveTypes.String())
                                             .WithColumn("update_rule", PrimitiveTypes.Numeric())
                                             .WithColumn("delete_rule", PrimitiveTypes.Numeric())
                                             .WithColumn("deferred", PrimitiveTypes.Numeric()));

            // SYSTEM.FKEY_COLS
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.ForeignKeyColumnsTableName)
                                             .WithColumn("fk_id", PrimitiveTypes.Numeric())
                                             .WithColumn("fcolumn", PrimitiveTypes.String())
                                             .WithColumn("pcolumn", PrimitiveTypes.String())
                                             .WithColumn("seq_no", PrimitiveTypes.Numeric()));

            // SYSTEM.UNIQUE_INFO
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.UniqueKeyInfoTableName)
                                             .WithColumn("id", PrimitiveTypes.Numeric())
                                             .WithColumn("name", PrimitiveTypes.String())
                                             .WithColumn("schema", PrimitiveTypes.String())
                                             .WithColumn("table", PrimitiveTypes.String())
                                             .WithColumn("deferred", PrimitiveTypes.Numeric()));

            // SYSTEM.UNIQUE_COLS
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.UniqueKeyColumnsTableName)
                                             .WithColumn("un_id", PrimitiveTypes.Numeric())
                                             .WithColumn("column", PrimitiveTypes.String())
                                             .WithColumn("seq_no", PrimitiveTypes.Numeric()));

            // SYSTEM.CHECK_INFO
            systemQuery.Access().CreateTable(table => table
                                             .Named(SystemSchema.CheckInfoTableName)
                                             .WithColumn("id", PrimitiveTypes.Numeric())
                                             .WithColumn("name", PrimitiveTypes.String())
                                             .WithColumn("schema", PrimitiveTypes.String())
                                             .WithColumn("table", PrimitiveTypes.String())
                                             .WithColumn("expression", PrimitiveTypes.String())
                                             .WithColumn("deferred", PrimitiveTypes.Numeric())
                                             .WithColumn("serialized_expression", PrimitiveTypes.Binary()));
        }
예제 #19
0
 public static DataObject ToBinary(DataObject value)
 {
     return(value.CastTo(PrimitiveTypes.Binary()));
 }
예제 #20
0
        public void OnTableCompositeCreate(IQuery systemQuery)
        {
            // SYSTEM.PKEY_INFO
            var tableInfo = new TableInfo(SystemSchema.PrimaryKeyInfoTableName);

            tableInfo.AddColumn("id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("table", PrimitiveTypes.String());
            tableInfo.AddColumn("deferred", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.PKEY_COLS
            tableInfo = new TableInfo(SystemSchema.PrimaryKeyColumnsTableName);
            tableInfo.AddColumn("pk_id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("column", PrimitiveTypes.String());
            tableInfo.AddColumn("seq_no", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.FKEY_INFO
            tableInfo = new TableInfo(SystemSchema.ForeignKeyInfoTableName);
            tableInfo.AddColumn("id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("table", PrimitiveTypes.String());
            tableInfo.AddColumn("ref_schema", PrimitiveTypes.String());
            tableInfo.AddColumn("ref_table", PrimitiveTypes.String());
            tableInfo.AddColumn("update_rule", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("delete_rule", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("deferred", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.FKEY_COLS
            tableInfo = new TableInfo(SystemSchema.ForeignKeyColumnsTableName);
            tableInfo.AddColumn("fk_id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("fcolumn", PrimitiveTypes.String());
            tableInfo.AddColumn("pcolumn", PrimitiveTypes.String());
            tableInfo.AddColumn("seq_no", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.UNIQUE_INFO
            tableInfo = new TableInfo(SystemSchema.UniqueKeyInfoTableName);
            tableInfo.AddColumn("id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("table", PrimitiveTypes.String());
            tableInfo.AddColumn("deferred", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.UNIQUE_COLS
            tableInfo = new TableInfo(SystemSchema.UniqueKeyColumnsTableName);
            tableInfo.AddColumn("un_id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("column", PrimitiveTypes.String());
            tableInfo.AddColumn("seq_no", PrimitiveTypes.Numeric());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);

            // SYSTEM.CHECK_INFO
            tableInfo = new TableInfo(SystemSchema.CheckInfoTableName);
            tableInfo.AddColumn("id", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("name", PrimitiveTypes.String());
            tableInfo.AddColumn("schema", PrimitiveTypes.String());
            tableInfo.AddColumn("table", PrimitiveTypes.String());
            tableInfo.AddColumn("expression", PrimitiveTypes.String());
            tableInfo.AddColumn("deferred", PrimitiveTypes.Numeric());
            tableInfo.AddColumn("serialized_expression", PrimitiveTypes.Binary());
            tableInfo = tableInfo.AsReadOnly();
            systemQuery.Access().CreateTable(tableInfo);
        }