Документация по Joomla 1.7

Joomla.Platform\JDatabaseQuery
libraries/joomla/database/databasequery.php at line 115

Class JDatabaseQuery

JDatabaseQuery
All Known Subclasses:
JDatabaseQueryMySQL JDatabaseQueryMySQLi JDatabaseQuerySQLAzure JDatabaseQuerySQLSrv

public abstract class JDatabaseQuery

Query Building Class.

Subpackage:
Database
Since:
11.1

Field Summary
protected object The column list for an INSERT statement.

$columns

protected resource The database connection resource.

$db

protected object The delete element.

$delete

protected string The query element for a generic query (type = null).

$element

protected object The from element.

$from

protected object The group by element.

$group

protected object The having element.

$having

protected object The insert element.

$insert

protected object The join element.

$join

protected object The order element.

$order

protected object The select element.

$select

protected object The set element.

$set

protected string The query type.

$type

protected object The update element.

$update

protected object The values list for an INSERT statement.

$values

protected object The where element.

$where

Constructor Summary
JDatabaseQuery

__construct(JDatabase db)

Class constructor.

Method Summary
string

__call(string method, array args)

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

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(string value, mixed field)

Gets the number of characters in a string.

void

clear(string clear, mixed clause)

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

JDatabaseQuerySQLAzure

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)

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.

JDatabaseQuery

delete(string table)

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

string

escape(string text, bool extra)

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

JDatabaseQuery

from(mixed tables)

Add a table to the FROM clause of the query.

JDatabaseQuery

group(mixed columns)

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

JDatabaseQuery

having(mixed conditions, string glue)

A conditions to the HAVING clause of the query.

JDatabaseQuery

innerJoin(string conditions)

Add an INNER JOIN clause to the query.

JDatabaseQuery

insert(mixed table)

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

JDatabaseQuery

join(string type, string conditions)

Add a JOIN clause to the query.

JDatabaseQuery

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)

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

JDatabaseQuery

order(mixed columns)

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

JDatabaseQuery

outerJoin(string conditions)

Add an OUTER JOIN clause to the query.

string

quote(string text, bool escape)

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.

JDatabaseQuery

rightJoin(string conditions)

Add a RIGHT JOIN clause to the query.

JDatabaseQuery

select(mixed columns)

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

JDatabaseQuery

set(mixed conditions, string glue)

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

JDatabaseQuery

update(mixed tables)

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

JDatabaseQuerySQLAzure

values(string values)

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

JDatabaseQuery

where(mixed conditions, string glue)

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

Field Detail

libraries/joomla/database/databasequery.php at line 199

columns

protected object The column list for an INSERT statement. $columns = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 121

db

protected resource The database connection resource. $db = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 145

delete

protected object The delete element. $delete = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 133

element

protected string The query element for a generic query (type = null). $element = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 163

from

protected object The from element. $from = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 187

group

protected object The group by element. $group = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 193

having

protected object The having element. $having = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 157

insert

protected object The insert element. $insert = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 169

join

protected object The join element. $join = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 211

order

protected object The order element. $order = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 139

select

protected object The select element. $select = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 175

set

protected object The set element. $set = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 127

type

protected string The query type. $type = ''

Since:
11.1

libraries/joomla/database/databasequery.php at line 151

update

protected object The update element. $update = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 205

values

protected object The values list for an INSERT statement. $values = null

Since:
11.1

libraries/joomla/database/databasequery.php at line 181

where

protected object The where element. $where = null

Since:
11.1

Constructor Detail

libraries/joomla/database/databasequery.php at line 253

__construct

public JDatabaseQuery __construct(JDatabase db)

Class constructor.

Parameters:
db - The database connector resource.
Since:
11.1

Method Detail

libraries/joomla/database/databasequery.php at line 223

__call

public string __call(string method, array args)

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

Parameters:
method - The called method.
args - The array of arguments passed to the method.
Returns:
The aliased method's return value or null.
Since:
11.1

libraries/joomla/database/databasequery.php at line 265

__toString

public string __toString()

Magic function to convert the query to a string.

Returns:
The completed query.
Since:
11.1

libraries/joomla/database/databasequery.php at line 363

__get

public mixed __get(String name)

Magic function to get protected variable value

Since:
11.1

libraries/joomla/database/databasequery.php at line 379

castAsChar

public string castAsChar(string value)

Casts a value to a char.

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

Parameters:
value - The value to cast as a char.
Returns:
Returns the cast value.
Since:
11.1

libraries/joomla/database/databasequery.php at line 395

charLength

public string charLength(string value, mixed field)

Gets the number of characters in a string.

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

Parameters:
value - A value.
Returns:
The required char lenght call.
Since:
11.1

libraries/joomla/database/databasequery.php at line 409

clear

public void clear(string clear, mixed clause)

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

Parameters:
clear - Optionally, the name of the clause to clear, or nothing to clear the whole query.
Since:
11.1

libraries/joomla/database/databasequery.php at line 499

columns

public JDatabaseQuerySQLAzure columns(mixed columns)

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

Parameters:
columns - A column name, or array of column names.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 521

concatenate

public string concatenate(array values, string separator)

Concatenates an array of column names or values.

Parameters:
values - An array of values to concatenate.
separator - As separator to place between each value.
Returns:
The concatenated values.
Since:
11.1

libraries/joomla/database/databasequery.php at line 538

currentTimestamp

public string currentTimestamp()

Gets the current date and time.

Since:
11.1

libraries/joomla/database/databasequery.php at line 550

dateFormat

public string dateFormat()

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

Returns:
The format string.
Since:
11.1

libraries/joomla/database/databasequery.php at line 566

delete

public JDatabaseQuery delete(string table)

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:
table - The name of the table to delete from.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 589

escape

public string escape(string text, bool extra)

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

Parameters:
text - The string to be escaped.
extra - Optional parameter to provide extra escaping.
Returns:
The escaped string.
Since:
11.1
Throws:
DatabaseError - if the internal db property is not a valid object.

libraries/joomla/database/databasequery.php at line 609

from

public 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:
tables - A string or array of table names.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 630

group

public JDatabaseQuery group(mixed columns)

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

Parameters:
columns - A string or array of ordering columns.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 652

having

public JDatabaseQuery having(mixed conditions, string glue)

A conditions to the HAVING clause of the query.

Parameters:
conditions - A string or array of columns.
glue - The glue by which to join the conditions. Defaults to AND.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 674

innerJoin

public JDatabaseQuery innerJoin(string conditions)

Add an INNER JOIN clause to the query.

Parameters:
conditions - A string or array of conditions.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 692

insert

public 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:
table - The name of the table to insert data into.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 710

join

public JDatabaseQuery join(string type, string conditions)

Add a JOIN clause to the query.

Parameters:
type - The type of join. This string is prepended to the JOIN keyword.
conditions - A string or array of conditions.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 729

leftJoin

public JDatabaseQuery leftJoin(string conditions)

Add a LEFT JOIN clause to the query.

Parameters:
conditions - A string or array of conditions.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 747

length

public 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:
value - The string to measure.
Since:
11.1

libraries/joomla/database/databasequery.php at line 761

nullDate

public string nullDate(boolean quoted)

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

Parameters:
quoted - Optionally wraps the null date in database quotes (true by default).
Returns:
Null or zero representation of a timestamp.
Since:
11.1

libraries/joomla/database/databasequery.php at line 785

order

public JDatabaseQuery order(mixed columns)

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

Parameters:
columns - A string or array of ordering columns.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 806

outerJoin

public JDatabaseQuery outerJoin(string conditions)

Add an OUTER JOIN clause to the query.

Parameters:
conditions - A string or array of conditions.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 824

quote

public string quote(string text, bool escape)

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

Parameters:
text - The string to quote.
escape - True to escape the string, false to leave it unchanged.
Returns:
The quoted input string.
Since:
11.1
Throws:
DatabaseError - if the internal db property is not a valid object.

libraries/joomla/database/databasequery.php at line 844

quoteName

public 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:
name - The identifier name to wrap in quotes.
Returns:
The quote wrapped name.
Since:
11.1
Throws:
DatabaseError - if the internal db property is not a valid object.

libraries/joomla/database/databasequery.php at line 862

rightJoin

public JDatabaseQuery rightJoin(string conditions)

Add a RIGHT JOIN clause to the query.

Parameters:
conditions - A string or array of conditions.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 881

select

public 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:
columns - A string or an array of field names.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 905

set

public JDatabaseQuery set(mixed conditions, string glue)

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

Parameters:
conditions - A string or array of conditions.
glue - The glue by which to join the condition strings. Defaults to ,.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 929

update

public 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:
tables - A string or array of table names.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 946

values

public JDatabaseQuerySQLAzure values(string values)

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

Parameters:
values - A single tuple, or array of tuples.
Returns:
Returns this object to allow chaining.
Since:
11.1

libraries/joomla/database/databasequery.php at line 968

where

public JDatabaseQuery where(mixed conditions, string glue)

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

Parameters:
conditions - A string or array of where conditions.
glue - The glue by which to join the conditions. Defaults to AND.
Returns:
Returns this object to allow chaining.
Since:
11.1

Документация по Joomla 1.7