public function typeToString(DataType $type) { if ($type->getId() == DataType::BINARY) { return 'BLOB'; } return parent::typeToString($type); }
public function typeToString(DataType $type) { switch ($type->getId()) { case DataType::BIGINT: return 'INTEGER'; case DataType::BINARY: return 'BLOB'; } return parent::typeToString($type); }
public function typeToString(DataType $type) { if ($type->getId() == DataType::BINARY) { return 'BYTEA'; } if (defined('POSTGRES_IP4_ENABLED')) { if ($type->getId() == DataType::IP) { return 'ip4'; } if ($type->getId() == DataType::IP_RANGE) { return 'ip4r'; } } return parent::typeToString($type); }
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; }