Source for file mysqli.php

Documentation is available at mysqli.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Platform
  4.  * @subpackage  Database
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * Query Building Class.
  14.  *
  15.  * @package     Joomla.Platform
  16.  * @subpackage  Database
  17.  * @since       11.1
  18.  */
  19. {
  20.     /**
  21.      * @var    integer  The offset for the result set.
  22.      * @since  12.1
  23.      */
  24.     protected $offset;
  25.  
  26.     /**
  27.      * @var    integer  The limit for the result set.
  28.      * @since  12.1
  29.      */
  30.     protected $limit;
  31.  
  32.     /**
  33.      * Method to modify a query already in string format with the needed
  34.      * additions to make the query limited to a particular number of
  35.      * results, or start at a particular offset.
  36.      *
  37.      * @param   string   $query   The query in string format
  38.      * @param   integer  $limit   The limit for the result set
  39.      * @param   integer  $offset  The offset for the result set
  40.      *
  41.      * @return string 
  42.      *
  43.      * @since 12.1
  44.      */
  45.     public function processLimit($query$limit$offset 0)
  46.     {
  47.         if ($limit || $offset 0)
  48.         {
  49.             $query .= ' LIMIT ' $offset ', ' $limit;
  50.         }
  51.  
  52.         return $query;
  53.     }
  54.  
  55.     /**
  56.      * Concatenates an array of column names or values.
  57.      *
  58.      * @param   array   $values     An array of values to concatenate.
  59.      * @param   string  $separator  As separator to place between each value.
  60.      *
  61.      * @return  string  The concatenated values.
  62.      *
  63.      * @since   11.1
  64.      */
  65.     public function concatenate($values$separator null)
  66.     {
  67.         if ($separator)
  68.         {
  69.             $concat_string 'CONCAT_WS(' $this->quote($separator);
  70.  
  71.             foreach ($values as $value)
  72.             {
  73.                 $concat_string .= ', ' $value;
  74.             }
  75.  
  76.             return $concat_string ')';
  77.         }
  78.         else
  79.         {
  80.             return 'CONCAT(' implode(','$values')';
  81.         }
  82.     }
  83.  
  84.     /**
  85.      * Sets the offset and limit for the result set, if the database driver supports it.
  86.      *
  87.      * Usage:
  88.      * $query->setLimit(100, 0); (retrieve 100 rows, starting at first record)
  89.      * $query->setLimit(50, 50); (retrieve 50 rows, starting at 50th record)
  90.      *
  91.      * @param   integer  $limit   The limit for the result set
  92.      * @param   integer  $offset  The offset for the result set
  93.      *
  94.      * @return  JDatabaseQuery  Returns this object to allow chaining.
  95.      *
  96.      * @since   12.1
  97.      */
  98.     public function setLimit($limit 0$offset 0)
  99.     {
  100.         $this->limit  = (int) $limit;
  101.         $this->offset = (int) $offset;
  102.  
  103.         return $this;
  104.     }
  105. }

Documentation generated on Tue, 19 Nov 2013 15:09:13 +0100 by phpDocumentor 1.4.3