Esempio n. 1
0
        void IColumnMapping.ProcessMapping(int column, int rowNumber, ICdlRecord record, ICdlValueWriter writer, IShellContext context)
        {
            if (_value == null)
            {
                _value = new CdlValueHolder();
            }
            if (Expression != null && Value != null)
            {
                throw new Exception("DBSH-00004 MapValue: Both Expression and Value is set");
            }
            var childContext = context.CreateChildContext();

            if (Value != null)
            {
                CreateColumnValues(record, childContext);
                string value = childContext.Replace(Value);
                _value.ReadFrom(value);
                _value.WriteTo(writer);
            }
            if (Expression != null)
            {
                CreateColumnValues(record, childContext);
                object value = childContext.Evaluate(Expression);
                _value.ReadFrom(value);
                _value.WriteTo(writer);
            }
            if (Expression == null && Value == null)
            {
                _value.SetNull();
                _value.WriteTo(writer);
            }
        }
Esempio n. 2
0
 public void AdaptValue(ICdlValueReader reader, DbTypeBase type, ICdlValueWriter writer, ICdlValueConvertor converter)
 {
     if (reader.GetFieldType() == TypeStorage.Null)
     {
         m_holder.SetNull();
     }
     else
     {
         ConvertNotNullValue(reader, type, m_holder, converter);
         ApplyTypeRestrictions(m_holder, type);
     }
     writer.ReadFrom(m_holder);
 }