示例#1
0
        public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext context, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledInsert o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledInsert)oo;
            //        PersistenceUnitManager persistenceManager = context.getPersistenceStore();
            Net.Vpc.Upa.Entity entity = context.GetPersistenceUnit().GetEntity(o.GetEntity().GetName());
            string             n      = context.GetPersistenceStore().GetValidIdentifier(context.GetPersistenceStore().GetPersistenceName(entity));

            System.Text.StringBuilder sb = new System.Text.StringBuilder("Insert Into " + n);
            sb.Append("(");
            System.Text.StringBuilder sbVals = new System.Text.StringBuilder();
            bool isFirst = true;
            int  max     = o.CountFields();

            for (int i = 0; i < max; i++)
            {
                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    sb.Append(", ");
                    sbVals.Append(", ");
                }
                sb.Append(sqlManager.GetSQL(o.GetField(i), context, declarations));
                sbVals.Append(sqlManager.GetSQL(o.GetFieldValue(i), context, declarations));
            }
            return(sb.Append(") Values (").Append(sbVals).Append(")").ToString());
        }
示例#2
0
 public virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledInsert AddQuery(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledInsert other)
 {
     if (other == null)
     {
         return(this);
     }
     if (other.entity != null)
     {
         entity = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName)other.entity.Copy();
         ExportDeclaration(null, Net.Vpc.Upa.Impl.Uql.DecObjectType.ENTITY, entity.GetName(), null);
         PrepareChildren(entity);
     }
     for (int i = 0; i < (other.fields).Count; i++)
     {
         Set(other.GetField(i).GetName(), other.GetFieldValue(i).Copy());
     }
     return(this);
 }