Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe FOFDatabaseQuery
+ Graphe d'héritage de FOFDatabaseQuery:

Fonctions membres publiques

 __call ($method, $args)
 
 __construct (FOFDatabaseDriver $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
 

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( FOFDatabaseDriver  $db = null)

Class constructor.

Paramètres
FOFDatabaseDriver$dbThe database driver.
Depuis
11.1

Références $db.

Documentation des fonctions membres

◆ __call()

__call (   $method,
  $args 
)

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

Paramètres
string$methodThe called method.
array$argsThe array of arguments passed to the method.
Renvoie
string The aliased method's return value or null.
Depuis
11.1

Références null.

◆ __clone()

__clone ( )

Method to provide deep copy support to nested objects and arrays when cloning.

Renvoie
void
Depuis
11.3

◆ __get()

__get (   $name)

Magic function to get protected variable value

Paramètres
string$nameThe name of the variable.
Renvoie
mixed
Depuis
11.1

Références $name, et null.

◆ __toString()

__toString ( )

Magic function to convert the query to a string.

Renvoie
string The completed query.
Depuis
11.1

Références $query, et elseif.

◆ call()

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'));

Paramètres
mixed$columnsA string or an array of field names.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
12.1

Références $columns.

◆ castAsChar()

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'));

Paramètres
string$valueThe value to cast as a char.
Renvoie
string Returns the cast value.
Depuis
11.1

Références $value.

◆ charLength()

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'));

Paramètres
string$fieldA value.
string$operatorComparison operator between charLength integer value and $condition
string$conditionInteger value to compare charLength with.
Renvoie
string The required char length call.
Depuis
11.1

Références $condition, et $field.

◆ clear()

clear (   $clause = null)

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

Paramètres
string$clauseOptionally, the name of the clause to clear, or nothing to clear the whole query.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références null.

◆ columns()

columns (   $columns)

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

Paramètres
mixed$columnsA column name, or array of column names.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $columns.

◆ concatenate()

concatenate (   $values,
  $separator = null 
)

Concatenates an array of column names or values.

Usage: $query->select($query->concatenate(array('a', 'b')));

Paramètres
array$valuesAn array of values to concatenate.
string$separatorAs separator to place between each value.
Renvoie
string The concatenated values.
Depuis
11.1

Références $separator.

◆ currentTimestamp()

currentTimestamp ( )

Gets the current date and time.

Usage: $query->where('published_up < '.$query->currentTimestamp());

Renvoie
string
Depuis
11.1

◆ dateAdd()

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.

Paramètres
datetime$dateThe date to add to. May be date or datetime
string$intervalThe string representation of the appropriate number of units
string$datePartThe part of the date to perform the addition on
Renvoie
string The string with the appropriate sql for addition of dates

13.1

Références $date.

◆ dateFormat()

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.

Renvoie
string The format string.
Depuis
11.1

◆ day()

day (   $date)

Used to get a string to extract day from date column.

Usage: $query->select($query->day($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing day to be extracted.
Renvoie
string Returns string to extract day from a date.
Depuis
12.1

Références $date.

◆ delete()

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');

Paramètres
string$tableThe name of the table to delete from.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références null.

◆ dump()

dump ( )

Creates a formatted dump of the query for debugging purposes.

Usage: echo $query->dump();

Renvoie
string
Depuis
11.3

◆ escape()

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 FOFDatabaseDriver.

Paramètres
string$textThe string to be escaped.
boolean$extraOptional parameter to provide extra escaping.
Renvoie
string The escaped string.
Depuis
11.1
Exceptions
RuntimeExceptionif the internal db property is not a valid object.

Références $text.

◆ exec()

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'));

Paramètres
mixed$columnsA string or an array of field names.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
12.1

Références $columns.

◆ format()

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:

  • Replacement text automatically quoted (use uppercase for Name Quote).
  • Replacement text should be a string in date format or name of a date column. y/Y - Year m/M - Month d/D - Day h/H - Hour i/I - Minute s/S - Second

Invariable Types:

  • Takes no argument.
  • Argument index not incremented. t - Replacement text is the result of $this->currentTimestamp(). z - Replacement text is the result of $this->nullDate(false). Z - Replacement text is the result of $this->nullDate(true).

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.

Paramètres
string$formatThe formatting string.
Renvoie
string Returns a string produced according to the formatting string.
Depuis
12.3

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 '%'

Références $format, $i, $query, et null.

◆ from()

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');

Paramètres
mixed$tablesA string or array of table names. This can be a FOFDatabaseQuery object (or a child of it) when used as a subquery in FROM clause along with a value for $subQueryAlias.
string$subQueryAliasAlias used when $tables is a FOFDatabaseQuery.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Exceptions
RuntimeException
Depuis
11.1

◆ group()

group (   $columns)

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

Usage: $query->group('id');

Paramètres
mixed$columnsA string or array of ordering columns.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $columns.

◆ having()

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

A conditions to the HAVING clause of the query.

Usage: $query->group('id')->having('COUNT(id) > 5');

Paramètres
mixed$conditionsA string or array of columns.
string$glueThe glue by which to join the conditions. Defaults to AND.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ hour()

hour (   $date)

Used to get a string to extract hour from date column.

Usage: $query->select($query->hour($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing hour to be extracted.
Renvoie
string Returns string to extract hour from a date.
Depuis
12.1

Références $date.

◆ innerJoin()

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');

Paramètres
string$conditionThe join condition.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $condition.

◆ insert()

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'));

Paramètres
mixed$tableThe name of the table to insert data into.
boolean$incrementFieldThe name of the field to auto increment.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ join()

join (   $type,
  $conditions 
)

Add a JOIN clause to the query.

Usage: $query->join('INNER', 'b ON b.id = a.id);

Paramètres
string$typeThe type of join. This string is prepended to the JOIN keyword.
string$conditionsA string or array of conditions.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $type.

◆ leftJoin()

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');

Paramètres
string$conditionThe join condition.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $condition.

◆ length()

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');

Paramètres
string$valueThe string to measure.
Renvoie
int
Depuis
11.1

Références $value.

◆ minute()

minute (   $date)

Used to get a string to extract minute from date column.

Usage: $query->select($query->minute($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing minute to be extracted.
Renvoie
string Returns string to extract minute from a date.
Depuis
12.1

Références $date.

◆ month()

month (   $date)

Used to get a string to extract month from date column.

Usage: $query->select($query->month($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing month to be extracted.
Renvoie
string Returns string to extract month from a date.
Depuis
12.1

Références $date.

◆ nullDate()

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());

Paramètres
boolean$quotedOptionally wraps the null date in database quotes (true by default).
Renvoie
string Null or zero representation of a timestamp.
Depuis
11.1

◆ order()

order (   $columns)

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

Usage: $query->order('foo')->order('bar'); $query->order(array('foo','bar'));

Paramètres
mixed$columnsA string or array of ordering columns.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $columns.

◆ outerJoin()

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');

Paramètres
string$conditionThe join condition.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $condition.

◆ quote()

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 FOFDatabaseDriver.

Usage: $query->quote('fulltext'); $query->q('fulltext'); $query->q(array('option', 'fulltext'));

Paramètres
mixed$textA string or an array of strings to quote.
boolean$escapeTrue to escape the string, false to leave it unchanged.
Renvoie
string The quoted input string.
Depuis
11.1
Exceptions
RuntimeExceptionif the internal db property is not a valid object.

Références $text.

◆ quoteName()

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 FOFDatabaseDriver.

Usage: $query->quoteName('#__a'); $query->qn('#__a');

Paramètres
mixed$nameThe identifier name to wrap in quotes, or an array of identifier names to wrap in quotes. Each type supports dot-notation name.
mixed$asThe 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.
Renvoie
mixed The quote wrapped name, same type of $name.
Depuis
11.1
Exceptions
RuntimeExceptionif the internal db property is not a valid object.

Références $name.

◆ rightJoin()

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');

Paramètres
string$conditionThe join condition.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $condition.

◆ second()

second (   $date)

Used to get a string to extract seconds from date column.

Usage: $query->select($query->second($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing second to be extracted.
Renvoie
string Returns string to extract second from a date.
Depuis
12.1

Références $date.

◆ select()

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'));

Paramètres
mixed$columnsA string or an array of field names.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

Références $columns.

◆ set()

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');

Paramètres
mixed$conditionsA string or array of string conditions.
string$glueThe glue by which to join the condition strings. Defaults to ,. Note that the glue is set on first use and cannot be changed.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ setQuery()

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');

Paramètres
mixed$sqlAn SQL Query
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
12.1

◆ union()

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 (the $query base query MUST be a select query): $query->union('SELECT name FROM #__foo') $query->union('SELECT name FROM #__foo', true) $query->union(array('SELECT name FROM #__foo','SELECT name FROM #__bar')) $query->union($query2)->union($query3) $query->union(array($query2, $query3))

Paramètres
mixed$queryThe FOFDatabaseQuery object or string to union.
boolean$distinctTrue to only return distinct rows from the union.
string$glueThe glue by which to join the conditions.
Renvoie
mixed The FOFDatabaseQuery object on success or boolean false on failure.
Voir également
http://dev.mysql.com/doc/refman/5.0/en/union.html
Depuis
12.1

Références $name, $query, et FOFDatabaseQueryElement\append().

◆ unionAll()

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(array('SELECT name FROM #__foo','SELECT name FROM #__bar'))

Paramètres
mixed$queryThe FOFDatabaseQuery object or string to union.
boolean$distinctNot used - ignored.
string$glueNot used - ignored.
Renvoie
mixed The FOFDatabaseQuery object on success or boolean false on failure.
Voir également
union
Depuis
13.1

Références $name, et $query.

◆ unionDistinct()

unionDistinct (   $query,
  $glue = '' 
)

Add a query to UNION DISTINCT with the current query. Simply a proxy to union with the DISTINCT keyword.

Usage: $query->unionDistinct('SELECT name FROM #__foo')

Paramètres
mixed$queryThe FOFDatabaseQuery object or string to union.
string$glueThe glue by which to join the conditions.
Renvoie
mixed The FOFDatabaseQuery object on success or boolean false on failure.
Voir également
union
Depuis
12.1

Références $query.

◆ update()

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(...);

Paramètres
string$tableA table to update.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ values()

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'));

Paramètres
string$valuesA single tuple, or array of tuples.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ where()

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'));

Paramètres
mixed$conditionsA string or array of where conditions.
string$glueThe glue by which to join the conditions. Defaults to AND. Note that the glue is set on first use and cannot be changed.
Renvoie
FOFDatabaseQuery Returns this object to allow chaining.
Depuis
11.1

◆ year()

year (   $date)

Used to get a string to extract year from date column.

Usage: $query->select($query->year($query->quoteName('dateColumn')));

Paramètres
string$dateDate column containing year to be extracted.
Renvoie
string Returns string to extract year from a date.
Depuis
12.1

Références $date.

Documentation des champs

◆ $autoIncrementField

$autoIncrementField = null
protected

◆ $call

$call = null
protected

◆ $columns

$columns = null
protected

◆ $db

$db = null
protected

◆ $delete

$delete = null
protected

◆ $element

$element = null
protected

◆ $exec

$exec = null
protected

◆ $from

$from = null
protected

◆ $group

$group = null
protected

◆ $having

$having = null
protected

◆ $insert

$insert = null
protected

◆ $join

$join = null
protected

◆ $order

$order = null
protected

◆ $select

$select = null
protected

◆ $set

$set = null
protected

◆ $sql

$sql = null
protected

◆ $type

$type = ''
protected

◆ $union

$union = null
protected

◆ $unionAll

$unionAll = null
protected

◆ $update

$update = null
protected

◆ $values

$values = null
protected

◆ $where

$where = null
protected

La documentation de cette classe a été générée à partir du fichier suivant :