LiteDialect.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2005-2007 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 Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 /* $Id: LiteDialect.class.php 4687 2007-12-09 18:57:18Z 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 on Sun Dec 9 21:56:23 2007 for onPHP by  doxygen 1.5.4