public function toDialectString(Dialect $dialect) { $out = $dialect->typeToString($this); if ($this->unsigned) { $out .= ' UNSIGNED'; } if ($this->id & self::HAVE_PRECISION) { if ($this->precision) { switch ($this->id) { case self::TIME: case self::TIMESTAMP: $out .= "({$this->precision})"; break; case self::NUMERIC: $out .= $this->precision ? "({$this->size}, {$this->precision})" : "({$this->size})"; break; default: throw new WrongStateException(); } } } elseif ($this->hasSize()) { if (!$this->size) { throw new WrongStateException("type '{$this->name}' must have size"); } $out .= "({$this->size})"; } if ($this->id & self::HAVE_TIMEZONE) { $out .= $dialect->timeZone($this->timezone); } $out .= $this->null ? ' NULL' : ' NOT NULL'; return $out; }