public virtual void Visit(SoqlCountExpression v) { if (v.Path != null) { v.Path.Accept(this); Output.Write('.'); } Output.Write(v.CollectionName); Output.Write(".Count"); }
void Sooda.QL.ISoqlVisitor.Visit(SoqlCountExpression v) { if (v.Path != null) { v.Path.Accept(this); } else { if (!_result.Contains(_rootClass)) { _result.Add(_rootClass); } } }
public virtual void Visit(SoqlCountExpression v) { if (v.Path != null) { v.Path.Accept(this); Output.Write('.'); } Output.Write(v.CollectionName); Output.Write(".Count"); }
void Sooda.QL.ISoqlVisitor.Visit(SoqlCountExpression v) { if (v.Path != null) { v.Path.Accept(this); } else { if (!_result.Contains(_rootClass)) _result.Add(_rootClass); } }
public override void Visit(SoqlCountExpression v) { ClassInfo currentClass; string p; string firstTableAlias = null; if (v.Path != null) { IFieldContainer container = GenerateTableJoins(v.Path, out p, out firstTableAlias); currentClass = container as ClassInfo; } else { currentClass = FindClassByCollectionName(v.CollectionName, out p); } CollectionOnetoManyInfo col1n = currentClass.FindCollectionOneToMany(v.CollectionName); if (col1n != null) { SoqlQueryExpression query = CreateCollectionQuery(currentClass, p, col1n, new SoqlFunctionCallExpression("count", new SoqlAsteriskExpression()), null); query.Accept(this); return; } CollectionManyToManyInfo colnn = currentClass.FindCollectionManyToMany(v.CollectionName); if (colnn != null) { RelationInfo ri = colnn.GetRelationInfo(); Output.Write("(select count(*) from "); OutputTableFrom(ri.Table, ""); Output.Write(" where "); Output.Write(ri.Table.Fields[1 - colnn.MasterField].DBColumnName); Output.Write('='); OutputColumn(GetTableAliasForExpressionPrefix(p), currentClass.GetFirstPrimaryKeyField()); Output.Write(')'); return; } throw new Exception("Unknown collection " + v.CollectionName + " in " + currentClass.Name); }