Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00018 abstract class Dialect
00019 extends Singleton
00020 implements Instantiatable
00021 {
00022 abstract public function preAutoincrement(DBColumn $column);
00023 abstract public function postAutoincrement(DBColumn $column);
00024
00025 abstract public function hasTruncate();
00026 abstract public function hasMultipleTruncate();
00027 abstract public function hasReturning();
00028
00035 public static function quoteField($field)
00036 {
00037 return self::quoteTable($field);
00038 }
00039
00040 public static function quoteTable($table)
00041 {
00042 return '"'.$table.'"';
00043 }
00044
00045 public static function toCasted($field, $type)
00046 {
00047 return "CAST ({$field} AS {$type})";
00048 }
00049
00050 public static function timeZone($exist = false)
00051 {
00052 return
00053 $exist
00054 ? ' WITH TIME ZONE'
00055 : ' WITHOUT TIME ZONE';
00056 }
00057
00058 public static function dropTableMode($cascade = false)
00059 {
00060 return
00061 $cascade
00062 ? ' CASCADE'
00063 : ' RESTRICT';
00064 }
00065
00066 public function quoteBinary($data)
00067 {
00068 return $this->quoteValue($data);
00069 }
00070
00071 public function unquoteBinary($data)
00072 {
00073 return $data;
00074 }
00075
00076 public function typeToString(DataType $type)
00077 {
00078 return $type->getName();
00079 }
00080
00081 public function toFieldString($expression)
00082 {
00083 return $this->toNeededString($expression, 'quoteField');
00084 }
00085
00086 public function toValueString($expression)
00087 {
00088 return $this->toNeededString($expression, 'quoteValue');
00089 }
00090
00091 private function toNeededString($expression, $method)
00092 {
00093 $string = null;
00094
00095 if (null !== $expression) {
00096 if ($expression instanceof DialectString) {
00097 if ($expression instanceof Query)
00098 $string .= '('.$expression->toDialectString($this).')';
00099 else
00100 $string .= $expression->toDialectString($this);
00101 } else {
00102 $string .= $this->$method($expression);
00103 }
00104 }
00105
00106 return $string;
00107 }
00108
00109 public function fieldToString($field)
00110 {
00111 return
00112 $field instanceof DialectString
00113 ? $field->toDialectString($this)
00114 : $this->quoteField($field);
00115 }
00116
00117 public function valueToString($value)
00118 {
00119 return
00120 $value instanceof DBValue
00121 ? $value->toDialectString($this)
00122 : $this->quoteValue($value);
00123 }
00124
00125 public function fullTextSearch($field, $words, $logic)
00126 {
00127 throw new UnimplementedFeatureException();
00128 }
00129
00130 public function fullTextRank($field, $words, $logic)
00131 {
00132 throw new UnimplementedFeatureException();
00133 }
00134 }
00135 ?>