private ITable Execute(string s, QueryLimit limit) { var query = (SqlQueryExpression)SqlExpression.Parse(s); var result = AdminQuery.Select(query, limit); result.GetEnumerator().MoveNext(); return(result.Source); }
static void Main(string[] args) { ReportDirections reportDirections = new ReportDirections(); reportDirections.selected = "inbound"; Times Times = new Times(); Times.dateRange = "Last5Minutes"; Filters Filters = new Filters(); Filters.sdfDips_0 = "in_AC10033A_AC10033A-410"; DataGranularity DataGranularity = new DataGranularity(); DataGranularity.selected = "auto"; ReportDetails ReportDetails = new ReportDetails(); ReportDetails.reportTypeLang = "conversations"; ReportDetails.reportDirections = reportDirections; ReportDetails.times = Times; ReportDetails.filters = Filters; ReportDetails.dataGranularity = DataGranularity; // QueryLimit QueryLimit = new QueryLimit(); QueryLimit.offset = 0; QueryLimit.max_num_rows = 1; QueryLimit2 QueryLimit2 = new QueryLimit2(); QueryLimit2.offset = 0; QueryLimit2.max_num_rows = 1; Table Table = new Table(); Table.query_limit = QueryLimit; Table2 Table2 = new Table2(); Table2.query_limit = QueryLimit2; Inbound Inbound = new Inbound(); Inbound.table = Table; Outbound Outbound = new Outbound(); Outbound.table = Table2; DataINeed DataINeed = new DataINeed(); DataINeed.inbound = Inbound; DataINeed.outbound = Outbound; WebClient _webClient = new WebClient(); _webClient.Headers.Add("Content-Type", "application/json"); string data_requested = HttpUtility.UrlEncode(JsonConvert.SerializeObject(DataINeed)); string rpt_json = HttpUtility.UrlEncode(JsonConvert.SerializeObject(ReportDetails)); string data = "action=get&rm=report_api&data_requested=" + data_requested + "&rpt_json=" + rpt_json; string address = "http://gh-scr-d01.diti.lr.net/fcgi/scrut_fcgi.fcgi"; var responseText = Encoding.Default.GetString(_webClient.UploadData(address, "POST", Encoding.Default.GetBytes(data))); Console.WriteLine(responseText); }
public SelectStatement(SqlQueryExpression queryExpression, QueryLimit limit, IEnumerable<SortColumn> orderBy) { if (queryExpression == null) throw new ArgumentNullException("queryExpression"); Limit = limit; QueryExpression = queryExpression; OrderBy = orderBy; }
public async Task <DepthResponse> GetDepthAsync(string symbol, QueryLimit limit = QueryLimit.All) { var br = await Task <DepthResponse> .Run(() => { return(GetDepth(symbol, limit)); }); return(br); }
/// <summary> /// Initializes a new instance of the <see cref="QueryTag"/> class. /// </summary> /// <remarks>Used for constuctoring from core dicom tag.PatientName e.g. </remarks> /// <param name="tag">The core dicom Tag.</param> public QueryTag(DicomTag tag) { EnsureArg.IsNotNull(tag, nameof(tag)); Tag = tag; VR = tag.GetDefaultVR(); Level = QueryLimit.GetQueryTagLevel(tag); ExtendedQueryTagStoreEntry = null; }
public override Node VisitQueryLimit(QueryLimit limit) { limit.Source = this.VisitExpression(limit.Source); Composer save = this.contextComposer; Composer c = this.contextComposer = this.GetComposer(limit.Source); limit.Expression = this.VisitExpression(limit.Expression); this.contextComposer = save; return(this.Compose(limit, c)); }
public SmartPlaylistSource(string name, QueryNode condition, QueryOrder order, QueryLimit limit, IntegerQueryValue limit_value, PrimarySource parent) : this(name, parent) { ConditionTree = condition; QueryOrder = order; Limit = limit; LimitValue = limit_value; SetProperties(); UpdateDependencies(); }
public SmartPlaylistDefinition(string name, string description, string condition, int limit_number, QueryLimit limit, QueryOrder order) { Name = name; Description = description; Condition = condition; LimitNumber = new IntegerQueryValue(); LimitNumber.SetValue(limit_number); Limit = limit; Order = order; }
private static DomainMapUnit GetConfigLimit(string key) { QueryLimit qconfig = new QueryLimit().Get(); DomainMapUnit confine = null; if (qconfig != null && qconfig.DomainMap.ContainsKey(key)) { confine = qconfig.DomainMap[key]; } return(confine); }
public SmartPlaylistSource(string name, QueryNode condition, QueryOrder order, QueryLimit limit, IntegerQueryValue limit_value, bool hiddenWhenEmpty, PrimarySource parent) : this(name, parent) { ConditionTree = condition; QueryOrder = order; Limit = limit; LimitValue = limit_value; IsHiddenWhenEmpty = hiddenWhenEmpty; UpdateDependencies(); }
public SelectStatement(SqlQueryExpression queryExpression, QueryLimit limit, IEnumerable <SortColumn> orderBy) { if (queryExpression == null) { throw new ArgumentNullException("queryExpression"); } Limit = limit; QueryExpression = queryExpression; OrderBy = orderBy; }
public QueryInfo(IRequest request, SqlQueryExpression expression, IEnumerable<SortColumn> sortColumns, QueryLimit limit) { if (expression == null) throw new ArgumentNullException("expression"); if (request == null) throw new ArgumentNullException("request"); Expression = expression; Request = request; SortColumns = sortColumns; Limit = limit; }
public QueryInfo(IRequest request, SqlQueryExpression expression, IEnumerable <SortColumn> sortColumns, QueryLimit limit) { if (expression == null) { throw new ArgumentNullException("expression"); } if (request == null) { throw new ArgumentNullException("request"); } Expression = expression; Request = request; SortColumns = sortColumns; Limit = limit; }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (QueryLimit != null) { hashCode = hashCode * 59 + QueryLimit.GetHashCode(); } if (FileTypeExtensionMap != null) { hashCode = hashCode * 59 + FileTypeExtensionMap.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the order book depth data for a given pair symbol. /// </summary> /// <returns></returns> public DepthResponse GetDepth(string symbol, QueryLimit limit = QueryLimit.All) { //Call specific settings string urlPattern = "{0}/depth?symbol={1}&limit={2}"; string url = string.Format(urlPattern, _env.HttpsApiAddress, symbol, (int)limit); if (url.EndsWith("&limit=0")) { url = url.Replace("&limit=0", ""); } int callsPerSecondAllowed = 10; //Generic items for calls var response = GetStringResponse(url, urlPattern, callsPerSecondAllowed); //Call specific processing of returned values var ret = JsonConvert.DeserializeObject <DepthResponse>(response); return(ret); }
/// <summary> /// Returns true if ComAdobeGraniteAcpPlatformPlatformServletProperties instances are equal /// </summary> /// <param name="other">Instance of ComAdobeGraniteAcpPlatformPlatformServletProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComAdobeGraniteAcpPlatformPlatformServletProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( QueryLimit == other.QueryLimit || QueryLimit != null && QueryLimit.Equals(other.QueryLimit) ) && ( FileTypeExtensionMap == other.FileTypeExtensionMap || FileTypeExtensionMap != null && FileTypeExtensionMap.Equals(other.FileTypeExtensionMap) )); }
public override Node VisitQueryLimit(QueryLimit limit){ if (limit == null) return null; return base.VisitQueryLimit((QueryLimit)limit.Clone()); }
public virtual Node VisitQueryLimit(QueryLimit limit1, QueryLimit limit2){ if (limit1 == null) return null; if (limit2 == null){ limit1.Source = this.VisitExpression(limit1.Source, null); limit1.Expression = this.VisitExpression(limit1.Expression, null); }else{ limit1.Source = this.VisitExpression(limit1.Source, limit2.Source); limit1.Expression = this.VisitExpression(limit1.Expression, limit2.Expression); } return limit1; }
protected override void OnResponse(ResponseType response) { //int w = -1, h = -1; //dialog.GetSize (out w, out h); //Console.WriteLine ("w = {0}, h = {1}", w, h); QueryNode node = builder.QueryNode; if (node == null) { //Console.WriteLine ("Editor query is null"); } else { //Console.WriteLine ("Editor query is: {0}", node.ToXml (BansheeQuery.FieldSet, true)); } if (response == ResponseType.Ok) { string name = PlaylistName; QueryNode condition_tree = Condition; QueryLimit limit = Limit; QueryOrder order = Order; IntegerQueryValue limit_value = LimitValue; ThreadAssist.Spawn(delegate { //Console.WriteLine ("Name = {0}, Cond = {1}, OrderAndLimit = {2}", name, condition, order_by, limit_number); if (playlist == null) { playlist = new SmartPlaylistSource(name, primary_source); playlist.ConditionTree = condition_tree; playlist.QueryOrder = order; playlist.Limit = limit; playlist.LimitValue = limit_value; playlist.Save(); primary_source.AddChildSource(playlist); playlist.RefreshAndReload(); //SmartPlaylistCore.Instance.StartTimer (playlist); } else { playlist.ConditionTree = condition_tree; playlist.QueryOrder = order; playlist.LimitValue = limit_value; playlist.Limit = limit; playlist.Name = name; playlist.Save(); playlist.RefreshAndReload(); /*if (playlist.TimeDependent) * SmartPlaylistCore.Instance.StartTimer (playlist); * else * SmartPlaylistCore.Instance.StopTimer ();*/ //playlist.ListenToPlaylists (); //SmartPlaylistCore.Instance.SortPlaylists (); } }); } currently_editing = null; }
public ISelectStatementBuilder Limit(QueryLimit limit) { queryLimit = limit; return this; }
public SelectStatement(SqlQueryExpression queryExpression, QueryLimit limit) : this(queryExpression, limit, null) { }
private IQueryPlanNode PlanQuery(IRequest context, SqlQueryExpression queryExpression, QueryExpressionFrom queryFrom, IList<SortColumn> sortColumns, QueryLimit limit) { // ----- Resolve the SELECT list // If there are 0 columns selected, then we assume the result should // show all of the columns in the result. bool doSubsetColumn = (queryExpression.SelectColumns.Any()); // What we are selecting var columns = BuildSelectColumns(queryExpression, queryFrom); // Prepare the column_set, var preparedColumns = columns.Prepare(context); sortColumns = ResolveOrderByRefs(preparedColumns, sortColumns); // ----- // Set up plans for each table in the from clause of the command. For // sub-queries, we recurse. var tablePlanner = CreateTablePlanner(context, queryFrom); // ----- // The WHERE and HAVING clauses var whereClause = queryExpression.WhereExpression; var havingClause = queryExpression.HavingExpression; PrepareJoins(tablePlanner, queryExpression, queryFrom, ref whereClause); // Prepare the WHERE and HAVING clause, qualifies all variables and // prepares sub-queries. whereClause = PrepareSearchExpression(context, queryFrom, whereClause); havingClause = PrepareSearchExpression(context, queryFrom, havingClause); // Any extra Aggregate functions that are part of the HAVING clause that // we need to add. This is a list of a name followed by the expression // that contains the aggregate function. var extraAggregateFunctions = new List<SqlExpression>(); if (havingClause != null) havingClause = FilterHaving(havingClause, extraAggregateFunctions, context); // Any GROUP BY functions, ObjectName[] groupByList; IList<SqlExpression> groupByFunctions; var gsz = ResolveGroupBy(queryExpression, queryFrom, context, out groupByList, out groupByFunctions); // Resolve GROUP MAX variable to a reference in this from set var groupmaxColumn = ResolveGroupMax(queryExpression, queryFrom); // ----- // Now all the variables should be resolved and correlated variables set // up as appropriate. // If nothing in the FROM clause then simply evaluate the result of the // select if (queryFrom.SourceCount == 0) return EvaluateToSingle(preparedColumns); // Plan the where clause. The returned node is the plan to evaluate the // WHERE clause. var node = tablePlanner.PlanSearchExpression(whereClause); SqlExpression[] defFunList; string[] defFunNames; var fsz = MakeupFunctions(preparedColumns, extraAggregateFunctions, out defFunList, out defFunNames); var groupInfo = new GroupInfo { Columns = preparedColumns, FunctionCount = fsz, FunctionNames = defFunNames, FunctionExpressions = defFunList, GroupByCount = gsz, GroupByNames = groupByList, GroupByExpressions = groupByFunctions.ToArray(), GroupMax = groupmaxColumn }; node = PlanGroup(node, groupInfo); // The result column list var selectColumns = preparedColumns.SelectedColumns.ToList(); int sz = selectColumns.Count; // Evaluate the having clause if necessary if (havingClause != null) { // Before we evaluate the having expression we must substitute all the // aliased variables. var havingExpr = havingClause; // TODO: this requires a visitor to modify the having expression havingExpr = ReplaceAliasedVariables(havingExpr, selectColumns); var source = tablePlanner.SinglePlan; source.UpdatePlan(node); node = tablePlanner.PlanSearchExpression(havingExpr); } // Do we have a composite select expression to process? IQueryPlanNode rightComposite = null; if (queryExpression.NextComposite != null) { var compositeExpr = queryExpression.NextComposite; var compositeFrom = QueryExpressionFrom.Create(context, compositeExpr); // Form the right plan rightComposite = PlanQuery(context, compositeExpr, compositeFrom, null, null); } // Do we do a final subset column? ObjectName[] aliases = null; if (doSubsetColumn) { // Make up the lists var subsetVars = new ObjectName[sz]; aliases = new ObjectName[sz]; for (int i = 0; i < sz; ++i) { SelectColumn scol = selectColumns[i]; subsetVars[i] = scol.InternalName; aliases[i] = scol.ResolvedName; } // If we are distinct then add the DistinctNode here if (queryExpression.Distinct) node = new DistinctNode(node, subsetVars); // Process the ORDER BY? // Note that the ORDER BY has to occur before the subset call, but // after the distinct because distinct can affect the ordering of the // result. if (rightComposite == null && sortColumns != null) node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); // Rename the columns as specified in the SELECT node = new SubsetNode(node, subsetVars, aliases); } else { // Process the ORDER BY? if (rightComposite == null && sortColumns != null) node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); } // Do we have a composite to merge in? if (rightComposite != null) { // For the composite node = new CompositeNode(node, rightComposite, queryExpression.CompositeFunction, queryExpression.IsCompositeAll); // Final order by? if (sortColumns != null) node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); // Ensure a final subset node if (!(node is SubsetNode) && aliases != null) { node = new SubsetNode(node, aliases, aliases); } } if (limit != null) node = new LimitNode(node, limit.Offset, limit.Count); return node; }
public static ICursor Select(this IRequest request, SqlQueryExpression query, QueryLimit limit, params SortColumn[] orderBy) { return(request.Select(new SelectStatement(query, limit, orderBy))); }
public SmartPlaylistSource(string name, QueryNode condition, QueryOrder order, QueryLimit limit, IntegerQueryValue limit_value, PrimarySource parent) : this(name, condition, order, limit, limit_value, false, parent) { }
public override Node VisitQueryLimit(QueryLimit limit){ if (limit == null) return null; limit.Source = this.VisitExpression(limit.Source); if (limit.Source != null && limit.Source.Type != null){ limit.Expression = this.VisitExpression(limit.Expression); if (limit.Expression != null && limit.Expression.Type != null){ limit.Type = this.GetResultType(limit.Source, null, Cardinality.One); } } return limit; }
public virtual Differences VisitQueryLimit(QueryLimit limit1, QueryLimit limit2){ Differences differences = new Differences(limit1, limit2); if (limit1 == null || limit2 == null){ if (limit1 != limit2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++; return differences; } QueryLimit changes = (QueryLimit)limit2.Clone(); QueryLimit deletions = (QueryLimit)limit2.Clone(); QueryLimit insertions = (QueryLimit)limit2.Clone(); // limit1.Expression; // limit1.IsPercent; // limit1.IsWithTies; if (differences.NumberOfDifferences == 0){ differences.Changes = null; differences.Deletions = null; differences.Insertions = null; }else{ differences.Changes = changes; differences.Deletions = deletions; differences.Insertions = insertions; } return differences; }
public QueryInfo(IRequest request, SqlQueryExpression expression, QueryLimit limit) : this(request, expression, null, limit) { }
public virtual void VisitQueryLimit(QueryLimit limit){ if (limit == null) return; this.VisitExpression(limit.Source); this.VisitExpression(limit.Expression); }
public SmartPlaylistDefinition(string name, string description, string condition, int limit_number, QueryLimit limit, QueryOrder order) : this(name, description, condition, limit_number, limit, order, false) { }
private IQueryPlanNode PlanQuery(IRequest context, SqlQueryExpression queryExpression, QueryExpressionFrom queryFrom, IList <SortColumn> sortColumns, QueryLimit limit) { // ----- Resolve the SELECT list // If there are 0 columns selected, then we assume the result should // show all of the columns in the result. bool doSubsetColumn = (queryExpression.SelectColumns.Any()); // What we are selecting var columns = BuildSelectColumns(queryExpression, queryFrom); // Prepare the column_set, var preparedColumns = columns.Prepare(context); sortColumns = ResolveOrderByRefs(preparedColumns, sortColumns); // ----- // Set up plans for each table in the from clause of the command. For // sub-queries, we recurse. var tablePlanner = CreateTablePlanner(context, queryFrom); // ----- // The WHERE and HAVING clauses var whereClause = queryExpression.WhereExpression; var havingClause = queryExpression.HavingExpression; PrepareJoins(tablePlanner, queryExpression, queryFrom, ref whereClause); // Prepare the WHERE and HAVING clause, qualifies all variables and // prepares sub-queries. whereClause = PrepareSearchExpression(context, queryFrom, whereClause); havingClause = PrepareSearchExpression(context, queryFrom, havingClause); // Any extra Aggregate functions that are part of the HAVING clause that // we need to add. This is a list of a name followed by the expression // that contains the aggregate function. var extraAggregateFunctions = new List <SqlExpression>(); if (havingClause != null) { havingClause = FilterHaving(havingClause, extraAggregateFunctions, context); } // Any GROUP BY functions, ObjectName[] groupByList; IList <SqlExpression> groupByFunctions; var gsz = ResolveGroupBy(queryExpression, queryFrom, context, out groupByList, out groupByFunctions); // Resolve GROUP MAX variable to a reference in this from set var groupmaxColumn = ResolveGroupMax(queryExpression, queryFrom); // ----- // Now all the variables should be resolved and correlated variables set // up as appropriate. // If nothing in the FROM clause then simply evaluate the result of the // select if (queryFrom.SourceCount == 0) { return(EvaluateToSingle(preparedColumns)); } // Plan the where clause. The returned node is the plan to evaluate the // WHERE clause. var node = tablePlanner.PlanSearchExpression(whereClause); SqlExpression[] defFunList; string[] defFunNames; var fsz = MakeupFunctions(preparedColumns, extraAggregateFunctions, out defFunList, out defFunNames); var groupInfo = new GroupInfo { Columns = preparedColumns, FunctionCount = fsz, FunctionNames = defFunNames, FunctionExpressions = defFunList, GroupByCount = gsz, GroupByNames = groupByList, GroupByExpressions = groupByFunctions.ToArray(), GroupMax = groupmaxColumn }; node = PlanGroup(node, groupInfo); // The result column list var selectColumns = preparedColumns.SelectedColumns.ToList(); int sz = selectColumns.Count; // Evaluate the having clause if necessary if (havingClause != null) { // Before we evaluate the having expression we must substitute all the // aliased variables. var havingExpr = havingClause; // TODO: this requires a visitor to modify the having expression havingExpr = ReplaceAliasedVariables(havingExpr, selectColumns); var source = tablePlanner.SinglePlan; source.UpdatePlan(node); node = tablePlanner.PlanSearchExpression(havingExpr); } // Do we have a composite select expression to process? IQueryPlanNode rightComposite = null; if (queryExpression.NextComposite != null) { var compositeExpr = queryExpression.NextComposite; var compositeFrom = QueryExpressionFrom.Create(context, compositeExpr); // Form the right plan rightComposite = PlanQuery(context, compositeExpr, compositeFrom, null, null); } // Do we do a final subset column? ObjectName[] aliases = null; if (doSubsetColumn) { // Make up the lists var subsetVars = new ObjectName[sz]; aliases = new ObjectName[sz]; for (int i = 0; i < sz; ++i) { SelectColumn scol = selectColumns[i]; subsetVars[i] = scol.InternalName; aliases[i] = scol.ResolvedName; } // If we are distinct then add the DistinctNode here if (queryExpression.Distinct) { node = new DistinctNode(node, subsetVars); } // Process the ORDER BY? // Note that the ORDER BY has to occur before the subset call, but // after the distinct because distinct can affect the ordering of the // result. if (rightComposite == null && sortColumns != null) { node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); } // Rename the columns as specified in the SELECT node = new SubsetNode(node, subsetVars, aliases); } else { // Process the ORDER BY? if (rightComposite == null && sortColumns != null) { node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); } } // Do we have a composite to merge in? if (rightComposite != null) { // For the composite node = new CompositeNode(node, rightComposite, queryExpression.CompositeFunction, queryExpression.IsCompositeAll); // Final order by? if (sortColumns != null) { node = PlanForOrderBy(node, sortColumns, queryFrom, selectColumns); } // Ensure a final subset node if (!(node is SubsetNode) && aliases != null) { node = new SubsetNode(node, aliases, aliases); } } if (limit != null) { node = new LimitNode(node, limit.Offset, limit.Count); } return(node); }
public override Node VisitQueryLimit(QueryLimit ql) { TypeNode resultElementType = this.typeSystem.GetStreamElementType(ql, this.TypeViewer); Block block = null; Node closure = this.StartQueryClosure(resultElementType, "top", out block); BlockScope scope = block.Scope; Expression source = ql.Source; Expression locLimit = this.NewClosureLocal(SystemTypes.Int32, scope); Expression locPosition = this.NewClosureLocal(SystemTypes.Int32, scope); Expression feTarget = null; Block inner = null; if (ql.IsPercent) { Expression locList = new Local(SystemTypes.ArrayList); Construct cons = new Construct(); cons.Constructor = new MemberBinding(null, SystemTypes.ArrayList.GetConstructor()); cons.Type = SystemTypes.ArrayList; block.Statements.Add(new AssignmentStatement(locList, cons)); block.Statements.Add(this.BuildClosureForEach(source, ref feTarget, out inner, scope)); // list.Add(item); Method madd = SystemTypes.ArrayList.GetMethod(StandardIds.Add, SystemTypes.Object); MethodCall mcAdd = new MethodCall(new MemberBinding(locList, madd), new ExpressionList(this.Box(feTarget))); mcAdd.Type = madd.ReturnType; inner.Statements.Add(new ExpressionStatement(mcAdd)); source = locList; // percent = expr / 100 BinaryExpression percent = new BinaryExpression(this.typeSystem.ExplicitCoercion(ql.Expression, SystemTypes.Double, this.TypeViewer), new Literal(100.0, SystemTypes.Double), NodeType.Div); percent.Type = SystemTypes.Double; // limit = count * percent Method mgetcount = SystemTypes.ArrayList.GetMethod(Identifier.For("get_Count")); MethodCall mcgetcount = new MethodCall(new MemberBinding(null, mgetcount), new ExpressionList(locList)); mcgetcount.Type = mgetcount.ReturnType; BinaryExpression limit = new BinaryExpression(this.typeSystem.ExplicitCoercion(mcgetcount, SystemTypes.Double, this.TypeViewer), percent, NodeType.Mul); limit.Type = SystemTypes.Double; block.Statements.Add(new AssignmentStatement(locLimit, this.typeSystem.ExplicitCoercion(limit, SystemTypes.Int32, this.TypeViewer))); Block brGoodLimit = new Block(); block.Statements.Add(new Branch(new BinaryExpression(locLimit, Literal.Int32Zero, NodeType.Gt), brGoodLimit)); block.Statements.Add(new AssignmentStatement(locLimit, Literal.Int32One)); block.Statements.Add(brGoodLimit); } else { block.Statements.Add(new AssignmentStatement(locLimit, this.typeSystem.ExplicitCoercion(ql.Expression, SystemTypes.Int32, this.TypeViewer))); } Block exit = new Block(); block.Statements.Add(this.BuildClosureForEach(source, ref feTarget, out inner, scope)); inner.Statements.Add(new Yield(feTarget)); inner.Statements.Add(new AssignmentStatement(locPosition, new BinaryExpression(locPosition, Literal.Int32One, NodeType.Add))); inner.Statements.Add(new Branch(new BinaryExpression(locPosition, locLimit, NodeType.Ge), exit)); block.Statements.Add(exit); return this.EndQueryClosure(closure, ql.Type); }
public override Node VisitQueryLimit(QueryLimit ql) { if (ql == null) return null; ql.Source = this.VisitExpression(ql.Source); if (ql.Source == null || ql.Source.Type == null) return null; Cardinality card = this.typeSystem.GetCardinality(ql.Source, this.TypeViewer); if (card != Cardinality.OneOrMore && card != Cardinality.ZeroOrMore) { this.HandleError(ql.Source, Error.QueryNotStream); return null; } ql.Expression = this.VisitExpression(ql.Expression); if (ql.Expression == null || ql.Expression.Type == null) return null; if (ql.Expression.NodeType != NodeType.Literal) { this.HandleError(ql, Error.QueryBadLimitNotLiteral); return null; } else if (!this.typeSystem.ImplicitCoercionFromTo(ql.Expression.Type, SystemTypes.Int64, this.TypeViewer)) { if (!this.typeSystem.ImplicitCoercionFromTo(ql.Expression.Type, SystemTypes.Double, this.TypeViewer) && !this.typeSystem.ImplicitCoercionFromTo(ql.Expression.Type, SystemTypes.Decimal, this.TypeViewer)) { this.HandleError(ql.Expression, Error.QueryBadLimit); return null; } else if (!ql.IsPercent) { this.HandleError(ql.Expression, Error.QueryBadLimitForNotPercent); return null; } } if (ql.Type == null) return null; return ql; }
public override Node VisitQueryLimit(QueryLimit limit) { limit.Source = this.VisitExpression(limit.Source); Composer save = this.contextComposer; Composer c = this.contextComposer = this.GetComposer(limit.Source); limit.Expression = this.VisitExpression(limit.Expression); this.contextComposer = save; return this.Compose(limit, c); }
public ISelectStatementBuilder Limit(QueryLimit limit) { queryLimit = limit; return(this); }
public virtual Node VisitQueryLimit(QueryLimit limit){ if (limit == null) return null; limit.Source = this.VisitExpression(limit.Source); limit.Expression = this.VisitExpression(limit.Expression); return limit; }
public virtual Node VisitQueryLimit(QueryLimit limit, QueryLimit changes, QueryLimit deletions, QueryLimit insertions){ this.UpdateSourceContext(limit, changes); if (limit == null) return changes; if (changes != null){ if (deletions == null || insertions == null) Debug.Assert(false); else{ } }else if (deletions != null) return null; return limit; }
public EventingVisitor(Action<QueryLimit> visitQueryLimit) { VisitedQueryLimit += visitQueryLimit; } public event Action<QueryLimit> VisitedQueryLimit; public override Node VisitQueryLimit(QueryLimit limit) { if (VisitedQueryLimit != null) VisitedQueryLimit(limit); return base.VisitQueryLimit(limit); }