class JDatabaseQuery


Located at : UKNOWVA_ROOT/libraries/joomla/database/databasequery.php

Query Building Class.

Methods

string
__call(string $method, array $args)

Magic method to provide method alias support for quote() and quoteName().

__construct(JDatabase $db = null)

Class constructor.

string
__toString()

Magic function to convert the query to a string.

mixed
__get(String $name)

Magic function to get protected variable value

string
castAsChar(string $value)

Casts a value to a char.

string
charLength($field)

Gets the number of characters in a string.

void
clear($clause = null)

Clear data from the query or a specific clause of the query.

columns(mixed $columns)

Adds a column, or array of column names that would be used for an INSERT INTO statement.

string
concatenate(array $values, string $separator = null)

Concatenates an array of column names or values.

string
currentTimestamp()

Gets the current date and time.

string
dateFormat()

Returns a PHP date() function compliant date format for the database driver.

delete(string $table = null)

Add a table name to the DELETE clause of the query.

string
escape(string $text, bool $extra = false)

Method to escape a string for usage in an SQL statement.

from(mixed $tables)

Add a table to the FROM clause of the query.

group(mixed $columns)

Add a grouping column to the GROUP clause of the query.

having(mixed $conditions, string $glue = 'AND')

A conditions to the HAVING clause of the query.

innerJoin(string $conditions)

Add an INNER JOIN clause to the query.

insert(mixed $table)

Add a table name to the INSERT clause of the query.

join(string $type, string $conditions)

Add a JOIN clause to the query.

leftJoin(string $conditions)

Add a LEFT JOIN clause to the query.

int
length(string $value)

Get the length of a string in bytes.

string
nullDate(boolean $quoted = true)

Get the null or zero representation of a timestamp for the database driver.

order(mixed $columns)

Add a ordering column to the ORDER clause of the query.

outerJoin(string $conditions)

Add an OUTER JOIN clause to the query.

string
quote(string $text, bool $escape = true)

Method to quote and optionally escape a string to database requirements for insertion into the database.

string
quoteName(string $name)

Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.

rightJoin(string $conditions)

Add a RIGHT JOIN clause to the query.

select(mixed $columns)

Add a single column, or array of columns to the SELECT clause of the query.

set(mixed $conditions, string $glue = ',')

Add a single condition string, or an array of strings to the SET clause of the query.

update(mixed $tables)

Add a table name to the UPDATE clause of the query.

values(string $values)

Adds a tuple, or array of tuples that would be used as values for an INSERT INTO statement.

where(mixed $conditions, string $glue = 'AND')

Add a single condition, or an array of conditions to the WHERE clause of the query.

Details

at line 223
string __call(string $method, array $args)

Magic method to provide method alias support for quote() and quoteName().

Parameters

string $method The called method.
array $args The array of arguments passed to the method.

Return Value

string The aliased method's return value or null.

at line 253
JDatabaseQuery __construct(JDatabase $db = null)

Class constructor.

Parameters

JDatabase $db The database connector resource.

Return Value

JDatabaseQuery

at line 265
string __toString()

Magic function to convert the query to a string.

Return Value

string The completed query.

at line 363
mixed __get(String $name)

Magic function to get protected variable value

Parameters

String $name

Return Value

mixed

at line 379
string castAsChar(string $value)

Casts a value to a char.

Ensure that the value is properly quoted before passing to the method.

Parameters

string $value The value to cast as a char.

Return Value

string Returns the cast value.

at line 395
string charLength($field)

Gets the number of characters in a string.

Note, use 'length' to find the number of bytes in a string.

Parameters

$field

Return Value

string The required char lenght call.

at line 409
void clear($clause = null)

Clear data from the query or a specific clause of the query.

Parameters

$clause

Return Value

void

at line 499
JDatabaseQuerySQLAzure columns(mixed $columns)

Adds a column, or array of column names that would be used for an INSERT INTO statement.

Parameters

mixed $columns A column name, or array of column names.

Return Value

JDatabaseQuerySQLAzure Returns this object to allow chaining.

at line 521
string concatenate(array $values, string $separator = null)

Concatenates an array of column names or values.

Parameters

array $values An array of values to concatenate.
string $separator As separator to place between each value.

Return Value

string The concatenated values.

at line 538
string currentTimestamp()

Gets the current date and time.

Return Value

string

at line 550
string dateFormat()

Returns a PHP date() function compliant date format for the database driver.

Return Value

string The format string.

at line 566
JDatabaseQuery delete(string $table = null)

Add a table name to the DELETE clause of the query.

Note that you must not mix insert, update, delete and select method calls when building a query.

Parameters

string $table The name of the table to delete from.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 589
string escape(string $text, bool $extra = false)

Method to escape a string for usage in an SQL statement.

Parameters

string $text The string to be escaped.
bool $extra Optional parameter to provide extra escaping.

Return Value

string The escaped string.

Exceptions

DatabaseError if the internal db property is not a valid object.

at line 609
JDatabaseQuery from(mixed $tables)

Add a table to the FROM clause of the query.

Note that while an array of tables can be provided, it is recommended you use explicit joins.

Parameters

mixed $tables A string or array of table names.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 630
JDatabaseQuery group(mixed $columns)

Add a grouping column to the GROUP clause of the query.

Parameters

mixed $columns A string or array of ordering columns.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 652
JDatabaseQuery having(mixed $conditions, string $glue = 'AND')

A conditions to the HAVING clause of the query.

Parameters

mixed $conditions A string or array of columns.
string $glue The glue by which to join the conditions. Defaults to AND.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 674
JDatabaseQuery innerJoin(string $conditions)

Add an INNER JOIN clause to the query.

Parameters

string $conditions A string or array of conditions.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 692
JDatabaseQuery insert(mixed $table)

Add a table name to the INSERT clause of the query.

Note that you must not mix insert, update, delete and select method calls when building a query.

Parameters

mixed $table The name of the table to insert data into.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 710
JDatabaseQuery join(string $type, string $conditions)

Add a JOIN clause to the query.

Parameters

string $type The type of join. This string is prepended to the JOIN keyword.
string $conditions A string or array of conditions.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 729
JDatabaseQuery leftJoin(string $conditions)

Add a LEFT JOIN clause to the query.

Parameters

string $conditions A string or array of conditions.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 747
int length(string $value)

Get the length of a string in bytes.

Note, use 'charLength' to find the number of characters in a string.

Parameters

string $value The string to measure.

Return Value

int

at line 761
string nullDate(boolean $quoted = true)

Get the null or zero representation of a timestamp for the database driver.

Parameters

boolean $quoted Optionally wraps the null date in database quotes (true by default).

Return Value

string Null or zero representation of a timestamp.

at line 785
JDatabaseQuery order(mixed $columns)

Add a ordering column to the ORDER clause of the query.

Parameters

mixed $columns A string or array of ordering columns.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 806
JDatabaseQuery outerJoin(string $conditions)

Add an OUTER JOIN clause to the query.

Parameters

string $conditions A string or array of conditions.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 824
string quote(string $text, bool $escape = true)

Method to quote and optionally escape a string to database requirements for insertion into the database.

Parameters

string $text The string to quote.
bool $escape True to escape the string, false to leave it unchanged.

Return Value

string The quoted input string.

Exceptions

DatabaseError if the internal db property is not a valid object.

at line 844
string quoteName(string $name)

Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.

Parameters

string $name The identifier name to wrap in quotes.

Return Value

string The quote wrapped name.

Exceptions

DatabaseError if the internal db property is not a valid object.

at line 862
JDatabaseQuery rightJoin(string $conditions)

Add a RIGHT JOIN clause to the query.

Parameters

string $conditions A string or array of conditions.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 881
JDatabaseQuery select(mixed $columns)

Add a single column, or array of columns to the SELECT clause of the query.

Note that you must not mix insert, update, delete and select method calls when building a query. The select method can, however, be called multiple times in the same query.

Parameters

mixed $columns A string or an array of field names.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 905
JDatabaseQuery set(mixed $conditions, string $glue = ',')

Add a single condition string, or an array of strings to the SET clause of the query.

Parameters

mixed $conditions A string or array of conditions.
string $glue The glue by which to join the condition strings. Defaults to ,.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 929
JDatabaseQuery update(mixed $tables)

Add a table name to the UPDATE clause of the query.

Note that you must not mix insert, update, delete and select method calls when building a query.

Parameters

mixed $tables A string or array of table names.

Return Value

JDatabaseQuery Returns this object to allow chaining.

at line 946
JDatabaseQuerySQLAzure values(string $values)

Adds a tuple, or array of tuples that would be used as values for an INSERT INTO statement.

Parameters

string $values A single tuple, or array of tuples.

Return Value

JDatabaseQuerySQLAzure Returns this object to allow chaining.

at line 968
JDatabaseQuery where(mixed $conditions, string $glue = 'AND')

Add a single condition, or an array of conditions to the WHERE clause of the query.

Parameters

mixed $conditions A string or array of where conditions.
string $glue The glue by which to join the conditions. Defaults to AND.

Return Value

JDatabaseQuery Returns this object to allow chaining.