ImaginaryDialect.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 
00018     final class ImaginaryDialect extends Dialect
00019     {
00023         public static function me()
00024         {
00025             return Singleton::getInstance(__CLASS__);
00026         }
00027         
00028         public function preAutoincrement(DBColumn $column)
00029         {
00030             return null;
00031         }
00032         
00033         public function postAutoincrement(DBColumn $column)
00034         {
00035             return 'AUTOINCREMENT';
00036         }
00037         
00038         public static function quoteValue($value)
00039         {
00040             return $value;
00041         }
00042         
00043         public static function quoteField($field)
00044         {
00045             return $field;
00046         }
00047         
00048         public static function quoteTable($table)
00049         {
00050             return $table;
00051         }
00052         
00053         public function hasTruncate()
00054         {
00055             return false;
00056         }
00057         
00058         public function hasMultipleTruncate()
00059         {
00060             return false;
00061         }
00062         
00063         public function hasReturning()
00064         {
00065             return false;
00066         }
00067         
00068         public function fieldToString($field)
00069         {
00070             return
00071                 $field instanceof DialectString
00072                     ? $field->toDialectString($this)
00073                     : $field;
00074         }
00075         
00076         public function valueToString($value)
00077         {
00078             return
00079                 $value instanceof DBValue
00080                     ? $value->toDialectString($this)
00081                     : $value;
00082         }
00083 
00084         public function fullTextSearch($field, $words, $logic)
00085         {
00086             return
00087                 '("'
00088                     .$this->fieldToString($field)
00089                     .'" CONTAINS "'
00090                     .implode($logic, $words)
00091                 .'")';
00092         }
00093         
00094         public function fullTextRank($field, $words, $logic)
00095         {
00096             return
00097                 '(RANK BY "'.$this->fieldToString($field).'" WHICH CONTAINS "'
00098                     .implode($logic, $words)
00099                 .'")';
00100         }
00101     }
00102 ?>