示例#1
0
 public override string ToSQLLiteral(object @object)
 {
     Net.Vpc.Upa.Impl.Persistence.TypeMarshaller wrapper = GetMarshallManager().GetTypeMarshaller(@object.GetType());
     if (wrapper != null && wrapper.GetType() != GetType())
     {
         return(wrapper.ToSQLLiteral(@object));
     }
     throw new System.Exception("literal not supported for Objects");
 }
 public virtual string FormatSqlValue(object @value, Net.Vpc.Upa.Types.DataType datatype)
 {
     if (@value == null)
     {
         return(nullMarshaller.ToSQLLiteral(null));
     }
     else
     {
         return(GetTypeMarshaller(@value.GetType()).ToSQLLiteral(@value));
     }
 }
 public override string ToSQLLiteral(object @object)
 {
     if (@object == null)
     {
         return(base.ToSQLLiteral(@object));
     }
     Net.Vpc.Upa.Impl.Persistence.TypeMarshaller wrapper = pm.GetTypeMarshaller(@object.GetType());
     if (wrapper != null && wrapper.GetType() != GetType())
     {
         return(wrapper.ToSQLLiteral(@object));
     }
     throw new System.Exception("litteral not supported for Objects (" + @object + " as " + @object.GetType() + ")");
 }
示例#4
0
        public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext qlContext, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations)
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral)oo;
            Net.Vpc.Upa.Impl.Util.ExprTypeInfo ei = Net.Vpc.Upa.Impl.Util.UPAUtils.ResolveExprTypeInfo(o);
            object objectValue = o.GetValue();

            Net.Vpc.Upa.Types.DataTypeTransform d = null;
            if (ei.GetOldReferrer() != null)
            {
                Net.Vpc.Upa.Field oldField = (Net.Vpc.Upa.Field)ei.GetOldReferrer();
                if (oldField.GetDataType() is Net.Vpc.Upa.Types.ManyToOneType)
                {
                    Net.Vpc.Upa.Types.ManyToOneType et = (Net.Vpc.Upa.Types.ManyToOneType)oldField.GetDataType();
                    objectValue = et.GetRelationship().GetTargetEntity().GetBuilder().ObjectToId(objectValue);
                }
            }
            else if (ei.GetReferrer() != null && ei.GetReferrer() is Net.Vpc.Upa.Field)
            {
                Net.Vpc.Upa.Field field = (Net.Vpc.Upa.Field)ei.GetReferrer();
                if (field.GetDataType() is Net.Vpc.Upa.Types.ManyToOneType)
                {
                    Net.Vpc.Upa.Types.ManyToOneType et = (Net.Vpc.Upa.Types.ManyToOneType)field.GetDataType();
                    objectValue = et.GetRelationship().GetTargetEntity().GetBuilder().ObjectToId(objectValue);
                    System.Collections.Generic.IList <Net.Vpc.Upa.Field> tf = et.GetRelationship().GetTargetEntity().GetPrimaryFields();
                    if ((tf).Count != 1)
                    {
                        throw new System.ArgumentException("Unsupported");
                    }
                    d = Net.Vpc.Upa.Impl.Util.UPAUtils.GetTypeTransformOrIdentity(tf[0]);
                }
            }
            if (d == null)
            {
                d = o.GetEffectiveDataType();
            }
            Net.Vpc.Upa.Impl.Persistence.TypeMarshaller mm = sqlManager.GetMarshallManager().GetTypeMarshaller(d);
            return(mm.ToSQLLiteral(objectValue));
        }
示例#5
0
 public override string ToSQLLiteral(object @object)
 {
     return(targetMarshaller.ToSQLLiteral(dataTypeTransform.TransformValue(@object)));
 }