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.CompiledEntityName o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName)oo; Net.Vpc.Upa.Persistence.PersistenceStore persistenceStore = context.GetPersistenceStore(); string entityName = o.GetName(); Net.Vpc.Upa.Entity e = context.GetPersistenceUnit().GetEntity(entityName); if (o.IsUseView() && e.NeedsView() && persistenceStore.IsViewSupported()) { return(persistenceStore.GetValidIdentifier(persistenceStore.GetPersistenceName(e, Net.Vpc.Upa.Persistence.PersistenceNameType.IMPLICIT_VIEW))); } else { return(persistenceStore.GetValidIdentifier(persistenceStore.GetPersistenceName(e))); } }
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) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)oo; Net.Vpc.Upa.Persistence.PersistenceStore persistenceStore = qlContext.GetPersistenceStore(); object referrer = o.GetReferrer(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (referrer is Net.Vpc.Upa.Field) { Net.Vpc.Upa.Field field = (Net.Vpc.Upa.Field)referrer; string name = persistenceStore.GetPersistenceName(field); sb.Append(persistenceStore.GetValidIdentifier(name)); } else if (referrer is Net.Vpc.Upa.Entity) { Net.Vpc.Upa.Entity entity = (Net.Vpc.Upa.Entity)referrer; // if ("this".equals(o.getName())) { // throw new IllegalArgumentException("Unexpected this alias"); // //this must be resolved to the ancestor alias // ExpressionDeclarationList declarationList = o.getDeclarationList(); // name = persistenceManager.getPersistenceName(declarationList.getValue(null).getName(), PersistenceNameStrategyNames.ALIAS); // } else { string name = persistenceStore.GetPersistenceName(o.GetName(), Net.Vpc.Upa.Persistence.PersistenceNameType.ALIAS); sb.Append(persistenceStore.GetValidIdentifier(name)); } else { string name = persistenceStore.GetPersistenceName(o.GetName(), Net.Vpc.Upa.Persistence.PersistenceNameType.ALIAS); sb.Append(persistenceStore.GetValidIdentifier(name)); } if (o.GetChild() != null) { string cc = GetSQL(o.GetChild(), qlContext, sqlManager, declarations); sb.Append(".").Append(cc); } return(sb.ToString()); }