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 3202 2007-04-30 19:01:43Z voxus $ */
00012 
00020     final class LiteDialect extends Dialect
00021     {
00025         public static function me()
00026         {
00027             return Singleton::getInstance(__CLASS__);
00028         }
00029         
00030         public static function quoteValue($value)
00031         {
00033             
00034             if ($value instanceof Identifier && !$value->isFinalized())
00035                 return 'null';
00036             
00037             if (Assert::checkInteger($value))
00038                 return $value;
00039             
00040             return "'" .sqlite_escape_string($value)."'";
00041         }
00042         
00043         public static function dropTableMode($cascade = false)
00044         {
00045             return null;
00046         }
00047         
00048         public function preAutoincrement(DBColumn $column)
00049         {
00050             self::checkColumn($column);
00051             
00052             return null;
00053         }
00054         
00055         public function postAutoincrement(DBColumn $column)
00056         {
00057             self::checkColumn($column);
00058             
00059             return null; // or even 'AUTOINCREMENT'?
00060         }
00061         
00062         public function hasTruncate()
00063         {
00064             return false;
00065         }
00066         
00067         public function hasMultipleTruncate()
00068         {
00069             return false;
00070         }
00071         
00072         private static function checkColumn(DBColumn $column)
00073         {
00074             $type = $column->getType();
00075             
00076             Assert::isTrue(
00077                 (
00078                     $type->getId() == DataType::BIGINT
00079                     || $type->getId() == DataType::INTEGER
00080                 )
00081                 && $column->isPrimaryKey()
00082             );
00083         }
00084     }
00085 ?>

generated by doxygen-1.5.1
for onPHP at Mon Apr 30 23:10:09 2007