Child pages
  • QBSorts
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »


Property Summary
QBSelect #parent
Get query builder parent table clause, this may be a query or a join clause.
QBSelect #root
Get query builder parent.

Method Summary
QBSorts #add(columnSortAsc)
Ad an ascending sorting on a column to the query sort.
QBSorts #add(functionSortAsc)
Ad an ascending sorting on a column to the query sort.
QBSorts #add(sort)
Ad a sorting on a column to the query sort.
QBSorts #addPk()
Add the tables' primary pk columns in alphabetical order to the query sort.
QBSorts #clear()
Clear the sorting clause for the query.

Property Details
parent
Get query builder parent table clause, this may be a query or a join clause.
Returns
Sample
/** @type {QBSelect<db:/example_data/person>} */
	var query = databaseManager.createSelect('db:/example_data/person')
	query.where.add(query.joins.person_to_parent.joins.person_to_parent.columns.name.eq('john'))
	foundset.loadRecords(query)
root
Get query builder parent.
Returns
Sample
/** @type {QBSelect<db:/example_data/order_details>} */
	var subquery = databaseManager.createSelect('db:/example_data/order_details')
	
 /** @type {QBSelect<db:/example_data/orders>} */
	var query = databaseManager.createSelect('db:/example_data/orders')
	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)

Method Details
add

QBSorts add (columnSortAsc)

Ad an ascending sorting on a column to the query sort.
Parameters
{QBColumn} columnSortAsc – column to sort by
Returns
Sample
query.sort.add(query.columns.orderid)
add

QBSorts add (functionSortAsc)

Ad an ascending sorting on a column to the query sort.
Parameters
{QBFunction} functionSortAsc – function to add
Returns
Sample
query.sort.add(query.columns.orderid)
add

QBSorts add (sort)

Ad a sorting on a column to the query sort.
Parameters
{QBSort} sort – the sort to add
Returns
Sample
query.sort.add(query.columns.orderid.desc)
addPk

QBSorts addPk ()

Add the tables' primary pk columns in alphabetical order to the query sort.
Returns
Sample
query.sort.addPk()
clear

QBSorts clear ()

Clear the sorting clause for the query.
Returns
Sample
query.sort.clear()
  • No labels