Exemplo n.º 1
0
        public override DataTypeCollection GetDataTypesInfo()
        {
            const DataTypeFeatures common = DataTypeFeatures.Default | DataTypeFeatures.Nullable |
                                            DataTypeFeatures.NonKeyIndexing | DataTypeFeatures.Grouping | DataTypeFeatures.Ordering |
                                            DataTypeFeatures.Multiple;
            const DataTypeFeatures index = DataTypeFeatures.Indexing | DataTypeFeatures.Clustering |
                                           DataTypeFeatures.FillFactor | DataTypeFeatures.KeyConstraint;
            var types = new DataTypeCollection();

            types.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, common | index,
                                                    ValueRange.Decimal, 38, "number");
            types.Float = DataTypeInfo.Range(SqlType.Float, common | index,
                                             ValueRange.Float, "real");
            types.Double = DataTypeInfo.Range(SqlType.Double, common | index,
                                              ValueRange.Double, "double precision", "float");
            types.DateTime = DataTypeInfo.Range(SqlType.DateTime, common | index,
                                                ValueRange.DateTime, "timestamp");
            types.DateTimeOffset = DataTypeInfo.Range(SqlType.DateTimeOffset, common | index,
                                                      ValueRange.DateTimeOffset, "TIMESTAMP WITH TIME ZONE");
            types.Interval = DataTypeInfo.Range(SqlType.Interval, common | index,
                                                ValueRange.TimeSpan, "interval day to second");

            types.Char = DataTypeInfo.Stream(SqlType.Char,
                                             common | index | DataTypeFeatures.ZeroLengthValueIsNull, 2000, "nchar");
            types.VarChar = DataTypeInfo.Stream(SqlType.VarChar,
                                                common | index | DataTypeFeatures.ZeroLengthValueIsNull, 2000, "nvarchar2");
            types.VarCharMax   = DataTypeInfo.Regular(SqlType.VarCharMax, common, "nclob");
            types.VarBinaryMax = DataTypeInfo.Regular(SqlType.VarBinaryMax, common, "blob");
            return(types);
        }
Exemplo n.º 2
0
        public override DataTypeCollection GetDataTypesInfo()
        {
            var types = new DataTypeCollection();

            var common = DataTypeFeatures.Default | DataTypeFeatures.Nullable | DataTypeFeatures.NonKeyIndexing |
                         DataTypeFeatures.Grouping | DataTypeFeatures.Ordering | DataTypeFeatures.Multiple;

            var index = DataTypeFeatures.Indexing | DataTypeFeatures.Clustering |
                        DataTypeFeatures.FillFactor | DataTypeFeatures.KeyConstraint;

            var identity = DataTypeFeatures.Identity;

            types.Boolean = DataTypeInfo.Range(SqlType.Boolean, common | index,
                                               ValueRange.Bool, "bit");

            types.UInt8 = DataTypeInfo.Range(SqlType.UInt8, common | index | identity,
                                             ValueRange.Byte, "tinyint");

            types.Int16 = DataTypeInfo.Range(SqlType.Int16, common | index | identity,
                                             ValueRange.Int16, "smallint");

            types.Int32 = DataTypeInfo.Range(SqlType.Int32, common | index | identity,
                                             ValueRange.Int32, "integer", "int");

            types.Int64 = DataTypeInfo.Range(SqlType.Int64, common | index | identity,
                                             ValueRange.Int64, "bigint");

            types.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, common | index,
                                                    ValueRange.Decimal, 38, "decimal", "numeric");

            types.Float = DataTypeInfo.Range(SqlType.Float, common | index,
                                             ValueRange.Float, "real");

            types.Double = DataTypeInfo.Range(SqlType.Double, common | index,
                                              ValueRange.Double, "float");

            types.DateTime = DataTypeInfo.Range(SqlType.DateTime, common | index,
                                                new ValueRange <DateTime>(new DateTime(1753, 1, 1), new DateTime(9999, 12, 31)),
                                                "datetime", "smalldatetime");

            types.Char       = DataTypeInfo.Stream(SqlType.Char, common | index, 4000, "nchar", "char");
            types.VarChar    = DataTypeInfo.Stream(SqlType.VarChar, common | index, 4000, "nvarchar", "varchar");
            types.VarCharMax = DataTypeInfo.Regular(SqlType.VarCharMax, common, "nvarchar(max)", "ntext", "varchar(max)", "text", "xml");

            types.Binary       = DataTypeInfo.Stream(SqlType.Binary, common | index, 4000, "binary");
            types.VarBinary    = DataTypeInfo.Stream(SqlType.VarBinary, common | index, 4000, "varbinary");
            types.VarBinaryMax = DataTypeInfo.Regular(SqlType.VarBinaryMax, common, "varbinary(max)", "image");

            types.Guid = DataTypeInfo.Regular(SqlType.Guid, common | index, "uniqueidentifier");

            return(types);
        }
        /// <inheritdoc/>
        public override DataTypeCollection GetDataTypesInfo()
        {
            var types = new DataTypeCollection();

            DataTypeFeatures common = DataTypeFeatures.Default | DataTypeFeatures.Nullable | DataTypeFeatures.NonKeyIndexing |
                                      DataTypeFeatures.Grouping | DataTypeFeatures.Ordering | DataTypeFeatures.Multiple;

            DataTypeFeatures index = DataTypeFeatures.Indexing | DataTypeFeatures.KeyConstraint;

            DataTypeFeatures identity = DataTypeFeatures.Identity;

            types.Boolean = DataTypeInfo.Range(SqlType.Boolean, common | index,
                                               ValueRange.Bool, "boolean");

            types.Int8 = DataTypeInfo.Range(SqlType.Int8, common | index | identity,
                                            ValueRange.Byte, "tinyint");

            types.Int16 = DataTypeInfo.Range(SqlType.Int16, common | index | identity,
                                             ValueRange.Int16, "smallint");

            types.Int32 = DataTypeInfo.Range(SqlType.Int32, common | index | identity,
                                             ValueRange.Int32, "int");

            types.Int64 = DataTypeInfo.Range(SqlType.Int64, common | index | identity,
                                             ValueRange.Int64, "bigint");

            types.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, common | index,
                                                    ValueRange.Decimal, 38, "decimal", "numeric", "year");

            types.Float = DataTypeInfo.Range(SqlType.Float, common | index,
                                             ValueRange.Float, "float");

            types.Double = DataTypeInfo.Range(SqlType.Double, common | index,
                                              ValueRange.Double, "double precision");

            types.DateTime = DataTypeInfo.Range(SqlType.DateTime, common | index,
                                                new ValueRange <DateTime>(new DateTime(1000, 1, 1), new DateTime(9999, 12, 31)),
                                                "datetime", "time");

            types.Char    = DataTypeInfo.Stream(SqlType.Char, common | index, 255, "char");
            types.VarChar = DataTypeInfo.Stream(SqlType.VarChar, common | index, 4000, "varchar");

            types.VarCharMax = DataTypeInfo.Regular(SqlType.VarCharMax, common, "longtext");

            types.Binary       = DataTypeInfo.Stream(SqlType.Binary, common | index, 255, "binary");
            types.VarBinary    = DataTypeInfo.Stream(SqlType.VarBinary, common | index, 4000, "varbinary");
            types.VarBinaryMax = DataTypeInfo.Regular(SqlType.VarBinaryMax, common, "longblob");
            //types.Guid = DataTypeInfo.Regular(SqlType.Guid, common | index, "uuid()");

            return(types);
        }
        public override DataTypeCollection GetDataTypesInfo()
        {
            var commonFeatures =
                DataTypeFeatures.Grouping |
                DataTypeFeatures.Indexing |
                DataTypeFeatures.KeyConstraint |
                DataTypeFeatures.Nullable |
                DataTypeFeatures.Ordering |
                DataTypeFeatures.Multiple |
                DataTypeFeatures.Default;
            var lobFeatures =
                DataTypeFeatures.Nullable |
                DataTypeFeatures.Multiple |
                DataTypeFeatures.Default;

            var dtc = new DataTypeCollection();

            dtc.Int16 = DataTypeInfo.Range(SqlType.Int16, commonFeatures,
                                           ValueRange.Int16,
                                           "smallint");

            dtc.Int32 = DataTypeInfo.Range(SqlType.Int32, commonFeatures,
                                           ValueRange.Int32, "integer");

            dtc.Int64 = DataTypeInfo.Range(SqlType.Int64, commonFeatures,
                                           ValueRange.Int64, "bigint");

            dtc.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, commonFeatures,
                                                  ValueRange.Decimal, 18, "numeric", "decimal");

            dtc.Float = DataTypeInfo.Range(SqlType.Float, commonFeatures,
                                           ValueRange.Float, "float");

            dtc.Double = DataTypeInfo.Range(SqlType.Double, commonFeatures,
                                            ValueRange.Double, "double precision");

            dtc.DateTime = DataTypeInfo.Range(SqlType.DateTime, commonFeatures,
                                              ValueRange.DateTime, "timestamp");

            dtc.Char         = DataTypeInfo.Stream(SqlType.Char, commonFeatures, MaxCharLength, "char");
            dtc.VarChar      = DataTypeInfo.Stream(SqlType.VarChar, commonFeatures, MaxCharLength, "varchar");
            dtc.VarCharMax   = DataTypeInfo.Stream(SqlType.VarCharMax, lobFeatures, MaxTextLength, "blob sub_type 1");
            dtc.VarBinaryMax = DataTypeInfo.Stream(SqlType.VarBinaryMax, lobFeatures, MaxTextLength, "blob sub_type 0");

            return(dtc);
        }
        public override DataTypeCollection GetDataTypesInfo()
        {
            var commonFeatures =
                DataTypeFeatures.Clustering |
                DataTypeFeatures.Grouping |
                DataTypeFeatures.Indexing |
                DataTypeFeatures.KeyConstraint |
                DataTypeFeatures.Nullable |
                DataTypeFeatures.Ordering |
                DataTypeFeatures.Multiple |
                DataTypeFeatures.Default;

            var dtc = new DataTypeCollection();

            dtc.Boolean = DataTypeInfo.Range(SqlType.Boolean, commonFeatures,
                                             ValueRange.Bool, "boolean", "bool");

            dtc.Int16 = DataTypeInfo.Range(SqlType.Int16, commonFeatures,
                                           ValueRange.Int16,
                                           "smallint", "int2");

            dtc.Int32 = DataTypeInfo.Range(SqlType.Int32, commonFeatures,
                                           ValueRange.Int32, "integer", "int4");

            dtc.Int64 = DataTypeInfo.Range(SqlType.Int64, commonFeatures,
                                           ValueRange.Int64, "bigint", "int8");

            dtc.Decimal = DataTypeInfo.Fractional(SqlType.Decimal, commonFeatures,
                                                  ValueRange.Decimal, 49, "numeric", "decimal");

            dtc.Float = DataTypeInfo.Range(SqlType.Float, commonFeatures,
                                           ValueRange.Float, "real", "float4");

            dtc.Double = DataTypeInfo.Range(SqlType.Double, commonFeatures,
                                            ValueRange.Double, "double precision", "float8");

            dtc.DateTime = DataTypeInfo.Range(SqlType.DateTime, commonFeatures,
                                              ValueRange.DateTime, "timestamp");

            dtc.Interval = DataTypeInfo.Range(SqlType.Interval, commonFeatures,
                                              ValueRange.TimeSpan, "interval");

            dtc.Char         = DataTypeInfo.Stream(SqlType.Char, commonFeatures, MaxCharLength, "character", "char", "bpchar");
            dtc.VarChar      = DataTypeInfo.Stream(SqlType.VarChar, commonFeatures, MaxCharLength, "character varying", "varchar");
            dtc.VarCharMax   = DataTypeInfo.Regular(SqlType.VarCharMax, commonFeatures, "text");
            dtc.VarBinaryMax = DataTypeInfo.Stream(SqlType.VarBinaryMax, commonFeatures, MaxTextLength, "bytea");

            dtc.DateTimeOffset = DataTypeInfo.Range(SqlType.DateTimeOffset, commonFeatures,
                                                    new ValueRange <DateTimeOffset>(new DateTimeOffset(1, 1, 1, 0, 0, 0, 0, new TimeSpan(0)),
                                                                                    new DateTimeOffset(9999, 12, 31, 0, 0, 0, 0, new TimeSpan(0))),
                                                    "timestamptz");

            var geo = DataTypeFeatures.Default | DataTypeFeatures.Nullable | DataTypeFeatures.Multiple | DataTypeFeatures.Spatial;

            dtc.Add(CustomSqlType.Point, DataTypeInfo.Regular(CustomSqlType.Point, geo, "point"));
            dtc.Add(CustomSqlType.LSeg, DataTypeInfo.Regular(CustomSqlType.LSeg, geo, "lseg"));
            dtc.Add(CustomSqlType.Box, DataTypeInfo.Regular(CustomSqlType.Box, geo, "box"));
            dtc.Add(CustomSqlType.Path, DataTypeInfo.Regular(CustomSqlType.Path, geo, "path"));
            dtc.Add(CustomSqlType.Polygon, DataTypeInfo.Regular(CustomSqlType.Polygon, geo, "polygon"));
            dtc.Add(CustomSqlType.Circle, DataTypeInfo.Regular(CustomSqlType.Circle, geo, "circle"));

            return(dtc);
        }