Beispiel #1
0
        public override DataTypeInfo Execute()
        {
            RelationalRow row = null;

            command.Connection.Open();
            var rdr = ExecuteReader(command);

            if (rdr.Read())
            {
                row                        = new RelationalRow();
                row.IsNullable             = rdr.GetString(0);
                row.DataType               = rdr.GetString(1);
                row.CharacterMaximumLength = rdr.IsDBNull(2) ? 0 : rdr.GetInt32(2);
                row.NumericPrecision       = rdr.IsDBNull(3) ? 0 : rdr.GetByte(3);
                row.NumericScale           = rdr.IsDBNull(4) ? 0 : rdr.GetInt32(4);
                row.DateTimePrecision      = rdr.IsDBNull(5) ? 0 : rdr.GetInt16(5);
                row.CharacterSetName       = rdr.IsDBNull(6) ? string.Empty : rdr.GetString(6);
                row.CollationName          = rdr.IsDBNull(7) ? string.Empty : rdr.GetString(7);
                row.DomainName             = rdr.IsDBNull(8) ? string.Empty : rdr.GetString(8);
            }
            command.Connection.Close();

            if (row != null)
            {
                var factory      = new DataTypeInfoFactory();
                var dataTypeInfo = factory.Instantiate(row);
                return(dataTypeInfo);
            }
            else
            {
                return(null);
            }
        }
        public override DataTypeInfo Execute()
        {
            RelationalRow row = null;

            command.Connection.Open();
            var rdr = ExecuteReader(command);
            if (rdr.Read())
            {
                row = new RelationalRow();
                row.IsNullable = rdr.GetString(0);
                row.DataType = rdr.GetString(1);
                row.CharacterMaximumLength = rdr.IsDBNull(2) ? 0 : rdr.GetInt32(2);
                row.NumericPrecision = rdr.IsDBNull(3) ? 0 : rdr.GetByte(3);
                row.NumericScale = rdr.IsDBNull(4) ? 0 : rdr.GetInt32(4);
                row.DateTimePrecision = rdr.IsDBNull(5) ? 0 : rdr.GetInt16(5);
                row.CharacterSetName = rdr.IsDBNull(6) ? string.Empty : rdr.GetString(6);
                row.CollationName = rdr.IsDBNull(7) ? string.Empty : rdr.GetString(7);
                row.DomainName = rdr.IsDBNull(8) ? string.Empty : rdr.GetString(8);

            }
            command.Connection.Close();

            if (row != null)
            {
                var factory = new DataTypeInfoFactory();
                var dataTypeInfo = factory.Instantiate(row);
                return dataTypeInfo;
            }
            else
                return null;
        }
Beispiel #3
0
        public void Instantiate_SqlType_CorrectDisplay(string value)
        {
            var factory = new DataTypeInfoFactory();
            var obj     = factory.Instantiate(value);

            Assert.That(obj.ToString(), Is.EqualTo(value));
        }
Beispiel #4
0
        public void Instantiate_SqlType_CorrectName(string value, Type type)
        {
            var factory = new DataTypeInfoFactory();
            var obj     = factory.Instantiate(value);

            Assert.That(obj, Is.TypeOf(type));
        }
Beispiel #5
0
        public void Instantiate_TextType_CorrectLength(string value)
        {
            var factory = new DataTypeInfoFactory();
            var obj     = factory.Instantiate(value);

            Assert.That(obj, Is.AssignableTo <ILength>());
            Assert.That((obj as ILength).Length, Is.EqualTo(10));
        }
Beispiel #6
0
        public void Instantiate_NumericType_CorrectScalePrecision(string value)
        {
            var factory = new DataTypeInfoFactory();
            var obj     = factory.Instantiate(value);

            Assert.That(obj, Is.AssignableTo <IPrecision>());
            Assert.That((obj as IPrecision).Precision, Is.EqualTo(10));
            Assert.That(obj, Is.AssignableTo <IScale>());
            Assert.That((obj as IScale).Scale, Is.EqualTo(3));
        }
Beispiel #7
0
        /// <summary>
        /// Construct a ExistsConstraint
        /// </summary>
        public IsConstraint(string expected)
        {
            var factory = new DataTypeInfoFactory();

            this.expected = factory.Instantiate(expected);
        }