QBSelect
Last updated
Was this helpful?
Last updated
Was this helpful?
QBSelect
is a wrapper for building SQL SELECT
queries in Servoy, providing a flexible API to add conditions, sorting, grouping, joins, and parameters to SQL-based queries. Through structured access to clauses like where
, groupBy
, and joins
, QBSelect
supports complex query construction and parameterized queries.
For detailed query building, see in the Servoy documentation.
Get the aggregates clause from a query, used for aggregates that are not tied to a column.
Create an AND-condition to add conditions to.
Create an case searched expression.
Get all the columns of the datasource that can be used for this query (select or where clause)
Specifies a comment of the query.
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.
Performs a sql query with a query builder object.
Performs a sql query with a query builder object.
Returns the datasource for this.
Returns a foundset object for a specified pk base query.
Get or create a parameter for the query, this used to parameterize queries.
Returns the internal SQL of the QBSelect.
Returns the internal SQL of the QBSelect.
Returns the parameters for the internal SQL of the QBSelect.
Returns the parameters for the internal SQL of the QBSelect.
Returns the table alias for this.
Create an inlined value.
Create an inlined value converted to the type of the column.
Create an inlined (quoted) value.
Create an negated condition.
Create an negated condition.
Get the aggregates clause from a query, used for aggregates that are not tied to a column.
Sample
Create an AND-condition to add conditions to.
Sample
Create an case searched expression.
Sample
Get all the columns of the datasource that can be used for this query (select or where clause)
Sample
Specifies a comment of the query.
Sample
Get the functions clause from a query, used for functions that are not tied to a column.
Sample
Get the group by clause from a query
Sample
Get the having-part of the query, used to add conditions. The conditions added here are AND-ed.
Sample
Get the joins clause of this table based clause. Joins added to this clause will be based on this table clauses table.
Sample
Create an OR-condition to add conditions to.
Sample
Get the named parameters from a query.
Sample
Get query builder parent table clause, this may be a query or a join clause.
Sample
Get the result part of the query, used to add result columns or values.
Sample
Get query builder parent.
Sample
Get the sorting part of the query.
Sample
Get the where-part of the query, used to add conditions. The conditions added here are AND-ed.
Sample
Clear the having-part of the query.
Sample
Get an exists-condition from a subquery
Parameters
Sample
Get a column from the table.
Parameters
Sample
Get a column from the table with given alias. The alias may be of the main table or any level deep joined table.
Parameters
Sample
Performs a sql query with a query builder object. Same as databaseManager.getDataSetByQuery. Will throw an exception if anything did go wrong when executing the query.
Using this variation of getDataSet any Tablefilter on the involved tables will be taken into account.
Parameters
Sample
Performs a sql query with a query builder object. Same as databaseManager.getDataSetByQuery. Will throw an exception if anything did go wrong when executing the query.
Parameters
Sample
Returns the datasource for this.
Returns a foundset object for a specified pk base query. Same as databaseManager.getFoundSet(QBSelect).
Sample
Get or create a parameter for the query, this used to parameterize queries.
Parameters
Sample
Returns the internal SQL of the QBSelect. Table filters are on by default.
Sample
Returns the internal SQL of the QBSelect. Table filters are on by default.
Parameters
Sample
Returns the parameters for the internal SQL of the QBSelect. Table filters are on by default.
Sample
Returns the parameters for the internal SQL of the QBSelect. Table filters are on by default.
Parameters
Sample
Returns the table alias for this.
Create an inlined value. An inlined value is a value that will appear literally in the resulting sql. For example
results in sql
And
results in sql
with prepared statement value 200.
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.
In case of a string will the value be validated, values that contain a single quote will not be inlined.
Parameters
Sample
Create an inlined value converted to the type of the column.
Parameters
Sample
Create an inlined (quoted) value.
Parameters
Sample
Create an negated condition.
Parameters
Sample
Create an negated condition.
Parameters
Sample
Type the aggregates clause of the query for non-column-bound aggregates.
Type an AND-condition for adding logical conditions.
Type a case expression for conditional logic in the query.
Type
Type the comment associated with this query.
Type the functions clause of the query for non-column-bound functions.
Type the group-by clause of the query.
Type the having-part of the query for adding conditions.
Type
Type an OR-condition for adding logical conditions.
Type the named parameters of the query.
Type
Type the result part of the query for adding result columns or values.
Type
Type the sorting part of the query.
Type the where-part of the query for adding conditions.
Returns: the updated query builder after clearing the having clause.
query the sub query
Returns: a condition that checks the existence of the given subquery.
name the name of column to get
Returns: the QBColumn representing the specified column name.
columnTableAlias the alias for the table
name the name of column to get
Returns: the QBColumn representing the specified column from the table with the given alias.
max_returned_rows The maximum number of rows returned by the query.
Returns: The JSDataSet containing the results of the query.
max_returned_rows The maximum number of rows returned by the query.
useTableFilters use table filters (default true).
Returns: The JSDataSet containing the results of the query.
Returns: the dataSource
Returns: A new JSFoundset with the query as its base query.
name the name of the parameter
Returns: the parameter with the specified name.
Returns: String representing the sql of the Query Builder.
includeFilters include the table filters [default true].
Returns: String representing the sql of the Query Builder.
Returns: An Array with the sql parameter values.
includeFilters include the table filters [default true].
Returns: An Array with the sql parameter values.
Returns: the tableAlias
number value to inline
Returns: an inlined value appearing literally in the resulting SQL.
number value to inline
columnForType convert value to type of the column
Returns: an inlined value converted to the type of the specified column.
string value to inline
Returns: an inlined (quoted) string value.
cond the condition to negate
Returns: a negated version of the specified condition.
cond the logical condition to negate
Returns: a negated version of the specified logical condition.