PostgresqlQueryBuilder
Trait for PostgreSQL Query Building.
| since |
2.0.0 |
|---|---|
| package |
Joomla Framework |
Methods
__toString
Magic function to convert the query to a string, only for PostgreSQL specific queries
__toString() :
| since |
2.0.0 |
|---|
Response
stringThe completed query.
castAs
Casts a value to a char.
castAs( type, value, string length = null) :
Ensure that the value is properly quoted before passing to the method.
Usage: $query->select($query->castAs('CHAR', 'a'));
| since |
1.0 |
|---|
Arguments
- type
stringThe type of string to cast as.- value
stringThe value to cast as a char.- length
string|nullThe value to cast as a char.
Response
stringSQL statement to cast the value as a char type.
clear
Clear data from the query or a specific clause of the query.
clear( clause = null) :
| since |
2.0.0 |
|---|
Arguments
- clause
stringOptionally, the name of the clause to clear, or nothing to clear the whole query.
Response
$this
concatenate
Concatenates an array of column names or values.
concatenate(string||string|int values, string|null separator = null) :
Usage: $query->select($query->concatenate(array('a', 'b')));
| since |
2.0.0 |
|---|
Arguments
- values
array<string|int, string>An array of values to concatenate.- separator
string|nullAs separator to place between each value.
Response
stringThe concatenated values.
currentTimestamp
Gets the current date and time.
currentTimestamp() :
| since |
2.0.0 |
|---|
Response
stringReturn string used in query to obtain
dateAdd
Add to the current date and time.
dateAdd( date, interval, datePart) :
Usage: $query->select($query->dateAdd());
Prefixing the interval with a - (negative sign) will cause subtraction to be used.
| since |
2.0.0 |
|---|---|
| link |
Arguments
- date
stringThe db quoted string representation of the date to add to- interval
stringThe string representation of the appropriate number of units- datePart
stringThe part of the date to perform the addition on
Response
stringThe string with the appropriate sql for addition of dates
day
Used to get a string to extract day from date column.
day( date) :
Usage: $query->select($query->day($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing day to be extracted.
Response
stringReturns string to extract day from a date.
findInSet
Find a value in a varchar used like a set.
findInSet( value, set) :
Ensure that the value is an integer before passing to the method.
Usage: $query->findInSet((int) $parent->id, 'a.assigned_cat_ids')
| since |
2.0.0 |
|---|
Arguments
- value
stringThe value to search for.- set
stringThe set of values.
Response
stringA representation of the MySQL find_in_set() function for the driver.
forUpdate
Sets the FOR UPDATE lock on select's output row
forUpdate( tableName, glue = ',') :
| since |
2.0.0 |
|---|
Arguments
- tableName
stringThe table to lock- glue
stringThe glue by which to join the conditions. Defaults to ',' .
Response
$this
groupConcat
Aggregate function to get input values concatenated into a string, separated by delimiter
groupConcat( expression, separator = ',') :
Usage: $query->groupConcat('id', ',');
| since |
2.0.0 |
|---|
Arguments
- expression
stringThe expression to apply concatenation to, this may be a column name or complex SQL statement.- separator
stringThe delimiter of each concatenated value
Response
stringInput values concatenated into a string, separated by delimiter
hour
Used to get a string to extract hour from date column.
hour( date) :
Usage: $query->select($query->hour($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing hour to be extracted.
Response
stringReturns string to extract hour from a date.
limit
Set the LIMIT clause to the query
limit( limit) :
| since |
2.0.0 |
|---|
Arguments
- limit
intNumber of rows to return
Response
$this
minute
Used to get a string to extract minute from date column.
minute( date) :
Usage: $query->select($query->minute($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing minute to be extracted.
Response
stringReturns string to extract minute from a date.
month
Used to get a string to extract month from date column.
month( date) :
Usage: $query->select($query->month($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing month to be extracted.
Response
stringReturns string to extract month from a date.
noWait
Sets the NOWAIT lock on select's output row
noWait() :
| since |
2.0.0 |
|---|
Response
$this
offset
Set the OFFSET clause to the query
offset( offset) :
| since |
2.0.0 |
|---|
Arguments
- offset
intAn integer for skipping rows
Response
$this
processLimit
Method to modify a query already in string format with the needed additions to make the query limited to a particular number of results, or start at a particular offset.
processLimit( query, limit, offset) :
| since |
2.0.0 |
|---|
Arguments
- query
stringThe query in string format- limit
intThe limit for the result set- offset
intThe offset for the result set
Response
string
rand
Get the function to return a random floating-point value
rand() :
Usage: $query->rand();
| since |
2.0.0 |
|---|
Response
string
regexp
Get the regular expression operator
regexp( value) :
Usage: $query->where('field ' . $query->regexp($search));
| since |
2.0.0 |
|---|
Arguments
- value
stringThe regex pattern.
Response
string
returning
Add the RETURNING element to INSERT INTO statement.
returning( pkCol) :
| since |
2.0.0 |
|---|
Arguments
- pkCol
mixedThe name of the primary key column.
Response
$this
second
Used to get a string to extract seconds from date column.
second( date) :
Usage: $query->select($query->second($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing second to be extracted.
Response
stringReturns string to extract second from a date.
year
Used to get a string to extract year from date column.
year( date) :
Usage: $query->select($query->year($query->quoteName('dateColumn')));
| since |
2.0.0 |
|---|
Arguments
- date
stringDate column containing year to be extracted.
Response
stringReturns string to extract year from a date.
Properties
noWait
The NOWAIT element used in "FOR SHARE" and "FOR UPDATE" lock