QBFunctions
Overview
The QBFunctions
class provides a comprehensive set of SQL functions designed to enhance query building in QBSelect
. It enables the creation of mathematical, string, and date-based expressions, along with conditional and custom logic.
This class allows users to perform operations like calculating absolute values, rounding, and extracting substrings. It also includes advanced capabilities such as casting data types, concatenating strings, trimming whitespace, and formatting dates. With access to aggregation methods and support for custom function definitions, the class is versatile in handling diverse SQL requirements.
For additional guidance on query construction and execution, refer to the QBSelect section of the documentation.
Properties Summarized
Get query builder parent table clause, this may be a query or a join clause.
Get query builder parent.
Methods Summarized
Create abs(column) expression
Create bit_length(column) expression
Cast using type name.
Create ceil(column) expression
Create concat(args, arg2) expression
Create day(date) expression
Create divide(args, arg2) expression
Create floor(column) expression
Create hour(date) expression
Create length(column) expression
Create locate(str1, str2) expression
Create locate(str1, str2, start) expression
Create lower(column) expression
Create minus(args, arg2) expression
Create minute(date) expression
Create mod(dividend, divisor) expression
Create month(date) expression
Create multiply(args, arg2) expression
Create nullif(arg1, arg2) expression
Create plus(args, arg2) expression
Create round(column) expression
Create round(column) expression
Create second(date) expression
Create sqrt(column) expression
Create substring(column, pos) expression
Create substring(column, pos, len) expression
Create trim(column) expression
Create trim([leading | trailing | both] [characters] from column)
Create upper(column) expression
Create year(date) expression
Properties Detailed
parent
Get query builder parent table clause, this may be a query or a join clause.
Type QBSelect
Sample
root
Get query builder parent.
Type QBSelect
Sample
Methods Detailed
abs(value)
Create abs(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
bit_length(value)
Create bit_length(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
cast(value, type)
Cast using type name.
Parameters
Returns: QBColumn
Sample
ceil(arg)
Create ceil(column) expression
Parameters
Object arg number object
Returns: QBColumn
Sample
coalesce(args)
Parameters
Array args arguments to coalesce
Returns: QBColumn
Sample
concat(arg1, arg2)
Create concat(args, arg2) expression
Parameters
Returns: QBColumn
Sample
custom(name, args)
Parameters
Returns: QBColumn
Sample
day(arg)
Create day(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
divide(arg1, arg2)
Create divide(args, arg2) expression
Parameters
Returns: QBColumn
Sample
floor(arg)
Create floor(column) expression
Parameters
Object arg number object
Returns: QBColumn
Sample
hour(arg)
Create hour(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
len(value)
Create length(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
locate(string1, string2)
Create locate(str1, str2) expression
Parameters
Returns: QBColumn
Sample
locate(string1, string2, start)
Create locate(str1, str2, start) expression
Parameters
Returns: QBColumn
Sample
lower(value)
Create lower(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
minus(arg1, arg2)
Create minus(args, arg2) expression
Parameters
Returns: QBColumn
Sample
minute(arg)
Create minute(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
mod(dividend, divisor)
Create mod(dividend, divisor) expression
Parameters
Returns: QBColumn
Sample
month(arg)
Create month(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
multiply(arg1, arg2)
Create multiply(args, arg2) expression
Parameters
Returns: QBColumn
Sample
nullif(arg1)
Create nullif(arg1, arg2) expression
Parameters
Object arg1 ;
Returns: QBColumn
Sample
plus(arg1, arg2)
Create plus(args, arg2) expression
Parameters
Returns: QBColumn
Sample
round(arg)
Create round(column) expression
Parameters
Object arg number object
Returns: QBColumn
Sample
round(arg, decimals)
Create round(column) expression
Parameters
Returns: QBColumn
Sample
second(arg)
Create second(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
sqrt(value)
Create sqrt(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
substring(arg, pos)
Create substring(column, pos) expression
Parameters
Returns: QBColumn
Sample
substring(arg, pos, len)
Create substring(column, pos, len) expression
Parameters
Returns: QBColumn
Sample
trim(value)
Create trim(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
trim(leading_trailing_both, characters, fromKeyword, value)
Create trim([leading | trailing | both] [characters] from column)
Parameters
String leading_trailing_both 'leading', 'trailing' or 'both'
String characters characters to remove
String fromKeyword 'from'
Object value value to trim
Returns: QBColumn
Sample
upper(value)
Create upper(column) expression
Parameters
Object value ;
Returns: QBColumn
Sample
year(arg)
Create year(date) expression
Parameters
Object arg date object
Returns: QBColumn
Sample
Last updated