Create an AND-condition to add conditions to. |
|
Get all the columns of the datasource that can be used for this query (select or where clause) |
|
Get the functions clause from a query, used for functions that are not tied to a column. |
|
Get the group by clause from a query |
|
Get the having-part of the query, used to add conditions. |
|
Get the joins clause of this table based clause. |
|
Create an OR-condition to add conditions to. |
|
Get the named parameters from a query. |
|
Get query builder parent table clause, this may be a query or a join clause. |
|
Get the result part of the query, used to add result columns or values. |
|
Get query builder parent. |
|
Get the sorting part of the query. |
|
Get the where-part of the query, used to add conditions. |
|
|
Clear the having-part of the query. |
|
Get an exists-condition from a subquery |
|
Get a column from the table. |
|
Get a column from the table with given alias. |
|
Returns the datasource for this. |
|
Get or create a parameter for the query, this used to parameterize queries. |
|
Returns the table alias for this. |
|
Create an inlined value converted to the type of the column. |
|
Create an negated condition. |
|
Create an negated condition. |
|
|
Create an AND-condition to add conditions to. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.where.add(
query.or
.add(
query.and
.add(query.columns.flag.eq(1))
.add(query.columns.order_date.isNull)
)
.add(
query.and
.add(query.columns.flag.eq(2))
.add(query.column.order_date.gt(new Date()))
)
); |
|
|
|
|
Get all the columns of the datasource that can be used for this query (select or where clause) |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = foundset.getQuery();
query.result.add(query.columns.name, "name");
query.where.add(query.columns.orderdate.isNull) |
|
|
|
|
Get the functions clause from a query, used for functions that are not tied to a column. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = ddatasources.db.example_data.orders.createSelect();
query.where.add(query.columns.shipname.upper.eq(query.functions.upper('servoy'))) //$NON-NLS-1$
foundset.loadRecords(query) |
|
|
|
|
Get the group by clause from a query |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.orders.createSelect();
query.groupBy.addPk() // have to group by on pk when using having-conditions in (foundset) pk queries
.root.having.add(query.joins.orders_to_order_details.columns.quantity.count.eq(0))
foundset.loadRecords(query) |
|
|
|
|
Get the having-part of the query, used to add conditions.
The conditions added here are AND-ed. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.orders.createSelect();
query.groupBy.addPk() // have to group by on pk when using having-conditions in (foundset) pk queries
.root.having.add(query.joins.orders_to_order_details.columns.quantity.count.eq(0))
foundset.loadRecords(query) |
|
|
|
|
Get the joins clause of this table based clause.
Joins added to this clause will be based on this table clauses table. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.getQuery().joins |
|
|
|
|
Create an OR-condition to add conditions to. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.where.add(
query.or
.add(
query.and
.add(query.columns.flag.eq(1))
.add(query.columns.order_date.isNull)
)
.add(
query.and
.add(query.columns.flag.eq(2))
.add(query.column.order_date.gt(new Date()))
)
); |
|
|
|
|
Get the named parameters from a query. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.orders.createSelect();
query.where.add(query.columns.contact_id.eq(query.getParameter('mycontactid')))
// load orders where contact_id = 100
query.params['mycontactid'] = 100
foundset.loadRecords(query)
// load orders where contact_id = 200
query.params['mycontactid'] = 200
foundset.loadRecords(query) |
|
|
|
|
Get query builder parent table clause, this may be a query or a join clause. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.person.createSelect();
query.where.add(query.joins.person_to_parent.joins.person_to_parent.columns.name.eq('john'))
foundset.loadRecords(query) |
|
|
|
|
Get the result part of the query, used to add result columns or values. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample query.result.add(query.columns.company_id).add(query.columns.customerid) |
|
|
|
|
Get query builder parent. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var subquery = datasources.db.example_data.order_details.createSelect();
var query = datasources.db.example_data.orders.createSelect();
query.where.add(query
.or
.add(query.columns.order_id.not.isin([1, 2, 3]))
.add(query.exists(
subquery.where.add(subquery.columns.orderid.eq(query.columns.order_id)).root
))
)
foundset.loadRecords(query) |
|
|
|
|
Get the sorting part of the query. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.orders.createSelect();
query.sort
.add(query.joins.orders_to_order_details.columns.quantity.desc)
.add(query.columns.companyid)
foundset.loadRecords(query) |
|
|
|
|
Get the where-part of the query, used to add conditions.
The conditions added here are AND-ed. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = foundset.getQuery()
query.where.add(query.columns.flag.eq(1)) |
|
|
|
|
|
Clear the having-part of the query. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var q = foundset.getQuery()
q.where.add(q.columns.x.eq(100))
query.groupBy.clear.root.clearHaving()
foundset.loadRecords(q); |
|
|
|
|
Get an exists-condition from a subquery |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.query.where.add(query.exists(query2)) |
|
|
|
|
Get a column from the table. |
|
|
Parameters the name of column to get |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.getQuery().getColumn('orderid') |
|
|
|
|
getColumn(columnTableAlias, name) |
|
Get a column from the table with given alias.
The alias may be of the main table or any level deep joined table. |
|
|
Parameters the name of column to get |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.getQuery().getColumn('orderid', 'opk') |
|
|
|
|
Returns the datasource for this. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
|
Get or create a parameter for the query, this used to parameterize queries. |
|
|
Parameters the name of the parameter |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.orders.createSelect();
query.where.add(query.columns.contact_id.eq(query.getParameter('mycontactid')))
// load orders where contact_id = 100
query.params['mycontactid'] = 100
foundset.loadRecords(query)
// load orders where contact_id = 200
query.params['mycontactid'] = 200
foundset.loadRecords(query) |
|
|
|
|
Returns the table alias for this. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
|
Create an inlined value. An inlined value is a value that will appear literally in the resulting sql.
For example
<pre>
query.where.add(query.columns.custid.eq(query.inline(200)))
</pre>
results in sql
<pre>
where custid = 200
</pre>
And
<pre>
query.where.add(query.columns.custid.eq(200))
</pre>
results in sql
<pre>
where custid = ?
</pre> with prepared statement value 200.
<p>
Inlined values can be used in situations where prepared statement expressions give sql problems, for example in some group-by clauses.
Note that using the same query with different inlined values effectively disables prepared statement caching for the query and may have a negative performance impact. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.order_details.createSelect();
var query = datasources.db.example_data.order_details.createSelect();
var mult = query.columns.unitprice.multiply(query.inline(100, query.columns.unitprice));
query.result.add(mult);
query.result.add(query.columns.discount.max);
query.groupBy.add(mult); |
|
|
|
|
inline(number, columnForType) |
|
Create an inlined value converted to the type of the column. |
|
|
Parameters convert value to type of the column |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample var query = datasources.db.example_data.order_details.createSelect();
var query = datasources.db.example_data.order_details.createSelect();
var mult = query.columns.unitprice.multiply(query.inline(100, query.columns.unitprice));
query.result.add(mult);
query.result.add(query.columns.discount.max);
query.groupBy.add(mult); |
|
|
|
|
Create an negated condition. |
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.query.where.add(query.not(query.columns.flag.eq(1))) |
|
|
|
|
Create an negated condition. |
|
|
Parameters the logical condition to negate |
|
|
|
|
Supported Clients SmartClient,WebClient,NGClient |
|
|
Sample foundset.query.where.add(query.not(query.columns.flag.eq(1))) |
|
|
|
|
|
|