Joomla Platform
13.1
Documentation des API du framework Joomla Platform
|
Fonctions membres publiques | |
__call ($method, $args) | |
__construct (JDatabaseDriver $db=null) | |
__toString () | |
__get ($name) | |
call ($columns) | |
castAsChar ($value) | |
charLength ($field, $operator=null, $condition=null) | |
clear ($clause=null) | |
columns ($columns) | |
concatenate ($values, $separator=null) | |
currentTimestamp () | |
dateFormat () | |
dump () | |
delete ($table=null) | |
escape ($text, $extra=false) | |
exec ($columns) | |
from ($tables, $subQueryAlias=null) | |
year ($date) | |
month ($date) | |
day ($date) | |
hour ($date) | |
minute ($date) | |
second ($date) | |
group ($columns) | |
having ($conditions, $glue= 'AND') | |
innerJoin ($condition) | |
insert ($table, $incrementField=false) | |
join ($type, $conditions) | |
leftJoin ($condition) | |
length ($value) | |
nullDate ($quoted=true) | |
order ($columns) | |
outerJoin ($condition) | |
quote ($text, $escape=true) | |
quoteName ($name, $as=null) | |
rightJoin ($condition) | |
select ($columns) | |
set ($conditions, $glue= ',') | |
setQuery ($sql) | |
update ($table) | |
values ($values) | |
where ($conditions, $glue= 'AND') | |
__clone () | |
union ($query, $distinct=false, $glue= '') | |
unionDistinct ($query, $glue= '') | |
format ($format) | |
dateAdd ($date, $interval, $datePart) | |
unionAll ($query, $distinct=false, $glue= '') |
Attributs protégés | |
$db = null | |
$sql = null | |
$type = '' | |
$element = null | |
$select = null | |
$delete = null | |
$update = null | |
$insert = null | |
$from = null | |
$join = null | |
$set = null | |
$where = null | |
$group = null | |
$having = null | |
$columns = null | |
$values = null | |
$order = null | |
$autoIncrementField = null | |
$call = null | |
$exec = null | |
$union = null | |
$unionAll = null |
JDatabaseQuery::__construct | ( | JDatabaseDriver | $db = null | ) |
Class constructor.
JDatabaseDriver | $db | The database driver. |
Définition à la ligne 322 du fichier query.php.
Références $db.
JDatabaseQuery::__call | ( | $method, | |
$args | |||
) |
Magic method to provide method alias support for quote() and quoteName().
string | $method | The called method. |
array | $args | The array of arguments passed to the method. |
Définition à la ligne 292 du fichier query.php.
Références escape(), quote(), et quoteName().
JDatabaseQuery::__clone | ( | ) |
Method to provide deep copy support to nested objects and arrays when cloning.
Définition à la ligne 1507 du fichier query.php.
JDatabaseQuery::__get | ( | $name | ) |
JDatabaseQuery::__toString | ( | ) |
Magic function to convert the query to a string.
Réimplémentée dans JDatabaseQueryPostgresql, et JDatabaseQuerySqlsrv.
Définition à la ligne 334 du fichier query.php.
Références $join, $sql, call(), columns(), exec(), from(), group(), having(), insert(), join(), order(), select(), unionAll(), update(), values(), et where().
JDatabaseQuery::call | ( | $columns | ) |
Add a single column, or array of columns to the CALL clause of the query.
Note that you must not mix insert, update, delete and select method calls when building a query. The call method can, however, be called multiple times in the same query.
Usage: $query->call('a.*')->call('b.id'); $query->call(array('a.*', 'b.id'));
mixed | $columns | A string or an array of field names. |
Définition à la ligne 508 du fichier query.php.
Références $columns.
Référencé par __toString(), et clear().
JDatabaseQuery::castAsChar | ( | $value | ) |
Casts a value to a char.
Ensure that the value is properly quoted before passing to the method.
Usage: $query->select($query->castAsChar('a'));
string | $value | The value to cast as a char. |
Réimplémentée dans JDatabaseQueryPostgresql, et JDatabaseQuerySqlsrv.
Définition à la ligne 538 du fichier query.php.
JDatabaseQuery::charLength | ( | $field, | |
$operator = null , |
|||
$condition = null |
|||
) |
Gets the number of characters in a string.
Note, use 'length' to find the number of bytes in a string.
Usage: $query->select($query->charLength('a'));
string | $field | A value. |
string | $operator | Comparison operator between charLength integer value and $condition |
string | $condition | Integer value to compare charLength with. |
Réimplémentée dans JDatabaseQuerySqlsrv.
Définition à la ligne 559 du fichier query.php.
JDatabaseQuery::clear | ( | $clause = null | ) |
Clear data from the query or a specific clause of the query.
string | $clause | Optionally, the name of the clause to clear, or nothing to clear the whole query. |
Réimplémentée dans JDatabaseQueryPostgresql, JDatabaseQueryOracle, et JDatabaseQuerySqlite.
Définition à la ligne 573 du fichier query.php.
Références call(), columns(), exec(), from(), group(), having(), insert(), join(), order(), select(), unionAll(), update(), values(), et where().
Référencé par union().
JDatabaseQuery::columns | ( | $columns | ) |
Adds a column, or array of column names that would be used for an INSERT INTO statement.
mixed | $columns | A column name, or array of column names. |
Définition à la ligne 696 du fichier query.php.
Références $columns.
Référencé par __toString(), et clear().
JDatabaseQuery::concatenate | ( | $values, | |
$separator = null |
|||
) |
Concatenates an array of column names or values.
Usage: $query->select($query->concatenate(array('a', 'b')));
array | $values | An array of values to concatenate. |
string | $separator | As separator to place between each value. |
Réimplémentée dans JDatabaseQueryPostgresql, JDatabaseQuerySqlsrv, et JDatabaseQueryMysqli.
Définition à la ligne 723 du fichier query.php.
Références $values, et quote().
JDatabaseQuery::currentTimestamp | ( | ) |
Gets the current date and time.
Usage: $query->where('published_up < '.$query->currentTimestamp());
Réimplémentée dans JDatabaseQueryPostgresql, et JDatabaseQuerySqlsrv.
Définition à la ligne 745 du fichier query.php.
JDatabaseQuery::dateAdd | ( | $date, | |
$interval, | |||
$datePart | |||
) |
Add to the current date and time. Usage: $query->select($query->dateAdd()); Prefixing the interval with a - (negative sign) will cause subtraction to be used. Note: Not all drivers support all units.
datetime | $date | The date to add to. May be date or datetime |
string | $interval | The string representation of the appropriate number of units |
string | $datePart | The part of the date to perform the addition on |
Réimplémentée dans JDatabaseQueryPostgresql, JDatabaseQuerySqlsrv, et JDatabaseQuerySqlite.
Définition à la ligne 1800 du fichier query.php.
JDatabaseQuery::dateFormat | ( | ) |
Returns a PHP date() function compliant date format for the database driver.
This method is provided for use where the query object is passed to a function for modification. If you have direct access to the database object, it is recommended you use the getDateFormat method directly.
Définition à la ligne 760 du fichier query.php.
JDatabaseQuery::day | ( | $date | ) |
Used to get a string to extract day from date column.
Usage: $query->select($query->day($query->quoteName('dateColumn')));
string | $date | Date column containing day to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 959 du fichier query.php.
JDatabaseQuery::delete | ( | $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.
Usage: $query->delete('#__a')->where('id = 1');
string | $table | The name of the table to delete from. |
Définition à la ligne 799 du fichier query.php.
Références from().
JDatabaseQuery::dump | ( | ) |
JDatabaseQuery::escape | ( | $text, | |
$extra = false |
|||
) |
Method to escape a string for usage in an SQL statement.
This method is provided for use where the query object is passed to a function for modification. If you have direct access to the database object, it is recommended you use the escape method directly.
Note that 'e' is an alias for this method as it is in JDatabaseDriver.
string | $text | The string to be escaped. |
boolean | $extra | Optional parameter to provide extra escaping. |
RuntimeException | if the internal db property is not a valid object. |
Définition à la ligne 828 du fichier query.php.
Référencé par __call().
JDatabaseQuery::exec | ( | $columns | ) |
Add a single column, or array of columns to the EXEC clause of the query.
Note that you must not mix insert, update, delete and select method calls when building a query. The exec method can, however, be called multiple times in the same query.
Usage: $query->exec('a.*')->exec('b.id'); $query->exec(array('a.*', 'b.id'));
mixed | $columns | A string or an array of field names. |
Définition à la ligne 854 du fichier query.php.
Références $columns.
Référencé par __toString(), et clear().
JDatabaseQuery::format | ( | $format | ) |
Find and replace sprintf-like tokens in a format string. Each token takes one of the following forms: %% - A literal percent character. %[t] - Where [t] is a type specifier. %[n]$[x] - Where [n] is an argument specifier and [t] is a type specifier.
Types: a - Numeric: Replacement text is coerced to a numeric type but not quoted or escaped. e - Escape: Replacement text is passed to $this->escape(). E - Escape (extra): Replacement text is passed to $this->escape() with true as the second argument. n - Name Quote: Replacement text is passed to $this->quoteName(). q - Quote: Replacement text is passed to $this->quote(). Q - Quote (no escape): Replacement text is passed to $this->quote() with false as the second argument. r - Raw: Replacement text is used as-is. (Be careful)
Date Types:
Invariable Types:
Usage: $query->format('SELECT %1$n FROM %2$n WHERE %3$n = %4$a', 'foo', '#__foo', 'bar', 1); Returns: SELECT foo
FROM #__foo
WHERE bar
= 1
Notes: The argument specifier is optional but recommended for clarity. The argument index used for unspecified tokens is incremented only when used.
string | $format | The formatting string. |
Regexp to find an replace all tokens. Matched fields: 0: Full token 1: Everything following '' 2: Everything following '' unless '' 3: Argument specifier and '$' 4: Argument specifier 5: Type specifier 6: '' if full token is '%'
Définition à la ligne 1644 du fichier query.php.
JDatabaseQuery::from | ( | $tables, | |
$subQueryAlias = null |
|||
) |
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.
Usage: $query->select('*')->from('#__a');
mixed | $tables | A string or array of table names. This can be a JDatabaseQuery object (or a child of it) when used as a subquery in FROM clause along with a value for $subQueryAlias. |
string | $subQueryAlias | Alias used when $tables is a JDatabaseQuery. |
RuntimeException |
Définition à la ligne 889 du fichier query.php.
Références quoteName().
Référencé par __toString(), clear(), et delete().
JDatabaseQuery::group | ( | $columns | ) |
Add a grouping column to the GROUP clause of the query.
Usage: $query->group('id');
mixed | $columns | A string or array of ordering columns. |
Définition à la ligne 1027 du fichier query.php.
Références $columns.
Référencé par __toString(), JModelLegacy\_getListCount(), et clear().
JDatabaseQuery::having | ( | $conditions, | |
$glue = 'AND' |
|||
) |
A conditions to the HAVING clause of the query.
Usage: $query->group('id')->having('COUNT(id) > 5');
mixed | $conditions | A string or array of columns. |
string | $glue | The glue by which to join the conditions. Defaults to AND. |
Définition à la ligne 1054 du fichier query.php.
Référencé par __toString(), et clear().
JDatabaseQuery::hour | ( | $date | ) |
Used to get a string to extract hour from date column.
Usage: $query->select($query->hour($query->quoteName('dateColumn')));
string | $date | Date column containing hour to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 976 du fichier query.php.
JDatabaseQuery::innerJoin | ( | $condition | ) |
Add an INNER JOIN clause to the query.
Usage: $query->innerJoin('b ON b.id = a.id')->innerJoin('c ON c.id = b.id');
string | $condition | The join condition. |
Définition à la ligne 1081 du fichier query.php.
Références join().
JDatabaseQuery::insert | ( | $table, | |
$incrementField = false |
|||
) |
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.
Usage: $query->insert('#__a')->set('id = 1'); $query->insert('#__a')->columns('id, title')->values('1,2')->values('3,4'); $query->insert('#__a')->columns('id, title')->values(array('1,2', '3,4'));
mixed | $table | The name of the table to insert data into. |
boolean | $incrementField | The name of the field to auto increment. |
Définition à la ligne 1105 du fichier query.php.
Référencé par __toString(), et clear().
JDatabaseQuery::join | ( | $type, | |
$conditions | |||
) |
Add a JOIN clause to the query.
Usage: $query->join('INNER', 'b ON b.id = a.id);
string | $type | The type of join. This string is prepended to the JOIN keyword. |
string | $conditions | A string or array of conditions. |
Définition à la ligne 1127 du fichier query.php.
Références $type.
Référencé par __toString(), clear(), innerJoin(), leftJoin(), outerJoin(), et rightJoin().
JDatabaseQuery::leftJoin | ( | $condition | ) |
Add a LEFT JOIN clause to the query.
Usage: $query->leftJoin('b ON b.id = a.id')->leftJoin('c ON c.id = b.id');
string | $condition | The join condition. |
Définition à la ligne 1150 du fichier query.php.
Références join().
JDatabaseQuery::length | ( | $value | ) |
Get the length of a string in bytes.
Note, use 'charLength' to find the number of characters in a string.
Usage: query->where($query->length('a').' > 3');
string | $value | The string to measure. |
Réimplémentée dans JDatabaseQuerySqlsrv.
Définition à la ligne 1171 du fichier query.php.
JDatabaseQuery::minute | ( | $date | ) |
Used to get a string to extract minute from date column.
Usage: $query->select($query->minute($query->quoteName('dateColumn')));
string | $date | Date column containing minute to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 993 du fichier query.php.
JDatabaseQuery::month | ( | $date | ) |
Used to get a string to extract month from date column.
Usage: $query->select($query->month($query->quoteName('dateColumn')));
string | $date | Date column containing month to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 942 du fichier query.php.
JDatabaseQuery::nullDate | ( | $quoted = true | ) |
Get the null or zero representation of a timestamp for the database driver.
This method is provided for use where the query object is passed to a function for modification. If you have direct access to the database object, it is recommended you use the nullDate method directly.
Usage: $query->where('modified_date <> '.$query->nullDate());
boolean | $quoted | Optionally wraps the null date in database quotes (true by default). |
Définition à la ligne 1191 du fichier query.php.
JDatabaseQuery::order | ( | $columns | ) |
Add a ordering column to the ORDER clause of the query.
Usage: $query->order('foo')->order('bar'); $query->order(array('foo','bar'));
mixed | $columns | A string or array of ordering columns. |
Définition à la ligne 1221 du fichier query.php.
Références $columns.
Référencé par __toString(), clear(), et union().
JDatabaseQuery::outerJoin | ( | $condition | ) |
Add an OUTER JOIN clause to the query.
Usage: $query->outerJoin('b ON b.id = a.id')->outerJoin('c ON c.id = b.id');
string | $condition | The join condition. |
Définition à la ligne 1247 du fichier query.php.
Références join().
JDatabaseQuery::quote | ( | $text, | |
$escape = true |
|||
) |
Method to quote and optionally escape a string to database requirements for insertion into the database.
This method is provided for use where the query object is passed to a function for modification. If you have direct access to the database object, it is recommended you use the quote method directly.
Note that 'q' is an alias for this method as it is in JDatabaseDriver.
Usage: $query->quote('fulltext'); $query->q('fulltext'); $query->q(array('option', 'fulltext'));
mixed | $text | A string or an array of strings to quote. |
boolean | $escape | True to escape the string, false to leave it unchanged. |
RuntimeException | if the internal db property is not a valid object. |
Définition à la ligne 1275 du fichier query.php.
Référencé par __call(), et concatenate().
JDatabaseQuery::quoteName | ( | $name, | |
$as = null |
|||
) |
Wrap an SQL statement identifier name such as column, table or database names in quotes to prevent injection risks and reserved word conflicts.
This method is provided for use where the query object is passed to a function for modification. If you have direct access to the database object, it is recommended you use the quoteName method directly.
Note that 'qn' is an alias for this method as it is in JDatabaseDriver.
Usage: $query->quoteName('#__a'); $query->qn('#__a');
mixed | $name | The identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name. |
mixed | $as | The AS query part associated to $name. It can be string or array, in latter case it has to be same length of $name; if is null there will not be any AS part for string or array element. |
RuntimeException | if the internal db property is not a valid object. |
Définition à la ligne 1308 du fichier query.php.
Référencé par __call(), et from().
JDatabaseQuery::rightJoin | ( | $condition | ) |
Add a RIGHT JOIN clause to the query.
Usage: $query->rightJoin('b ON b.id = a.id')->rightJoin('c ON c.id = b.id');
string | $condition | The join condition. |
Définition à la ligne 1330 du fichier query.php.
Références join().
JDatabaseQuery::second | ( | $date | ) |
Used to get a string to extract seconds from date column.
Usage: $query->select($query->second($query->quoteName('dateColumn')));
string | $date | Date column containing second to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 1010 du fichier query.php.
JDatabaseQuery::select | ( | $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.
Usage: $query->select('a.*')->select('b.id'); $query->select(array('a.*', 'b.id'));
mixed | $columns | A string or an array of field names. |
Définition à la ligne 1353 du fichier query.php.
Références $columns.
Référencé par __toString(), et clear().
JDatabaseQuery::set | ( | $conditions, | |
$glue = ',' |
|||
) |
Add a single condition string, or an array of strings to the SET clause of the query.
Usage: $query->set('a = 1')->set('b = 2'); $query->set(array('a = 1', 'b = 2');
mixed | $conditions | A string or array of string conditions. |
string | $glue | The glue by which to join the condition strings. Defaults to ,. Note that the glue is set on first use and cannot be changed. |
Définition à la ligne 1384 du fichier query.php.
JDatabaseQuery::setQuery | ( | $sql | ) |
Allows a direct query to be provided to the database driver's setQuery() method, but still allow queries to have bounded variables.
Usage: $query->setQuery('select * from #__users');
mixed | $sql | An SQL Query |
Définition à la ligne 1413 du fichier query.php.
Références $sql.
JDatabaseQuery::union | ( | $query, | |
$distinct = false , |
|||
$glue = '' |
|||
) |
Add a query to UNION with the current query. Multiple unions each require separate statements and create an array of unions.
Usage: $query->union('SELECT name FROM #__foo') $query->union('SELECT name FROM #__foo','distinct') $query->union(array('SELECT name FROM #__foo','SELECT name FROM #__bar'))
mixed | $query | The JDatabaseQuery object or string to union. |
boolean | $distinct | True to only return distinct rows from the union. |
string | $glue | The glue by which to join the conditions. |
Définition à la ligne 1540 du fichier query.php.
Références clear(), et order().
JDatabaseQuery::unionAll | ( | $query, | |
$distinct = false , |
|||
$glue = '' |
|||
) |
Add a query to UNION ALL with the current query. Multiple unions each require separate statements and create an array of unions.
Usage: $query->union('SELECT name FROM #__foo') $query->union('SELECT name FROM #__foo','distinct') $query->union(array('SELECT name FROM #__foo','SELECT name FROM #__bar'))
mixed | $query | The JDatabaseQuery object or string to union. |
boolean | $distinct | True to only return distinct rows from the union. |
string | $glue | The glue by which to join the conditions. |
Définition à la ligne 1822 du fichier query.php.
Référencé par __toString(), et clear().
JDatabaseQuery::unionDistinct | ( | $query, | |
$glue = '' |
|||
) |
Add a query to UNION DISTINCT with the current query. Simply a proxy to Union with the Distinct clause.
Usage: $query->unionDistinct('SELECT name FROM #__foo')
mixed | $query | The JDatabaseQuery object or string to union. |
string | $glue | The glue by which to join the conditions. |
Définition à la ligne 1589 du fichier query.php.
JDatabaseQuery::update | ( | $table | ) |
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.
Usage: $query->update('#__foo')->set(...);
string | $table | A table to update. |
Définition à la ligne 1434 du fichier query.php.
Référencé par __toString(), et clear().
JDatabaseQuery::values | ( | $values | ) |
Adds a tuple, or array of tuples that would be used as values for an INSERT INTO statement.
Usage: $query->values('1,2,3')->values('4,5,6'); $query->values(array('1,2,3', '4,5,6'));
string | $values | A single tuple, or array of tuples. |
Définition à la ligne 1455 du fichier query.php.
Références $values.
Référencé par __toString(), et clear().
JDatabaseQuery::where | ( | $conditions, | |
$glue = 'AND' |
|||
) |
Add a single condition, or an array of conditions to the WHERE clause of the query.
Usage: $query->where('a = 1')->where('b = 2'); $query->where(array('a = 1', 'b = 2'));
mixed | $conditions | A string or array of where conditions. |
string | $glue | The glue by which to join the conditions. Defaults to AND. Note that the glue is set on first use and cannot be changed. |
Définition à la ligne 1484 du fichier query.php.
Référencé par __toString(), et clear().
JDatabaseQuery::year | ( | $date | ) |
Used to get a string to extract year from date column.
Usage: $query->select($query->year($query->quoteName('dateColumn')));
string | $date | Date column containing year to be extracted. |
Réimplémentée dans JDatabaseQueryPostgresql.
Définition à la ligne 925 du fichier query.php.
|
protected |
|
protected |
|
protected |
Définition à la ligne 154 du fichier query.php.
Référencé par __construct().
|
protected |
Définition à la ligne 208 du fichier query.php.
Référencé par __toString().
|
protected |
Définition à la ligne 160 du fichier query.php.
Référencé par __toString(), et setQuery().
|
protected |
|
protected |
Définition à la ligne 244 du fichier query.php.
Référencé par concatenate(), et values().