[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Query/ -> PostgresqlQueryBuilder.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: 740 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 23 functions

  __toString()
  clear()
  castAs()
  concatenate()
  currentTimestamp()
  forUpdate()
  forShare()
  groupConcat()
  year()
  month()
  day()
  hour()
  minute()
  second()
  noWait()
  limit()
  offset()
  returning()
  processLimit()
  dateAdd()
  regexp()
  rand()
  findInSet()

Functions
Functions that are not part of a class:

__toString()   X-Ref
Magic function to convert the query to a string, only for PostgreSQL specific queries

return: string    The completed query.

clear($clause = null)   X-Ref
Clear data from the query or a specific clause of the query.

param: string  $clause  Optionally, the name of the clause to clear, or nothing to clear the whole query.
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.

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

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

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.

currentTimestamp()   X-Ref
Gets the current date and time.

return: string  Return string used in query to obtain

forUpdate($tableName, $glue = ',')   X-Ref
Sets the FOR UPDATE lock on select's output row

param: string  $tableName  The table to lock
param: string  $glue       The glue by which to join the conditions. Defaults to ',' .
return: $this

forShare($tableName, $glue = ',')   X-Ref
Sets the FOR SHARE lock on select's output row

param: string  $tableName  The table to lock
param: string  $glue       The glue by which to join the conditions. Defaults to ',' .
return: $this

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

year($date)   X-Ref
Used to get a string to extract year from date column.

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

param: string  $date  Date column containing year to be extracted.
return: string  Returns string to extract year from a date.

month($date)   X-Ref
Used to get a string to extract month from date column.

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

param: string  $date  Date column containing month to be extracted.
return: string  Returns string to extract month from a date.

day($date)   X-Ref
Used to get a string to extract day from date column.

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

param: string  $date  Date column containing day to be extracted.
return: string  Returns string to extract day from a date.

hour($date)   X-Ref
Used to get a string to extract hour from date column.

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

param: string  $date  Date column containing hour to be extracted.
return: string  Returns string to extract hour from a date.

minute($date)   X-Ref
Used to get a string to extract minute from date column.

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

param: string  $date  Date column containing minute to be extracted.
return: string  Returns string to extract minute from a date.

second($date)   X-Ref
Used to get a string to extract seconds from date column.

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

param: string  $date  Date column containing second to be extracted.
return: string  Returns string to extract second from a date.

noWait()   X-Ref
Sets the NOWAIT lock on select's output row

return: $this

limit($limit = 0)   X-Ref
Set the LIMIT clause to the query

param: integer  $limit  Number of rows to return
return: $this

offset($offset = 0)   X-Ref
Set the OFFSET clause to the query

param: integer  $offset  An integer for skipping rows
return: $this

returning($pkCol)   X-Ref
Add the RETURNING element to INSERT INTO statement.

param: mixed  $pkCol  The name of the primary key column.
return: $this

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

dateAdd($date, $interval, $datePart)   X-Ref
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: string  $date      The db quoted string representation of the date to add to
param: string  $interval  The string representation of the appropriate number of units
param: string  $datePart  The part of the date to perform the addition on
return: string  The string with the appropriate sql for addition of dates

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.



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