[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Query/ -> MysqlQueryBuilder.php (summary)

Part of the Joomla Framework Database Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 264 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 9 functions

  __toString()
  processLimit()
  concatenate()
  groupConcat()
  regexp()
  rand()
  findInSet()
  selectRowNumber()
  castAs()

Functions
Functions that are not part of a class:

__toString()   X-Ref
Magic function to convert the query to a string.

return: string  The completed query.

processLimit($query, $limit, $offset = 0)   X-Ref
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: string   $query   The query in string format
param: integer  $limit   The limit for the result set
param: integer  $offset  The offset for the result set
return: string

concatenate($values, $separator = null)   X-Ref
Concatenates an array of column names or values.

param: string[]     $values     An array of values to concatenate.
param: string|null  $separator  As separator to place between each value.
return: string  The concatenated values.

groupConcat($expression, $separator = ',')   X-Ref
Aggregate function to get input values concatenated into a string, separated by delimiter

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

param: string  $expression  The expression to apply concatenation to, this may be a column name or complex SQL statement.
param: string  $separator   The delimiter of each concatenated value
return: string  Input values concatenated into a string, separated by delimiter

regexp($value)   X-Ref
Get the regular expression operator

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

param: string  $value  The regex pattern.
return: string

rand()   X-Ref
Get the function to return a random floating-point value

Usage:
$query->rand();

return: string

findInSet($value, $set)   X-Ref
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: string  $value  The value to search for.
param: string  $set    The set of values.
return: string  A representation of the MySQL find_in_set() function for the driver.

selectRowNumber($orderBy, $orderColumnAlias)   X-Ref
Return the number of the current row.

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

param: string  $orderBy           An expression of ordering for window function.
param: string  $orderColumnAlias  An alias for new ordering column.
return: $this

castAs(string $type, string $value, ?string $length = null)   X-Ref
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: string  $type    The type of string to cast as.
param: string  $value   The value to cast as a char.
param: string  $length  The value to cast as a char.
return: string  SQL statement to cast the value as a char type.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer