Esempio n. 1
0
        public DataTypeInfo Instantiate(RelationalRow row)
        {
            DataTypeInfo dataTypeInfo = null;

            if (row.CharacterMaximumLength > 0)
            {
                dataTypeInfo = new TextInfo();
                ((TextInfo)dataTypeInfo).Length = row.CharacterMaximumLength;
                ((TextInfo)dataTypeInfo).CharSet = row.CharacterSetName;
                ((TextInfo)dataTypeInfo).Collation = row.CollationName;
                ((TextInfo)dataTypeInfo).Domain = row.DomainName;
            }
            else if (row.NumericScale > 0)
            {
                dataTypeInfo = new NumericInfo();
                ((NumericInfo)dataTypeInfo).Scale = row.NumericScale;
                ((NumericInfo)dataTypeInfo).Precision = row.NumericPrecision;
            }
            else if (row.DateTimePrecision > 0)
            {
                dataTypeInfo = new DateTimeInfo();
                ((DateTimeInfo)dataTypeInfo).Precision = row.DateTimePrecision;
            }
            else
            {
                dataTypeInfo = new DataTypeInfo();
            }

            dataTypeInfo.Name = row.DataType.ToLower();
            dataTypeInfo.Nullable = row.IsNullable.ToUpper() == "YES".ToUpper();
            return dataTypeInfo;
        }
Esempio n. 2
0
        public DataTypeInfo Instantiate(RelationalRow row)
        {
            DataTypeInfo dataTypeInfo = null;


            if (row.CharacterMaximumLength > 0)
            {
                dataTypeInfo = new TextInfo();
                ((TextInfo)dataTypeInfo).Length    = row.CharacterMaximumLength;
                ((TextInfo)dataTypeInfo).CharSet   = row.CharacterSetName;
                ((TextInfo)dataTypeInfo).Collation = row.CollationName;
                ((TextInfo)dataTypeInfo).Domain    = row.DomainName;
            }
            else if (row.NumericScale > 0)
            {
                dataTypeInfo = new NumericInfo();
                ((NumericInfo)dataTypeInfo).Scale     = row.NumericScale;
                ((NumericInfo)dataTypeInfo).Precision = row.NumericPrecision;
            }
            else if (row.DateTimePrecision > 0)
            {
                dataTypeInfo = new DateTimeInfo();
                ((DateTimeInfo)dataTypeInfo).Precision = row.DateTimePrecision;
            }
            else
            {
                dataTypeInfo = new DataTypeInfo();
            }

            dataTypeInfo.Name     = row.DataType.ToLower();
            dataTypeInfo.Nullable = row.IsNullable.ToUpper() == "YES".ToUpper();
            return(dataTypeInfo);
        }
Esempio n. 3
0
        protected DataTypeInfo Decrypt(string type)
        {
            DataTypeInfo value = null;

            switch (type)
            {
            case "bit":
                value = new DataTypeInfo();
                break;

            case "ntext":
            case "nvarchar":
            case "varchar":
            case "nchar":
            case "text":
            case "char":
                value = new TextInfo();
                break;

            case "smalldatetime":
            case "datetime":
                value = new DateTimeInfo();
                break;

            case "bigint":
            case "money":
            case "smallmoney":
            case "decimal":
            case "float":
            case "int":
            case "real":
            case "smallint":
            case "tinyint":
                value = new NumericInfo();
                break;

            default:
                value = new DataTypeInfo();
                break;
            }

            value.Name = type;
            return(value);
        }
Esempio n. 4
0
        protected DataTypeInfo Decrypt(string type)
        {
            DataTypeInfo value = null;
            switch (type)
            {
                case "bit":
                    value = new DataTypeInfo();
                    break;
                case "ntext":
                case "nvarchar":
                case "varchar":
                case "nchar":
                case "text":
                case "char":
                    value = new TextInfo();
                    break;
                case "smalldatetime":
                case "datetime":
                    value = new DateTimeInfo();
                    break;
                case "bigint":
                case "money":
                case "smallmoney":
                case "decimal":
                case "float":
                case "int":
                case "real":
                case "smallint":
                case "tinyint":
                    value = new NumericInfo();
                    break;
                default:
                    value = new DataTypeInfo();
                    break;
            }

            value.Name = type;
            return value;
        }