[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Pgsql/ -> PgsqlQuery.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Database Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Database\Pgsql;
  10  
  11  use Joomla\Database\Pdo\PdoQuery;
  12  use Joomla\Database\Query\PostgresqlQueryBuilder;
  13  use Joomla\Database\Query\QueryElement;
  14  
  15  /**
  16   * PDO PostgreSQL Query Building Class.
  17   *
  18   * @since  1.0
  19   *
  20   * @property-read  QueryElement  $forUpdate  The FOR UPDATE element used in "FOR UPDATE" lock
  21   * @property-read  QueryElement  $forShare   The FOR SHARE element used in "FOR SHARE" lock
  22   * @property-read  QueryElement  $noWait     The NOWAIT element used in "FOR SHARE" and "FOR UPDATE" lock
  23   * @property-read  QueryElement  $returning  The RETURNING element of INSERT INTO
  24   */
  25  class PgsqlQuery extends PdoQuery
  26  {
  27      use PostgresqlQueryBuilder;
  28  
  29      /**
  30       * The list of zero or null representation of a datetime.
  31       *
  32       * @var    array
  33       * @since  2.0.0
  34       */
  35      protected $nullDatetimeList = ['1970-01-01 00:00:00'];
  36  
  37      /**
  38       * Casts a value to a char.
  39       *
  40       * Ensure that the value is properly quoted before passing to the method.
  41       *
  42       * Usage:
  43       * $query->select($query->castAsChar('a'));
  44       * $query->select($query->castAsChar('a', 40));
  45       *
  46       * @param   string  $value   The value to cast as a char.
  47       * @param   string  $length  The length of the char.
  48       *
  49       * @return  string  Returns the cast value.
  50       *
  51       * @since   1.8.0
  52       */
  53  	public function castAsChar($value, $length = null)
  54      {
  55          if ((int) $length < 1)
  56          {
  57              return $value . '::text';
  58          }
  59  
  60          return 'CAST(' . $value . ' AS CHAR(' . $length . '))';
  61      }
  62  }


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