private void AddJoin(JoinFragment ojf, QueryTranslator q) { JoinFragment fromClause = q.CreateJoinFragment(true); fromClause.AddJoins(ojf.ToFromFragmentString, new SqlString(String.Empty)); q.AddJoin(pathExpressionParser.Name, fromClause); //TODO: HACK with ToString() AddToCurrentJoin(ojf.ToWhereFragmentString.ToString()); }
private void PrepareForIndex(QueryTranslator q) { IQueryableCollection collPersister = q.GetCollectionPersister(collectionRole); if (!collPersister.HasIndex) { throw new QueryException("unindexed collection before []"); } string[] indexCols = collPersister.IndexColumnNames; if (indexCols.Length != 1) { throw new QueryException("composite-index appears in []: " + path); } string[] keyCols = collPersister.KeyColumnNames; JoinFragment ojf = q.CreateJoinFragment(useThetaStyleJoin); ojf.AddCrossJoin(collPersister.TableName, collectionName); ojf.AddFromFragmentString(join.ToFromFragmentString); if (collPersister.IsOneToMany) { IQueryable persister = (IQueryable)collPersister.ElementPersister; ojf.AddJoins( ((IJoinable)persister).FromJoinFragment(collectionName, true, false), ((IJoinable)persister).WhereJoinFragment(collectionName, true, false) ); } if (!continuation) { AddJoin(collPersister.TableName, collectionName, keyCols); } join.AddCondition(collectionName, indexCols, " = "); string[] eltCols = collPersister.ElementColumnNames; CollectionElement elem = new CollectionElement(); elem.ElementColumns = StringHelper.Qualify(collectionName, eltCols); elem.Type = collPersister.ElementType; elem.IsOneToMany = collPersister.IsOneToMany; elem.Alias = collectionName; elem.Join = join; collectionElements.Add(elem); //addlast SetExpectingCollectionIndex(); q.AddCollection(collectionName, collectionRole); q.AddJoin(collectionName, ojf); }
private void Reset(QueryTranslator q) { join = q.CreateJoinFragment(useThetaStyleJoin); dotcount = 0; currentName = null; currentProperty = null; collectionName = null; collectionRole = null; componentPath = null; type = null; collectionName = null; columns = null; expectingCollectionIndex = false; continuation = false; currentPropertyMapping = null; }