onPHP

core/DB/LiteDialect.class.php Source File

 

LiteDialect.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2005 by Konstantin V. Arkhipov                          *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: LiteDialect.class.php 2203 2006-11-11 21:31:25Z voxus $ */
00012 
00020     final class LiteDialect extends Dialect
00021     {
00022         public static function me()
00023         {
00024             return Singleton::getInstance(__CLASS__);
00025         }
00026         
00027         public static function quoteValue($value)
00028         {
00030             
00031             if ($value instanceof Identifier && !$value->isFinalized())
00032                 return 'null';
00033             
00034             return "'" .sqlite_escape_string($value)."'";
00035         }
00036         
00037         public static function dropTableMode($cascade = false)
00038         {
00039             return null;
00040         }
00041         
00042         public function preAutoincrement(DBColumn $column)
00043         {
00044             self::checkColumn($column);
00045             
00046             return null;
00047         }
00048         
00049         public function postAutoincrement(DBColumn $column)
00050         {
00051             self::checkColumn($column);
00052             
00053             return null; // or even 'AUTOINCREMENT'?
00054         }
00055         
00056         public function hasTruncate()
00057         {
00058             return false;
00059         }
00060         
00061         public function hasMultipleTruncate()
00062         {
00063             return false;
00064         }
00065         
00066         private static function checkColumn(DBColumn $column)
00067         {
00068             $type = $column->getType();
00069             
00070             Assert::isTrue(
00071                 (
00072                     $type->getId() == DataType::BIGINT
00073                     || $type->getId() == DataType::INTEGER
00074                 )
00075                 && $column->isPrimaryKey()
00076             );
00077         }
00078     }
00079 ?>

generated by doxygen-1.5.1
for onPHP at Sun Nov 12 00:44:12 2006