QBFunction
Last updated
Was this helpful?
Last updated
Was this helpful?
The QBFunction
class is a wrapper for SQL functions, designed for use within QBSelect
to build complex expressions and conditions for queries. It facilitates operations such as mathematical transformations, string manipulations, and date/time calculations, enabling dynamic and flexible data handling.
Key features include creating expressions like abs
, avg
, ceil
, lower
, and round
for mathematical or string operations. Date extraction functions, such as day
, month
, and year
, are also supported. Logical conditions like between
, like
, eq
, and lt
provide powerful tools for data filtering and comparison.
For more information on constructing and executing queries, refer to the section of this documentation.
Create abs(column) expression
Create an ascending sort expression
Create an aggregate average expression.
Create bit_length(column) expression
Create ceil(column) expression
Create an aggregate count expression.
Extract day from date
Create an descending sort expression
Create floor(column) expression
Extract hour from date
Compare column with null.
Create length(column) expression
Create lower(column) expression
Create an aggregate max expression.
Create an aggregate min expression.
Extract minute from date
Extract month from date
Create a negated condition.
Get query builder parent table clause, this may be a query or a join clause.
Get query builder parent.
Create round(column) expression
Extract second from date
Create sqrt(column) expression
Create an aggregate sum expression.
Create trim(column) expression
Create upper(column) expression
Extract year from date
Compare column to a range of 2 values or other columns.
Create cast(column, type) expression
Concatename with value
Divide by value
Compare column with a value or another column.
Compare column with a value or another column.
The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.
Column type as a string
Compare column with a value or another column.
Compare column with subquery result.
Compare column with values.
Compare column with custom query result.
Compare column with a value or another column.
Compare column with a value or another column.
Compare column with a value or another column.
Create locate(arg) expression
Create locate(arg, start) expression
Compare column with a value or another column.
Subtract value
Create mod(arg) expression
Multiply with value
Create nullif(arg) expression
Add up value
Create substring(pos) expression
Create substring(pos, len) expression
Create abs(column) expression
Sample
Create an ascending sort expression
Sample
Create an aggregate average expression.
Sample
Create bit_length(column) expression
Sample
Create ceil(column) expression
Sample
Create an aggregate count expression.
Sample
Extract day from date
Sample
Create an descending sort expression
Sample
Create floor(column) expression
Sample
Extract hour from date
Sample
Compare column with null.
Sample
Create length(column) expression
Sample
Create lower(column) expression
Sample
Create an aggregate max expression.
Sample
Create an aggregate min expression.
Sample
Extract minute from date
Sample
Extract month from date
Sample
Create a negated condition.
Sample
Get query builder parent table clause, this may be a query or a join clause.
Sample
Get query builder parent.
Sample
Create round(column) expression
Sample
Extract second from date
Sample
Create sqrt(column) expression
Sample
Create an aggregate sum expression.
Sample
Create trim(column) expression
Sample
Create upper(column) expression
Sample
Extract year from date
Sample
Compare column to a range of 2 values or other columns.
Parameters
Sample
Create cast(column, type) expression
Parameters
Sample
Concatename with value
Parameters
Sample
Divide by value
Parameters
Sample
Compare column with a value or another column. Operator: equals
Parameters
Sample
Compare column with a value or another column. Operator: greaterThanOrEqual
Parameters
Sample
The flags are a bit pattern consisting of 1 or more of the following bits: - JSColumn.UUID_COLUMN - JSColumn.EXCLUDED_COLUMN - JSColumn.TENANT_COLUMN
Column type as a string
Compare column with a value or another column. Operator: greaterThan
Parameters
Sample
Compare column with subquery result.
Parameters
Sample
Compare column with values.
Parameters
Sample
Compare column with custom query result.
Parameters
Sample
Compare column with a value or another column. Operator: lessThanOrEqual
Parameters
Sample
Compare column with a value or another column. Operator: like
Parameters
Sample
Compare column with a value or another column. Operator: like, with escape character
Parameters
Sample
Create locate(arg) expression
Parameters
Sample
Create locate(arg, start) expression
Parameters
Sample
Compare column with a value or another column. Operator: lessThan
Parameters
Sample
Subtract value
Parameters
Sample
Create mod(arg) expression
Parameters
Sample
Multiply with value
Parameters
Sample
Create nullif(arg) expression
Parameters
Sample
Add up value
Parameters
Sample
Create substring(pos) expression
Parameters
Sample
Create substring(pos, len) expression
Parameters
Sample
Type a QBFunction representing the absolute value function.
Type a QBSort representing an ascending sort order.
Type a QBAggregate representing the average aggregate function.
Type a QBFunction representing the bit length function.
Type a QBFunction representing the ceil function.
Type a QBAggregate representing the count aggregate function.
Type a QBFunction representing the extraction of the day from a date.
Type a QBSort representing a descending sort order.
Type a QBFunction representing the floor function.
Type a QBFunction representing the extraction of the hour from a date.
Type a QBCondition representing the "is null" comparison.
Type a QBFunction representing the length function.
Type a QBFunction representing the lower case transformation.
Type a QBAggregate representing the maximum aggregate function.
Type a QBAggregate representing the minimum aggregate function.
Type a QBFunction representing the extraction of the minute from a date.
Type a QBFunction representing the extraction of the month from a date.
Type a QBColumn representing the negated condition.
Type
Type
Type a QBFunction representing the round function.
Type a QBFunction representing the extraction of the second from a date.
Type a QBFunction representing the square root function.
Type a QBAggregate representing the sum aggregate function.
Type a QBFunction representing the trim function.
Type a QBFunction representing the upper case transformation.
Type a QBFunction representing the extraction of the year from a date.
value1 ;
value2 ;
Returns: a QBCondition representing the "between" comparison for the two values.
type string type, see QUERY_COLUMN_TYPES
Returns: a QBFunction representing the cast function with the specified type.
arg valeu to concatenate with
Returns: a QBFunction representing the concatenation operation.
arg nr to divide by
Returns: a QBFunction representing the division operation.
value ;
Returns: a QBCondition representing the "equals" comparison.
value ;
Returns: a QBCondition representing the "greater than or equal to" comparison.
Returns: an integer representing the flags of the column.
Returns: a string representing the column type.
value ;
Returns: a QBCondition representing the "greater than" comparison.
query subquery
Returns: a QBCondition representing the "in" comparison with a subquery.
values array of values
Returns: a QBCondition representing the "in" comparison with a list of values.
customQuery custom query
args query arguments
Returns: a QBCondition representing the "in" comparison with a custom query and arguments.
value ;
Returns: a QBCondition representing the "less than or equal to" comparison.
pattern the string value of the pattern
Returns: a QBCondition representing the "like" comparison with a pattern.
pattern the string value of the pattern
escape the escape char
Returns: a QBCondition representing the "like" comparison with a pattern and an escape character.
arg string to locate
Returns: a QBFunction representing the locate function for the specified string.
arg string to locate
start start pos
Returns: a QBFunction representing the locate function starting from the specified position.
value ;
Returns: a QBCondition representing the "less than" comparison.
arg nr to subtract
Returns: a QBFunction representing the subtraction operation.
arg mod arg
Returns: a QBFunction representing the modulo operation.
arg nr to multiply with
Returns: a QBFunction representing the multiplication operation.
arg object to compare
Returns: a QBFunction representing the nullif function.
arg nr to add
Returns: a QBFunction representing the addition operation.
pos ;
Returns: a QBFunction representing the substring function starting from the specified position.
pos ;
len ;
Returns: a QBFunction representing the substring function with the specified position and length.