[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/database/src/Pdo/ -> PdoQuery.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\Pdo;
  10  
  11  use Joomla\Database\DatabaseQuery;
  12  
  13  /**
  14   * PDO Query Building Class.
  15   *
  16   * @since  1.0
  17   */
  18  abstract class PdoQuery extends DatabaseQuery
  19  {
  20      /**
  21       * The list of zero or null representation of a datetime.
  22       *
  23       * @var    array
  24       * @since  2.0.0
  25       */
  26      protected $nullDatetimeList = ['0000-00-00 00:00:00'];
  27  
  28      /**
  29       * Casts a value to a char.
  30       *
  31       * Ensure that the value is properly quoted before passing to the method.
  32       *
  33       * Usage:
  34       * $query->select($query->castAsChar('a'));
  35       * $query->select($query->castAsChar('a', 40));
  36       *
  37       * @param   string  $value  The value to cast as a char.
  38       * @param   string  $len    The length of the char.
  39       *
  40       * @return  string  Returns the cast value.
  41       *
  42       * @since   1.8.0
  43       */
  44  	public function castAsChar($value, $len = null)
  45      {
  46          if (!$len)
  47          {
  48              return $value;
  49          }
  50          else
  51          {
  52              return 'CAST(' . $value . ' AS CHAR(' . $len . '))';
  53          }
  54      }
  55  }


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