public override Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression Copy()
 {
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral o = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(@value, type);
     o.SetDescription(GetDescription());
     o.GetClientParameters().SetAll(GetClientParameters());
     return(o);
 }
 protected internal virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral CompileLiteral(Net.Vpc.Upa.Expressions.Literal v, Net.Vpc.Upa.Impl.Uql.ExpressionTranslationManager manager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations)
 {
     if (v == null)
     {
         return(null);
     }
     Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral s = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledLiteral(v.GetValue(), null);
     //        s.setDeclarationList(declarations);
     return(s);
 }
Exemple #3
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));
        }