propel-adapter
[ class tree: propel-adapter ] [ index: propel-adapter ] [ all elements ]

Source for file DBSQLite.php

Documentation is available at DBSQLite.php

  1. <?php
  2.  
  3. /*
  4.  *  $Id: DBSQLite.php 563 2007-02-01 09:45:55Z heltem $
  5.  *
  6.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  7.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  8.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  9.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  10.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  11.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  12.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  13.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  14.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  15.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  16.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17.  *
  18.  * This software consists of voluntary contributions made by many individuals
  19.  * and is licensed under the LGPL. For more information please see
  20.  * <http://propel.phpdb.org>.
  21.  */
  22.  
  23. /**
  24.  * This is used in order to connect to a SQLite database.
  25.  *
  26.  * @author     Hans Lellelid <hans@xmpl.org>
  27.  * @version    $Revision: 563 $
  28.  * @package    propel.adapter
  29.  */
  30. class DBSQLite extends DBAdapter {
  31.  
  32.     /**
  33.      * This method is used to ignore case.
  34.      *
  35.      * @param      in The string to transform to upper case.
  36.      * @return     The upper case string.
  37.      */
  38.     public function toUpperCase($in)
  39.     {
  40.         return 'UPPER(' $in ')';
  41.     }
  42.  
  43.     /**
  44.      * This method is used to ignore case.
  45.      *
  46.      * @param      in The string whose case to ignore.
  47.      * @return     The string in a case that can be ignored.
  48.      */
  49.     public function ignoreCase($in)
  50.     {
  51.         return 'UPPER(' $in ')';
  52.     }
  53.  
  54.     /**
  55.      * Returns SQL which concatenates the second string to the first.
  56.      *
  57.      * @param      string String to concatenate.
  58.      * @param      string String to append.
  59.      * @return     string 
  60.      */
  61.     public function concatString($s1$s2)
  62.     {
  63.         return "($s1 || $s2)";
  64.     }
  65.  
  66.     /**
  67.      * Returns SQL which extracts a substring.
  68.      *
  69.      * @param      string String to extract from.
  70.      * @param      int Offset to start from.
  71.      * @param      int Number of characters to extract.
  72.      * @return     string 
  73.      */
  74.     public function subString($s$pos$len)
  75.     {
  76.         return "substr($s$pos$len)";
  77.     }
  78.  
  79.     /**
  80.      * Returns SQL which calculates the length (in chars) of a string.
  81.      *
  82.      * @param      string String to calculate length of.
  83.      * @return     string 
  84.      */
  85.     public function strLength($s)
  86.     {
  87.         return "length($s)";
  88.     }
  89.  
  90.     /**
  91.      * @see        DBAdapter::quoteIdentifier()
  92.      */
  93.     public function quoteIdentifier($text)
  94.     {
  95.         return '[' $text ']';
  96.     }
  97.  
  98.     /**
  99.      * @see        DBAdapter::applyLimit()
  100.      */
  101.     public function applyLimit(&$sql$offset$limit)
  102.     {
  103.         if $limit {
  104.             $sql .= " LIMIT " $limit ($offset " OFFSET " $offset "");
  105.         elseif $offset {
  106.             $sql .= " LIMIT -1 OFFSET " $offset;
  107.         }
  108.     }
  109.  
  110.     public function random($seed=NULL)
  111.     {
  112.         return 'random()';
  113.     }
  114.  
  115. }

Documentation generated on Thu, 22 Nov 2007 03:33:43 +0000 by phpDocumentor 1.4.0