MySQL · Types · Queries
ArxQueryExpression
Definition
- Namespace
ARX.SDK.Query- Package
ARX.SDK
public class ArxQueryExpressionA query for RetrieveMultiple: what to read from (Source: a table, view or function), the columns, the criteria (nested AND/OR), joins (LinkEntities), order, paging, distinct and aggregates. Every name in it is validated and quoted by the provider, every value sent as a parameter.
Constructor
ArxQueryExpression()A query with no row source yet: set EntityName or Source.
ArxQueryExpression(string entityName)A query on a table or view (optionally schema-qualified:
reporting.v_sales).Parameter Type Description entityNamestringThe table or view to read (on PostgreSQL also a materialized view), or schema.name.ArxQueryExpression(ArxRowSource source)A query on any row source: a table, a view, or a function returning rows (
Function).Parameter Type Description sourceArxRowSourceWhat to read from: a table by name, or a function with its arguments.
Properties
ArxRowSource Source { get; set; }What the query reads from.
string EntityName { get; set; }The row source's name. Setting it makes the source that table or view.
bool Distinct { get; set; }SELECT DISTINCT: rows that differ in no selected column come back once. A distinct (or aggregate) query doesn't add the id to the columns, since it would make every row distinct, so its rows have noArxEntity.RecordId: select the id column if you need it.int? Top { get; set; }At most this many rows (
LIMIT), without paging. Can't be combined withPageInfo(ARX1001).ArxColumnSet ColumnSet { get; set; }The columns to read. Empty (the default) or
AllColumnsreads every column. A column can be writtencolumn._lk.table.column1,column2to join a referenced table directly.ArxFilterExpression Criteria { get; set; }The conditions rows have to meet (nested And/Or).
List<ArxOrderExpression> Orders { get; set; }The sort keys, in order; AddOrder adds one.
List<ArxLinkEntity> LinkEntities { get; set; }The joins; AddLink adds one.
ArxPagingInfo? PageInfo { get; set; }Offset paging: the page size and number, and whether to return the total (in the same round trip).
ArxAggregateInfo? AggregateInfo { get; set; }Aggregates and group by; null for a plain read.
Methods
void AddOrder(string attributeName, ArxOrderType orderType)Orders the results by an attribute; call again for the next key.
Parameter Type Description attributeNamestringThe column to order by. orderTypeArxOrderTypeAscending or Descending. void AddOrder(string entityAlias, string attributeName, ArxOrderType orderType)Orders by a column of a joined entity, named by its alias.
Parameter Type Description entityAliasstringThe link alias the column belongs to. attributeNamestringThe column to order by. orderTypeArxOrderTypeAscending or Descending. ArxLinkEntity AddLink(string linkToEntityName, string linkFromAttributeName, string linkToAttributeName, ArxJoinOperator joinOperator)Joins a table (see
ArxLinkEntity) and returns the join, to add its columns, alias and criteria.Parameter Type Description linkToEntityNamestringThe table to join. linkFromAttributeNamestringThe column of the query's own table that the join matches. linkToAttributeNamestringThe column of the joined table that it matches. joinOperatorArxJoinOperatorINNER (rows with a match only) or LEFT (every row, with nulls where nothing matches).
Usage
A line from a verified sample; the full, runnable code is on its page.
var query = new ArxQueryExpression("legacy_customer");Use columns named outside the name rule, through aliases, scenario 2
Used in:
- Use columns named outside the name rule, through aliasesCreate
- Log every call through ILoggerCreate
- Read your own writes in an ARX transactionRetrieve
- Retrieve many records with a queryRetrieveMultiple
- Page through resultsRetrieveMultiple
- Query without a catalogRetrieveMultiple
- A contact search screenRetrieveMultiple
- Accounts and contacts in one queryRetrieveMultiple
- A report: accounts by industryRetrieveMultiple
- Dates and times in conditionsRetrieveMultiple
- Read a viewRetrieveMultiple
- Rows from a function: refused on MySQL, and what to read insteadRetrieveMultiple
- Lookups and display namesRetrieveMultiple
- Turn read errors into messagesRetrieveMultiple
- Catch an SQL injection attempt on a searchRetrieveMultiple
- Read in a batch scopeRetrieveMultiple
- Export a large table in pagesRetrieveMultiple
- A security check around a search endpointRetrieveMultiple
- Filter expressions in depth: nesting, recursion, links, And and OrRetrieveMultiple
- Link entities in depth: chains, branches, criteria per level, recursionRetrieveMultiple
- Paging in depth: the total is opt-in, ask once, load more, Top, seek pagingRetrieveMultiple
- Read other row sources: a view in a schema, a summary view, a table with no idRetrieveMultiple
- Functions in depth on MySQL: tables, procedures and scalar values instead of row sourcesRetrieveMultiple
- Views in depth: computed criteria, links both ways, declared ids and lookups, column boundariesRetrieveMultiple
- Retrieve on a preloaded schema: lookups found, column types, Strict, saved JSONRetrieveMultiple
- Page through a procedure's result: the procedure pages itself, ARX pages a result setExecute
- Execute on a preloaded, Strict schema: routines aren't covered, tables areExecute