Example #1
0
        private static object GetQueryValue(IDatabaseQuery query, int index, FieldMetadata fieldMetadata)
        {
            if (query.IsColumnNull(index))
            {
                return(null);
            }

            if (fieldMetadata is ByteFieldMetadata)
            {
                return(query.GetByte(index));
            }

            if (fieldMetadata is IntegerFieldMetadata)
            {
                return(query.GetInt32(index));
            }

            if (fieldMetadata is StringFieldMetadata)
            {
                return(query.GetString(index));
            }

            if (fieldMetadata is DoubleFieldMetadata)
            {
                return(Convert.ToDouble(query.GetFloat(index)));
            }

            if (fieldMetadata is FloatFieldMetadata)
            {
                return(query.GetFloat(index));
            }

            if (fieldMetadata is DateTimeFieldMetadata)
            {
                return(query.GetDateTime(index));
            }

            if (fieldMetadata is BooleanFieldMetadata)
            {
                return(query.GetBool(index));
            }

            throw new NotSupportedException(fieldMetadata.GetType().Name);
        }