예제 #1
0
 private static object GetSchemaValue(TdsDataColumn schema, object key)
 {
     if (schema.ContainsKey(key) && schema [key] != null)
     {
         return(schema [key]);
     }
     return(DBNull.Value);
 }
예제 #2
0
        private static object GetSchemaValue(TdsDataColumn schema, string key)
        {
            object ret = schema [key];

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

            return(ret);
        }
예제 #3
0
        private static object GetSchemaValue(TdsDataColumn schema, string key)
        {
            object val = schema [key];

            if (val != null)
            {
                return(val);
            }
            else
            {
                return(DBNull.Value);
            }
        }
예제 #4
0
        SqlInt64 GetSqlInt64(int i)
        {
            object value = GetSqlValue(i);

            // TDS 7.0 returns bigint as decimal(19,0)
            if (value is SqlDecimal)
            {
                TdsDataColumn schema = command.Tds.Columns[i];
                if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0)
                {
                    value = (SqlInt64)(SqlDecimal)value;
                }
            }
            if (!(value is SqlInt64))
            {
                throw new InvalidCastException("Type is " + value.GetType().ToString());
            }
            return((SqlInt64)value);
        }
예제 #5
0
        long GetInt64(int i)
        {
            object value = GetValue(i);

            // TDS 7.0 returns bigint as decimal(19,0)
            if (value is decimal)
            {
                TdsDataColumn schema = command.Tds.Columns[i];
                if ((byte)schema["NumericPrecision"] == 19 && (byte)schema["NumericScale"] == 0)
                {
                    value = (long)(decimal)value;
                }
            }
            if (!(value is long))
            {
                if (value is DBNull)
                {
                    throw new SqlNullValueException();
                }
                throw new InvalidCastException("Type is " + value.GetType().ToString());
            }
            return((long)value);
        }