Esempio n. 1
0
		public int Add (TdsDataColumn schema)
		{
			int index;
			index = list.Add (schema);
			schema.ColumnOrdinal = index;
			return index;
		}
Esempio n. 2
0
        public int Add(TdsDataColumn schema)
        {
            int index;

            index = list.Add(schema);
            schema.ColumnOrdinal = index;
            return(index);
        }
Esempio n. 3
0
		public int Add (TdsDataColumn schema)
		{
			int index;
			index = list.Add (schema);
#if NET_2_0
			schema.ColumnOrdinal = index;
#else
			schema["ColumnOrdinal"] = index;
#endif
			return index;
		}
        public int Add(TdsDataColumn schema)
        {
            int index;

            index = list.Add(schema);
#if NET_2_0
            schema.ColumnOrdinal = index;
#else
            schema["ColumnOrdinal"] = index;
#endif
            return(index);
        }
Esempio n. 5
0
        protected override void ProcessColumnInfo()
        {
            int numColumns = Comm.GetTdsShort();

            for (int i = 0; i < numColumns; i += 1)
            {
                byte[] flagData = new byte[4];
                for (int j = 0; j < 4; j += 1)
                {
                    flagData[j] = Comm.GetByte();
                }

                bool nullable = (flagData[2] & 0x01) > 0;
                //bool caseSensitive = (flagData[2] & 0x02) > 0;
                bool writable      = (flagData[2] & 0x0c) > 0;
                bool autoIncrement = (flagData[2] & 0x10) > 0;
                bool isIdentity    = (flagData[2] & 0x10) > 0;

                TdsColumnType columnType = (TdsColumnType)((Comm.GetByte() & 0xff));

                byte xColumnType = 0;
                if (IsLargeType(columnType))
                {
                    xColumnType = (byte)columnType;
                    if (columnType != TdsColumnType.NChar)
                    {
                        columnType -= 128;
                    }
                }

                int    columnSize;
                string tableName = null;

                if (IsBlobType(columnType))
                {
                    columnSize = Comm.GetTdsInt();
                    tableName  = Comm.GetString(Comm.GetTdsShort());
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    columnSize = LookupBufferSize(columnType);
                }
                else if (IsLargeType((TdsColumnType)xColumnType))
                {
                    columnSize = Comm.GetTdsShort();
                }
                else
                {
                    columnSize = Comm.GetByte() & 0xff;
                }

                if (IsWideType((TdsColumnType)columnType))
                {
                    columnSize /= 2;
                }

                byte precision = 0;
                byte scale     = 0;

                if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric)
                {
                    precision = Comm.GetByte();
                    scale     = Comm.GetByte();
                }
                else
                {
                    precision = GetPrecision(columnType, columnSize);
                    scale     = GetScale(columnType, columnSize);
                }

                string columnName = Comm.GetString(Comm.GetByte());

                TdsDataColumn col = new TdsDataColumn();
                Columns.Add(col);
                col.ColumnType       = columnType;
                col.ColumnName       = columnName;
                col.IsAutoIncrement  = autoIncrement;
                col.IsIdentity       = isIdentity;
                col.ColumnSize       = columnSize;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !writable;
                col.AllowDBNull      = nullable;
                col.BaseTableName    = tableName;
                col.DataTypeName     = Enum.GetName(typeof(TdsColumnType), xColumnType);
            }
        }
Esempio n. 6
0
        protected override void ProcessColumnInfo()
        {
            byte precision;
            byte scale;
            int  totalLength = Comm.GetTdsShort();
            int  bytesRead   = 0;

            while (bytesRead < totalLength)
            {
                scale     = 0;
                precision = 0;

                int    bufLength = -1;
                byte[] flagData  = new byte[4];
                for (int i = 0; i < 4; i += 1)
                {
                    flagData[i] = Comm.GetByte();
                    bytesRead  += 1;
                }
                bool nullable = (flagData[2] & 0x01) > 0;
                //bool caseSensitive = (flagData[2] & 0x02) > 0;
                bool writable = (flagData[2] & 0x0c) > 0;
                //bool autoIncrement = (flagData[2] & 0x10) > 0;

                string        tableName  = String.Empty;
                TdsColumnType columnType = (TdsColumnType)Comm.GetByte();

                bytesRead += 1;

                if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image)
                {
                    Comm.Skip(4);
                    bytesRead += 4;

                    int tableNameLength = Comm.GetTdsShort();
                    bytesRead += 2;
                    tableName  = Comm.GetString(tableNameLength);
                    bytesRead += tableNameLength;
                    bufLength  = 2 << 31 - 1;
                }
                else if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric)
                {
                    bufLength  = Comm.GetByte();
                    bytesRead += 1;
                    precision  = Comm.GetByte();
                    bytesRead += 1;
                    scale      = Comm.GetByte();
                    bytesRead += 1;
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    bufLength = LookupBufferSize(columnType);
                }
                else
                {
                    bufLength  = (int)Comm.GetByte() & 0xff;
                    bytesRead += 1;
                }

                TdsDataColumn col   = new TdsDataColumn();
                int           index = Columns.Add(col);
#if NET_2_0
                col.ColumnType       = columnType;
                col.ColumnSize       = bufLength;
                col.ColumnName       = ColumnNames[index] as string;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !writable;
                col.BaseTableName    = tableName;
                col.AllowDBNull      = nullable;
#else
                col["ColumnType"]       = columnType;
                col["ColumnSize"]       = bufLength;
                col["ColumnName"]       = ColumnNames[index];
                col["NumericPrecision"] = precision;
                col["NumericScale"]     = scale;
                col["IsReadOnly"]       = !writable;
                col["BaseTableName"]    = tableName;
                col["AllowDBNull"]      = nullable;
#endif
            }
        }
Esempio n. 7
0
		protected override void ProcessColumnInfo ()
		{
			isSelectQuery = true; 
			/*int totalLength = */Comm.GetTdsShort ();
			int count = Comm.GetTdsShort ();
			for (int i = 0; i < count; i += 1) {
				string columnName = Comm.GetString (Comm.GetByte ());
				int status = Comm.GetByte ();
				bool hidden = (status & 0x01) > 0;
				bool isKey = (status & 0x02) > 0;
				bool isRowVersion = (status & 0x04) > 0;
				bool isUpdatable = (status & 0x10) > 0;
				bool allowDBNull = (status & 0x20) > 0;
				bool isIdentity = (status & 0x40) > 0;

				Comm.Skip (4); // User type

				byte type = Comm.GetByte ();
				bool isBlob = (type == 0x24);

				TdsColumnType columnType = (TdsColumnType) type;
				int bufLength = 0;

				byte precision = 0;
				byte scale = 0;

				if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image) {
					bufLength = Comm.GetTdsInt ();
					Comm.Skip (Comm.GetTdsShort ());
				}
				else if (IsFixedSizeColumn (columnType))
					bufLength = LookupBufferSize (columnType);
				else
					//bufLength = Comm.GetTdsShort ();
					bufLength = Comm.GetByte ();

				if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric) {
					precision = Comm.GetByte ();
					scale = Comm.GetByte ();
				}

				Comm.Skip (Comm.GetByte ()); // Locale
				if (isBlob)
					Comm.Skip (Comm.GetTdsShort ()); // Class ID

				TdsDataColumn col = new TdsDataColumn ();
				Columns.Add (col);
#if NET_2_0
				col.ColumnType = columnType;
				col.ColumnName = columnName;
				col.IsIdentity = isIdentity;
				col.IsRowVersion = isRowVersion;
				col.ColumnType = columnType;
				col.ColumnSize = bufLength;
				col.NumericPrecision = precision;
				col.NumericScale = scale;
				col.IsReadOnly = !isUpdatable;
				col.IsKey = isKey;
				col.AllowDBNull = allowDBNull;
				col.IsHidden = hidden;
#else
				col ["ColumnType"] = columnType;
				col ["ColumnName"] = columnName;
				col ["IsIdentity"] = isIdentity;
				col ["IsRowVersion"] = isRowVersion;
				col ["ColumnType"] = columnType;
				col ["ColumnSize"] = bufLength;
				col ["NumericPrecision"] = precision;
				col ["NumericScale"] = scale;
				col ["IsReadOnly"] = !isUpdatable;
				col ["IsKey"] = isKey;
				col ["AllowDBNull"] = allowDBNull;
				col ["IsHidden"] = hidden;
#endif
			}
		}
		private static object GetSchemaValue (TdsDataColumn schema, object key)
		{
			if (schema.ContainsKey (key) && schema [key] != null)
				return schema [key];
			return DBNull.Value;
		}
Esempio n. 9
0
		protected override void ProcessColumnInfo ()
		{
			byte precision;
			byte scale;
			int totalLength = Comm.GetTdsShort ();
			int bytesRead = 0;

			while (bytesRead < totalLength) {
				scale = 0;
				precision = 0;

				int bufLength = -1;
				byte[] flagData = new byte[4];
				for (int i = 0; i < 4; i += 1) {
					flagData[i] = Comm.GetByte ();
					bytesRead += 1;
				}
				bool nullable = (flagData[2] & 0x01) > 0;
				//bool caseSensitive = (flagData[2] & 0x02) > 0;
				bool writable = (flagData[2] & 0x0c) > 0;
				//bool autoIncrement = (flagData[2] & 0x10) > 0;

				string tableName = String.Empty;
				TdsColumnType columnType = (TdsColumnType) Comm.GetByte ();

				bytesRead += 1;

				if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image) {
					Comm.Skip (4);
					bytesRead += 4;

					int tableNameLength = Comm.GetTdsShort ();
					bytesRead += 2;
					tableName = Comm.GetString (tableNameLength);
					bytesRead += tableNameLength;
					bufLength = 2 << 31 - 1;
				}
				else if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric) {
					bufLength = Comm.GetByte ();
					bytesRead += 1;
					precision = Comm.GetByte ();
					bytesRead += 1;
					scale = Comm.GetByte ();
					bytesRead += 1;
				}
				else if (IsFixedSizeColumn (columnType))
					bufLength = LookupBufferSize (columnType);
				else {
					bufLength = (int) Comm.GetByte () & 0xff;
					bytesRead += 1;
				}

				TdsDataColumn col = new TdsDataColumn ();
				int index = Columns.Add (col);
				col.ColumnType = columnType;
				col.ColumnSize = bufLength;
				col.ColumnName = ColumnNames[index] as string;
				col.NumericPrecision = precision;
				col.NumericScale = scale;
				col.IsReadOnly = !writable;
				col.BaseTableName = tableName;
				col.AllowDBNull = nullable;
			}
		}
Esempio n. 10
0
		private static object GetSchemaValue (TdsDataColumn schema, string key)
		{
			object val = schema [key];
			if (val != null)
				return val;
			else
				return DBNull.Value;
		}
Esempio n. 11
0
		protected override void ProcessColumnInfo ()
		{
			// We are connected to a Sql 7.0 server
			if (TdsVersion < TdsVersion.tds80) {
				base.ProcessColumnInfo ();
				return;
			}
			
			// VARADHAN: TDS 8 Debugging
			//Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... entry");
			int numColumns = Comm.GetTdsShort ();
			//Console.WriteLine ("Column count={0}", numColumns); TDS 8 Debugging
			for (int i = 0; i < numColumns; i += 1) {
				byte[] flagData = new byte[4];
				for (int j = 0; j < 4; j += 1) 
					flagData[j] = Comm.GetByte ();

				bool nullable = (flagData[2] & 0x01) > 0;
				//bool caseSensitive = (flagData[2] & 0x02) > 0;
				bool writable = (flagData[2] & 0x0c) > 0;
				bool autoIncrement = (flagData[2] & 0x10) > 0;
				bool isIdentity = (flagData[2] & 0x10) > 0;

				TdsColumnType columnType = (TdsColumnType) (Comm.GetByte () & 0xff);
				//Console.WriteLine ("Actual ColumnType: {0}", columnType);  TDS 8 Debugging

				if ((byte) columnType == 0xef)
					columnType = TdsColumnType.NChar;

				TdsColumnType xColumnType = columnType;
				if (IsLargeType (columnType)) {
					if (columnType != TdsColumnType.NChar)
						columnType -= 128;
				}

				int columnSize;
				string tableName = null;
				byte[] collation = null;
				int lcid = 0, sortId = 0;

				if (IsBlobType (columnType)) {
					columnSize = Comm.GetTdsInt ();
				} else if (IsFixedSizeColumn (columnType)) {
					columnSize = LookupBufferSize (columnType);
				} else if (IsLargeType (xColumnType)) {
					columnSize = Comm.GetTdsShort ();
				} else  {
					columnSize = Comm.GetByte () & 0xff;
				}

				if (xColumnType == TdsColumnType.BigChar || xColumnType == TdsColumnType.BigNVarChar ||
				    xColumnType == TdsColumnType.BigVarChar || xColumnType == TdsColumnType.NChar ||
				    xColumnType == TdsColumnType.NVarChar ||   xColumnType == TdsColumnType.Text ||
				    xColumnType == TdsColumnType.NText) {
				    // Read collation for SqlServer 2000 and beyond
				    collation = Comm.GetBytes (5, true);
					lcid = TdsCollation.LCID (collation);
					sortId = TdsCollation.SortId (collation);
				}

				if (IsBlobType (columnType)) {
					tableName = Comm.GetString (Comm.GetTdsShort ());
					//Console.WriteLine ("Tablename: "+tableName);  TDS 8 Debugging
				}

				byte precision = 0;
				byte scale = 0;

				switch (columnType) {
				case TdsColumnType.NText:
				case TdsColumnType.NChar:
				case TdsColumnType.NVarChar:
					columnSize /= 2;
					break;
				case TdsColumnType.Decimal:
				case TdsColumnType.Numeric:
					//Comm.Skip (1);
					precision = Comm.GetByte ();
					//Console.WriteLine ("Precision: {0}", precision);  TDS 8 Debugging
					scale = Comm.GetByte ();
					//Console.WriteLine ("Scale: {0}", scale);  TDS 8 Debugging
					break;
				}

				string columnName = Comm.GetString (Comm.GetByte ());

				TdsDataColumn col = new TdsDataColumn ();
				Columns.Add (col);
#if NET_2_0
				col.ColumnType = columnType;
				col.ColumnName = columnName;
				col.IsAutoIncrement = autoIncrement;
				col.IsIdentity = isIdentity;
				col.ColumnSize = columnSize;
				col.NumericPrecision = precision;
				col.NumericScale = scale;
				col.IsReadOnly = !writable;
				col.AllowDBNull = nullable;
				col.BaseTableName = tableName;
				col.LCID = lcid;
				col.SortOrder = sortId;
#else
				col ["ColumnType"] = columnType;
				col ["ColumnName"] = columnName;
				col ["IsAutoIncrement"] = autoIncrement;
				col ["IsIdentity"] = isIdentity;
				col ["ColumnSize"] = columnSize;
				col ["NumericPrecision"] = precision;
				col ["NumericScale"] = scale;
				col ["IsReadOnly"] = !writable;
				col ["AllowDBNull"] = nullable;
				col ["BaseTableName"] = tableName;
				col ["LCID"] = lcid;
				col ["SortOrder"] = sortId;
#endif
			}
			//Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... exit");  TDS 8 Debugging
		}
Esempio n. 12
0
        protected override void ProcessColumnInfo()
        {
            // We are connected to a Sql 7.0 server
            if (TdsVersion < TdsVersion.tds80)
            {
                base.ProcessColumnInfo();
                return;
            }

            // VARADHAN: TDS 8 Debugging
            //Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... entry");
            int numColumns = Comm.GetTdsShort();

            //Console.WriteLine ("Column count={0}", numColumns); TDS 8 Debugging
            for (int i = 0; i < numColumns; i += 1)
            {
                byte[] flagData = new byte[4];
                for (int j = 0; j < 4; j += 1)
                {
                    flagData[j] = Comm.GetByte();
                }

                bool nullable = (flagData[2] & 0x01) > 0;
                //bool caseSensitive = (flagData[2] & 0x02) > 0;
                bool writable      = (flagData[2] & 0x0c) > 0;
                bool autoIncrement = (flagData[2] & 0x10) > 0;
                bool isIdentity    = (flagData[2] & 0x10) > 0;

                TdsColumnType columnType = (TdsColumnType)(Comm.GetByte() & 0xff);
                //Console.WriteLine ("Actual ColumnType: {0}", columnType);  TDS 8 Debugging

                if ((byte)columnType == 0xef)
                {
                    columnType = TdsColumnType.NChar;
                }

                TdsColumnType xColumnType = columnType;
                if (IsLargeType(columnType))
                {
                    if (columnType != TdsColumnType.NChar)
                    {
                        columnType -= 128;
                    }
                }

                int    columnSize;
                string tableName = null;
                byte[] collation = null;
                int    lcid = 0, sortId = 0;

                if (IsBlobType(columnType))
                {
                    columnSize = Comm.GetTdsInt();
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    columnSize = LookupBufferSize(columnType);
                }
                else if (IsLargeType(xColumnType))
                {
                    columnSize = Comm.GetTdsShort();
                }
                else
                {
                    columnSize = Comm.GetByte() & 0xff;
                }

                if (xColumnType == TdsColumnType.BigChar || xColumnType == TdsColumnType.BigNVarChar ||
                    xColumnType == TdsColumnType.BigVarChar || xColumnType == TdsColumnType.NChar ||
                    xColumnType == TdsColumnType.NVarChar || xColumnType == TdsColumnType.Text ||
                    xColumnType == TdsColumnType.NText)
                {
                    // Read collation for SqlServer 2000 and beyond
                    collation = Comm.GetBytes(5, true);
                    lcid      = TdsCollation.LCID(collation);
                    sortId    = TdsCollation.SortId(collation);
                }

                if (IsBlobType(columnType))
                {
                    tableName = Comm.GetString(Comm.GetTdsShort());
                    //Console.WriteLine ("Tablename: "+tableName);  TDS 8 Debugging
                }

                byte precision = 0;
                byte scale     = 0;

                switch (columnType)
                {
                case TdsColumnType.NText:
                case TdsColumnType.NChar:
                case TdsColumnType.NVarChar:
                    columnSize /= 2;
                    break;

                case TdsColumnType.Decimal:
                case TdsColumnType.Numeric:
                    //Comm.Skip (1);
                    precision = Comm.GetByte();
                    //Console.WriteLine ("Precision: {0}", precision);  TDS 8 Debugging
                    scale = Comm.GetByte();
                    //Console.WriteLine ("Scale: {0}", scale);  TDS 8 Debugging
                    break;
                }

                string columnName = Comm.GetString(Comm.GetByte());

                TdsDataColumn col = new TdsDataColumn();
                Columns.Add(col);
#if NET_2_0
                col.ColumnType       = columnType;
                col.ColumnName       = columnName;
                col.IsAutoIncrement  = autoIncrement;
                col.IsIdentity       = isIdentity;
                col.ColumnSize       = columnSize;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !writable;
                col.AllowDBNull      = nullable;
                col.BaseTableName    = tableName;
                col.LCID             = lcid;
                col.SortOrder        = sortId;
#else
                col ["ColumnType"]       = columnType;
                col ["ColumnName"]       = columnName;
                col ["IsAutoIncrement"]  = autoIncrement;
                col ["IsIdentity"]       = isIdentity;
                col ["ColumnSize"]       = columnSize;
                col ["NumericPrecision"] = precision;
                col ["NumericScale"]     = scale;
                col ["IsReadOnly"]       = !writable;
                col ["AllowDBNull"]      = nullable;
                col ["BaseTableName"]    = tableName;
                col ["LCID"]             = lcid;
                col ["SortOrder"]        = sortId;
#endif
            }
            //Console.WriteLine ("Tds80.cs: In ProcessColumnInfo... exit");  TDS 8 Debugging
        }
Esempio n. 13
0
		protected override void ProcessColumnInfo ()
		{
			int numColumns = Comm.GetTdsShort ();
			for (int i = 0; i < numColumns; i += 1) {
				byte[] flagData = new byte[4];
				for (int j = 0; j < 4; j += 1) 
					flagData[j] = Comm.GetByte ();

				bool nullable = (flagData[2] & 0x01) > 0;
				//bool caseSensitive = (flagData[2] & 0x02) > 0;
				bool writable = (flagData[2] & 0x0c) > 0;
				bool autoIncrement = (flagData[2] & 0x10) > 0;
				bool isIdentity = (flagData[2] & 0x10) > 0;

				TdsColumnType columnType = (TdsColumnType) ((Comm.GetByte () & 0xff));

				byte xColumnType = 0;
				if (IsLargeType (columnType)) {
					xColumnType = (byte) columnType;
					if (columnType != TdsColumnType.NChar)
						columnType -= 128;
				}

				int columnSize;
				string tableName = null;

				if (IsBlobType (columnType)) {
					columnSize = Comm.GetTdsInt ();
					tableName = Comm.GetString (Comm.GetTdsShort ());
				} else if (IsFixedSizeColumn (columnType)) {
					columnSize = LookupBufferSize (columnType);
				} else if (IsLargeType ((TdsColumnType) xColumnType)) {
					columnSize = Comm.GetTdsShort ();
				} else {
					columnSize = Comm.GetByte () & 0xff;
				}

				if (IsWideType ((TdsColumnType) columnType))
					columnSize /= 2;

				byte precision = 0;
				byte scale = 0;

				if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric) {
					precision = Comm.GetByte ();
					scale = Comm.GetByte ();
				} else {
					precision = GetPrecision (columnType, columnSize);
					scale = GetScale (columnType, columnSize);
				}

				string columnName = Comm.GetString (Comm.GetByte ());

				TdsDataColumn col = new TdsDataColumn ();
				Columns.Add (col);
#if NET_2_0
				col.ColumnType = columnType;
				col.ColumnName = columnName;
				col.IsAutoIncrement = autoIncrement;
				col.IsIdentity = isIdentity;
				col.ColumnSize = columnSize;
				col.NumericPrecision = precision;
				col.NumericScale = scale;
				col.IsReadOnly = !writable;
				col.AllowDBNull = nullable;
				col.BaseTableName = tableName;
				col.DataTypeName = Enum.GetName (typeof (TdsColumnType), xColumnType);
#else
				col ["ColumnType"] = columnType;
				col ["ColumnName"] = columnName;
				col ["IsAutoIncrement"] = autoIncrement;
				col ["IsIdentity"] = isIdentity;
				col ["ColumnSize"] = columnSize;
				col ["NumericPrecision"] = precision;
				col ["NumericScale"] = scale;
				col ["IsReadOnly"] = !writable;
				col ["AllowDBNull"] = nullable;
				col ["BaseTableName"] = tableName;
				col ["DataTypeName"] = Enum.GetName (typeof (TdsColumnType), xColumnType);
#endif
			}
		}
Esempio n. 14
0
        protected override void ProcessColumnInfo()
        {
            isSelectQuery = true;
            /*int totalLength = */
            Comm.GetTdsShort();
            int count = Comm.GetTdsShort();

            for (int i = 0; i < count; i += 1)
            {
                string columnName   = Comm.GetString(Comm.GetByte());
                int    status       = Comm.GetByte();
                bool   hidden       = (status & 0x01) > 0;
                bool   isKey        = (status & 0x02) > 0;
                bool   isRowVersion = (status & 0x04) > 0;
                bool   isUpdatable  = (status & 0x10) > 0;
                bool   allowDBNull  = (status & 0x20) > 0;
                bool   isIdentity   = (status & 0x40) > 0;

                Comm.Skip(4); // User type

                byte type   = Comm.GetByte();
                bool isBlob = (type == 0x24);

                TdsColumnType columnType = (TdsColumnType)type;
                int           bufLength  = 0;

                byte precision = 0;
                byte scale     = 0;

                if (columnType == TdsColumnType.Text || columnType == TdsColumnType.Image)
                {
                    bufLength = Comm.GetTdsInt();
                    Comm.Skip(Comm.GetTdsShort());
                }
                else if (IsFixedSizeColumn(columnType))
                {
                    bufLength = LookupBufferSize(columnType);
                }
                else
                {
                    //bufLength = Comm.GetTdsShort ();
                    bufLength = Comm.GetByte();
                }

                if (columnType == TdsColumnType.Decimal || columnType == TdsColumnType.Numeric)
                {
                    precision = Comm.GetByte();
                    scale     = Comm.GetByte();
                }

                Comm.Skip(Comm.GetByte()); // Locale
                if (isBlob)
                {
                    Comm.Skip(Comm.GetTdsShort()); // Class ID
                }
                TdsDataColumn col = new TdsDataColumn();
                Columns.Add(col);
                col.ColumnType       = columnType;
                col.ColumnName       = columnName;
                col.IsIdentity       = isIdentity;
                col.IsRowVersion     = isRowVersion;
                col.ColumnType       = columnType;
                col.ColumnSize       = bufLength;
                col.NumericPrecision = precision;
                col.NumericScale     = scale;
                col.IsReadOnly       = !isUpdatable;
                col.IsKey            = isKey;
                col.AllowDBNull      = allowDBNull;
                col.IsHidden         = hidden;
            }
        }
		private static object GetSchemaValue (TdsDataColumn schema, string key)
		{
			object ret = schema [key];

			if (ret == null)
				return DBNull.Value;

			return ret;
		}