Exemplo n.º 1
0
 public virtual object CreateResult(Net.Vpc.Upa.Impl.Persistence.Result.ResultColumn[] row, Net.Vpc.Upa.Persistence.ResultMetaData metadata)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> fields = metadata.GetFields();
     Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData d = (Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData)metadata;
     string[] bindings = (string[])Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(d.GetProperties(), CACHE_KEY);
     if (bindings == null)
     {
         bindings = new string[(fields).Count];
         for (int i = 0; i < (fields).Count; i++)
         {
             Net.Vpc.Upa.Persistence.ResultField field = fields[i];
             Net.Vpc.Upa.Expressions.Expression  ss    = field.GetExpression();
             string binding = ss == null ? "null" : ss.ToString();
             bindings[i] = binding;
         }
         d.GetProperties()[CACHE_KEY] = bindings;
     }
     if ((fields).Count == 1)
     {
         string binding = bindings[0];
         return(row[0].GetValue());
     }
     else
     {
         object[] allRet = new object[(fields).Count];
         for (int i = 0; i < allRet.Length; i++)
         {
             allRet[i] = row[i].GetValue();
         }
         return(allRet);
     }
 }
Exemplo n.º 2
0
 public override string ToString()
 {
     if (applier != null)
     {
         return(applier.ToString() + "." + Net.Vpc.Upa.Expressions.ExpressionHelper.EscapeIdentifier(GetName()));
     }
     return(Net.Vpc.Upa.Expressions.ExpressionHelper.EscapeIdentifier(GetName()));
 }
Exemplo n.º 3
0
 public static string GetValidBinding(Net.Vpc.Upa.Persistence.ResultField s)
 {
     if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(s.GetAlias()))
     {
         Net.Vpc.Upa.Expressions.Expression ss = s.GetExpression();
         return(ss == null ? "" : ss.ToString());
     }
     return(s.GetAlias());
 }
Exemplo n.º 4
0
 public DefaultResultField(Net.Vpc.Upa.Expressions.Expression expression, string alias, Net.Vpc.Upa.Types.DataType dataType, Net.Vpc.Upa.Field field, Net.Vpc.Upa.Entity entity)
 {
     this.expression = expression;
     if (alias == null)
     {
         if (expression is Net.Vpc.Upa.Expressions.Var)
         {
             alias = ((Net.Vpc.Upa.Expressions.Var)expression).GetName();
         }
         else
         {
             alias = expression.ToString();
         }
     }
     this.alias    = alias;
     this.dataType = dataType;
     this.field    = field;
     this.entity   = entity;
 }
 public virtual object CreateResult(Net.Vpc.Upa.Impl.Persistence.Result.ResultColumn[] row, Net.Vpc.Upa.Persistence.ResultMetaData metadata)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> fields = metadata.GetFields();
     Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData d = (Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData)metadata;
     string[][] preferredNameAndBinding = (string[][])Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, object>(d.GetProperties(), CACHE_KEY);
     if (preferredNameAndBinding == null)
     {
         preferredNameAndBinding = (string[][])Net.Vpc.Upa.Impl.FwkConvertUtils.CreateMultiArray(typeof(string), (fields).Count, 2);
         for (int i = 0; i < (fields).Count; i++)
         {
             Net.Vpc.Upa.Persistence.ResultField field = fields[i];
             Net.Vpc.Upa.Expressions.Expression  ss    = field.GetExpression();
             string binding       = ss == null ? "null" : ss.ToString();
             string preferredName = binding;
             if (preferredName.IndexOf('.') >= 0)
             {
                 preferredName = preferredName.Substring(preferredName.LastIndexOf('.') + 1);
             }
             string alias = field.GetAlias();
             if (!Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(alias))
             {
                 preferredName = alias;
             }
             preferredNameAndBinding[i][0] = preferredName;
             preferredNameAndBinding[i][1] = binding;
         }
         d.GetProperties()[CACHE_KEY] = preferredNameAndBinding;
     }
     if ((fields).Count == 1 && row[0].GetValue() is Net.Vpc.Upa.Record)
     {
         return(row[0].GetValue());
     }
     Net.Vpc.Upa.Record r = new Net.Vpc.Upa.Impl.DefaultRecord();
     for (int i = 0; i < (fields).Count; i++)
     {
         string preferredName = preferredNameAndBinding[i][0];
         r.SetObject(preferredName, row[i].GetValue());
     }
     return(r);
 }
Exemplo n.º 6
0
 public override string ToString()
 {
     Net.Vpc.Upa.Expressions.Expression e = GetExpression();
     return((alias == null ? "" : ("." + alias)) + (e == null ? "NULL" : e.ToString()));
 }