Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de l'espace de nommage Joomla\Database\Query

Structures de données

interface  LimitableInterface
 
interface  PreparableInterface
 
class  QueryElement
 

Fonctions

 regexp ($value)
 
 rand ()
 
 findInSet ($value, $set)
 
 selectRowNumber ($orderBy, $orderColumnAlias)
 
 castAs (string $type, string $value, ?string $length=null)
 
 __toString ()
 
 clear ($clause=null)
 
 concatenate ($values, $separator=null)
 
 currentTimestamp ()
 
 forUpdate ($tableName, $glue=',')
 
 forShare ($tableName, $glue=',')
 
 groupConcat ($expression, $separator=',')
 
 year ($date)
 
 month ($date)
 
 day ($date)
 
 hour ($date)
 
 minute ($date)
 
 second ($date)
 
 noWait ()
 
 limit ($limit=0)
 
 offset ($offset=0)
 
 returning ($pkCol)
 
 processLimit ($query, $limit, $offset=0)
 
 dateAdd ($date, $interval, $datePart)
 

Variables

trait MysqlQueryBuilder
 
trait PostgresqlQueryBuilder
 
 $forShare
 
 $noWait
 
 $limit
 
 $offset
 
 $returning
 

Description détaillée

Part of the Joomla Framework Database Package

Documentation des fonctions

◆ __toString()

◆ castAs()

castAs ( string  $type,
string  $value,
?string  $length = null 
)

Casts a value to a char.

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

Usage: $query->select($query->castAs('CHAR', 'a'));

Paramètres
string$typeThe type of string to cast as.
string$valueThe value to cast as a char.
string$lengthThe value to cast as a char.
Renvoie
string SQL statement to cast the value as a char type.
Depuis
1.0

Références $type, et $value.

Référencé par SqlsrvQuery\castAs().

◆ clear()

Joomla\Database\Query\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
$this
Depuis
2.0.0

Références $this, Joomla\Database\Query\forShare(), Joomla\Database\Query\forUpdate(), Joomla\Database\Query\limit(), Joomla\Database\Query\noWait(), null, Joomla\Database\Query\offset(), et Joomla\Database\Query\returning().

Référencé par Session\clear().

◆ concatenate()

Joomla\Database\Query\concatenate (   $values,
  $separator = null 
)

Concatenates an array of column names or values.

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

Paramètres
string[]$values An array of values to concatenate.
string | null$separatorAs separator to place between each value.
Renvoie
string The concatenated values.
Depuis
2.0.0

Références $separator, et null.

◆ currentTimestamp()

Joomla\Database\Query\currentTimestamp ( )

Gets the current date and time.

Renvoie
string Return string used in query to obtain
Depuis
2.0.0

◆ dateAdd()

Joomla\Database\Query\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.

Paramètres
string$dateThe db quoted string representation of the date to add to
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
Depuis
2.0.0 http://www.postgresql.org/docs/9.0/static/functions-datetime.html.

Références $date.

◆ day()

Joomla\Database\Query\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
2.0.0

Références $date.

◆ findInSet()

findInSet (   $value,
  $set 
)

Find a value in a varchar used like a set.

Ensure that the value is an integer before passing to the method.

Usage: $query->findInSet((int) $parent->id, 'a.assigned_cat_ids')

Paramètres
string$valueThe value to search for.
string$setThe set of values.
Renvoie
string A representation of the MySQL find_in_set() function for the driver.
Depuis
2.0.0

Références $value.

◆ forShare()

Joomla\Database\Query\forShare (   $tableName,
  $glue = ',' 
)

Sets the FOR SHARE lock on select's output row

Paramètres
string$tableNameThe table to lock
string$glueThe glue by which to join the conditions. Defaults to ',' .
Renvoie
$this
Depuis
2.0.0

Références $this, et null.

Référencé par Joomla\Database\Query\__toString(), et Joomla\Database\Query\clear().

◆ forUpdate()

Joomla\Database\Query\forUpdate (   $tableName,
  $glue = ',' 
)

Sets the FOR UPDATE lock on select's output row

Paramètres
string$tableNameThe table to lock
string$glueThe glue by which to join the conditions. Defaults to ',' .
Renvoie
$this
Depuis
2.0.0

Références $this, et null.

Référencé par Joomla\Database\Query\__toString(), et Joomla\Database\Query\clear().

◆ groupConcat()

Joomla\Database\Query\groupConcat (   $expression,
  $separator = ',' 
)

Aggregate function to get input values concatenated into a string, separated by delimiter

Usage: $query->groupConcat('id', ',');

Paramètres
string$expressionThe expression to apply concatenation to, this may be a column name or complex SQL statement.
string$separatorThe delimiter of each concatenated value
Renvoie
string Input values concatenated into a string, separated by delimiter
Depuis
2.0.0

Références $separator.

◆ hour()

Joomla\Database\Query\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
2.0.0

Références $date.

◆ limit()

◆ minute()

Joomla\Database\Query\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
2.0.0

Références $date.

◆ month()

Joomla\Database\Query\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
2.0.0

Références $date.

◆ noWait()

Joomla\Database\Query\noWait ( )

Sets the NOWAIT lock on select's output row

Renvoie
$this
Depuis
2.0.0

Références $this, et null.

Référencé par Joomla\Database\Query\__toString(), et Joomla\Database\Query\clear().

◆ offset()

◆ processLimit()

Joomla\Database\Query\processLimit (   $query,
  $limit,
  $offset = 0 
)

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.

Paramètres
string$queryThe query in string format
integer$limitThe limit for the result set
integer$offsetThe offset for the result set
Renvoie
string
Depuis
2.0.0

Références Joomla\Database\Query\$limit, Joomla\Database\Query\$offset, et $query.

Référencé par Joomla\Database\Query\__toString().

◆ rand()

rand ( )

Get the function to return a random floating-point value

Usage: $query->rand();

Renvoie
string
Depuis
2.0.0

Référencé par ArticlesCategoryHelper\getList().

◆ regexp()

regexp (   $value)

Get the regular expression operator

Usage: $query->where('field ' . $query->regexp($search));

Paramètres
string$valueThe regex pattern.
Renvoie
string
Depuis
2.0.0

Références $value.

◆ returning()

Joomla\Database\Query\returning (   $pkCol)

Add the RETURNING element to INSERT INTO statement.

Paramètres
mixed$pkColThe name of the primary key column.
Renvoie
$this
Depuis
2.0.0

Références $this, et null.

Référencé par Joomla\Database\Query\__toString(), et Joomla\Database\Query\clear().

◆ second()

Joomla\Database\Query\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
2.0.0

Références $date.

◆ selectRowNumber()

Joomla\Database\Query\selectRowNumber (   $orderBy,
  $orderColumnAlias 
)

Return the number of the current row.

Usage: $query->select('id'); $query->selectRowNumber('ordering,publish_up DESC', 'new_ordering'); $query->from('#__content');

Paramètres
string$orderByAn expression of ordering for window function.
string$orderColumnAliasAn alias for new ordering column.
Renvoie
$this
Depuis
2.0.0
Exceptions

Référencé par Joomla\Database\Query\__toString().

◆ year()

Joomla\Database\Query\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
2.0.0

Références $date.

Documentation des variables

◆ $forShare

$forShare
protected

◆ $limit

◆ $noWait

$noWait
protected

◆ $offset

$offset
protected

Référencé par Pagination\_buildDataObject(), Stream\_stream_seek(), Tobscure\JsonApi\addPaginationLink(), Tobscure\JsonApi\addPaginationLinks(), AbstractString\after(), AbstractString\afterLast(), ASN1\asn1map(), PHPMailer\base64EncodeWrapMB(), AbstractString\before(), AbstractString\beforeLast(), ActionlogsModel\buildDateRange(), UsersModel\buildDateRange(), ByteString\bytesAt(), QuestionHelper\cloneInputStream(), CodePointString\codePointsAt(), SymmetricKey\decrypt(), HtmlView\display(), JsonapiView\displayList(), ASN1\encode_der(), CalendarField\filter(), FileStorage\find(), RedisStorage\find(), MemcachedStorage\find(), OpenHandler\find(), PdoStorage\find(), OutputFormatter\formatAndWrap(), SFTP\get(), Totp\getCode(), Adapter\getItems(), TagsModel\getListQuery(), Parameters\getOffset(), AbstractField\getRangeForExpression(), Grapheme\grapheme_position(), Grapheme\grapheme_stripos(), Grapheme\grapheme_strpos(), Grapheme\grapheme_strripos(), Grapheme\grapheme_strrpos(), Iconv\iconv_strpos(), CodePointString\indexOf(), UnicodeString\indexOf(), ByteString\indexOf(), AbstractString\indexOf(), CodePointString\indexOfLast(), UnicodeString\indexOfLast(), ByteString\indexOfLast(), AbstractString\indexOfLast(), PuTTY\load(), DatabaseDriver\loadColumn(), ByteString\match(), Mbstring\mb_stripos(), Mbstring\mb_strpos(), Mbstring\mb_strripos(), Mbstring\mb_strrpos(), Nested\moveByReference(), Joomla\Database\Query\offset(), Construct\offsetExists(), ParagonIE_Sodium_Core_Curve25519_Fe\offsetExists(), ParagonIE_Sodium_Core_ChaCha20_Ctx\offsetExists(), Collection\offsetExists(), ParagonIE_Sodium_Core32_ChaCha20_Ctx\offsetExists(), ParagonIE_Sodium_Core32_Curve25519_Fe\offsetExists(), DataShapeObject\offsetExists(), Feed\offsetExists(), Registry\offsetExists(), DataSet\offsetExists(), Construct\offsetGet(), Collection\offsetGet(), ParagonIE_Sodium_Core_Curve25519_Fe\offsetGet(), ParagonIE_Sodium_Core_ChaCha20_Ctx\offsetGet(), ParagonIE_Sodium_Core32_ChaCha20_Ctx\offsetGet(), DataShapeObject\offsetGet(), Feed\offsetGet(), Registry\offsetGet(), DataSet\offsetGet(), ParagonIE_Sodium_Core_Curve25519_Fe\offsetSet(), ParagonIE_Sodium_Core_ChaCha20_Ctx\offsetSet(), ParagonIE_Sodium_Core32_ChaCha20_Ctx\offsetSet(), Construct\offsetSet(), ParagonIE_Sodium_Core32_Curve25519_Fe\offsetSet(), Collection\offsetSet(), DataShapeObject\offsetSet(), Feed\offsetSet(), Registry\offsetSet(), DataSet\offsetSet(), Construct\offsetUnset(), ParagonIE_Sodium_Core_Curve25519_Fe\offsetUnset(), ParagonIE_Sodium_Core_ChaCha20_Ctx\offsetUnset(), ParagonIE_Sodium_Core32_ChaCha20_Ctx\offsetUnset(), Collection\offsetUnset(), ParagonIE_Sodium_Core32_Curve25519_Fe\offsetUnset(), Feed\offsetUnset(), Registry\offsetUnset(), DataSet\offsetUnset(), Adapter\onBuildIndex(), Hash\poly(), NewsfeedModel\populateState(), TagsModel\populateState(), ArticleModel\populateState(), TagModel\populateState(), Iconv\pregOffset(), Query\processDates(), Joomla\Database\Query\processLimit(), Query\processString(), SFTP\put(), Zip\readZipInfo(), Html\removeBlocks(), Image\resize(), PrivateKey\rsaes_oaep_decrypt(), Image\sanitizeOffset(), Stem\search(), Stream\seek(), BufferStreamHandler\seek_cur(), BufferStreamHandler\seek_end(), BufferStreamHandler\seek_set(), DatabaseDriver\setQuery(), Application\splitStringByWidth(), Buffer\stream_seek(), BufferStreamHandler\stream_seek(), StringWrapper\stream_seek(), StreamString\stream_seek(), PharStreamWrapper\stream_seek(), StringHelper\strpos(), StringHelper\strrpos(), StringHelper\substr(), StringHelper\truncate(), ParagonIE_Sodium_Core32_BLAKE2b\update(), ParagonIE_Sodium_Core_BLAKE2b\update(), utf8_byte_position(), utf8_strpos(), utf8_strrpos(), et utf8_substr().

◆ $returning

◆ MysqlQueryBuilder

trait MysqlQueryBuilder

Trait for MySQL Query Building.

Depuis
2.0.0

◆ PostgresqlQueryBuilder

trait PostgresqlQueryBuilder
Valeur initiale :
{
protected $forUpdate

Trait for PostgreSQL Query Building.

Depuis
2.0.0