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() : string
since |
2.0.0 |
---|
Response
string
The completed query.
castAs
Casts a value to a char.
castAs(string type, string value, string length = null) : string
Ensure that the value is properly quoted before passing to the method.
Usage: $query->select($query->castAs('CHAR', 'a'));
since |
1.0 |
---|
Arguments
- type
string
The type of string to cast as.- value
string
The value to cast as a char.- length
string
The value to cast as a char.
Response
string
SQL statement to cast the value as a char type.
clear
Clear data from the query or a specific clause of the query.
clear(string clause = null) : $this
since |
2.0.0 |
---|
Arguments
- clause
string
Optionally, 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[] values, string|null separator = null) : string
Usage: $query->select($query->concatenate(array('a', 'b')));
since |
2.0.0 |
---|
Arguments
- values
string[]
An array of values to concatenate.- separator
string|null
As separator to place between each value.
Response
string
The concatenated values.
currentTimestamp
Gets the current date and time.
currentTimestamp() : string
since |
2.0.0 |
---|
Response
string
Return string used in query to obtain
dateAdd
Add to the current date and time.
dateAdd(string date, string interval, string datePart) : string
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
string
The db quoted string representation of the date to add to- interval
string
The string representation of the appropriate number of units- datePart
string
The part of the date to perform the addition on
Response
string
The string with the appropriate sql for addition of dates
day
Used to get a string to extract day from date column.
day(string date) : string
Usage: $query->select($query->day($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing day to be extracted.
Response
string
Returns string to extract day from a date.
findInSet
Find a value in a varchar used like a set.
findInSet(string value, string set) : string
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
string
The value to search for.- set
string
The set of values.
Response
string
A representation of the MySQL find_in_set() function for the driver.
forUpdate
Sets the FOR UPDATE lock on select's output row
forUpdate(string tableName, string glue = ',') : $this
since |
2.0.0 |
---|
Arguments
- tableName
string
The table to lock- glue
string
The 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(string expression, string separator = ',') : string
Usage: $query->groupConcat('id', ',');
since |
2.0.0 |
---|
Arguments
- expression
string
The expression to apply concatenation to, this may be a column name or complex SQL statement.- separator
string
The delimiter of each concatenated value
Response
string
Input values concatenated into a string, separated by delimiter
hour
Used to get a string to extract hour from date column.
hour(string date) : string
Usage: $query->select($query->hour($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing hour to be extracted.
Response
string
Returns string to extract hour from a date.
limit
Set the LIMIT clause to the query
limit(int limit) : $this
since |
2.0.0 |
---|
Arguments
- limit
int
Number of rows to return
Response
$this
minute
Used to get a string to extract minute from date column.
minute(string date) : string
Usage: $query->select($query->minute($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing minute to be extracted.
Response
string
Returns string to extract minute from a date.
month
Used to get a string to extract month from date column.
month(string date) : string
Usage: $query->select($query->month($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing month to be extracted.
Response
string
Returns string to extract month from a date.
noWait
Sets the NOWAIT lock on select's output row
noWait() : $this
since |
2.0.0 |
---|
Response
$this
offset
Set the OFFSET clause to the query
offset(int offset) : $this
since |
2.0.0 |
---|
Arguments
- offset
int
An 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(string query, int limit, int offset) : string
since |
2.0.0 |
---|
Arguments
- query
string
The query in string format- limit
int
The limit for the result set- offset
int
The offset for the result set
Response
string
rand
Get the function to return a random floating-point value
rand() : string
Usage: $query->rand();
since |
2.0.0 |
---|
Response
string
regexp
Get the regular expression operator
regexp(string value) : string
Usage: $query->where('field ' . $query->regexp($search));
since |
2.0.0 |
---|
Arguments
- value
string
The regex pattern.
Response
string
returning
Add the RETURNING element to INSERT INTO statement.
returning(mixed pkCol) : $this
since |
2.0.0 |
---|
Arguments
- pkCol
mixed
The name of the primary key column.
Response
$this
second
Used to get a string to extract seconds from date column.
second(string date) : string
Usage: $query->select($query->second($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing second to be extracted.
Response
string
Returns string to extract second from a date.
year
Used to get a string to extract year from date column.
year(string date) : string
Usage: $query->select($query->year($query->quoteName('dateColumn')));
since |
2.0.0 |
---|
Arguments
- date
string
Date column containing year to be extracted.
Response
string
Returns string to extract year from a date.
Properties
forUpdate
The FOR UPDATE element used in "FOR UPDATE" lock
since |
2.0.0 |
---|
Type(s)
\Joomla\Database\Query\QueryElement
noWait
The NOWAIT element used in "FOR SHARE" and "FOR UPDATE" lock
since |
2.0.0 |
---|
Type(s)
\Joomla\Database\Query\QueryElement
limit
The LIMIT element
since |
2.0.0 |
---|
Type(s)
\Joomla\Database\Query\QueryElement
offset
The OFFSET element
since |
2.0.0 |
---|
Type(s)
\Joomla\Database\Query\QueryElement
returning
The RETURNING element of INSERT INTO
since |
2.0.0 |
---|
Type(s)
\Joomla\Database\Query\QueryElement