public function toSql(BaseDriver $driver, ArgumentArray $args) { $sql = 'CREATE DATABASE'; if ($this->ifNotExists && $driver instanceof MySQLDriver) { $sql .= ' IF NOT EXISTS'; } $sql .= ' ' . $driver->quoteIdentifier($this->dbName); if ($driver instanceof MySQLDriver) { if ($this->characterSet) { $sql .= ' CHARACTER SET ' . $driver->quote($this->characterSet); } if ($this->collate) { $sql .= ' COLLATE ' . $driver->quote($this->collate); } } elseif ($driver instanceof PgSQLDriver) { /** * PostgreSQL properties */ if ($this->owner) { $sql .= ' OWNER ' . $driver->quote($this->owner); } if ($this->template) { $sql .= ' TEMPLATE ' . $driver->quote($this->template); } if ($this->encoding) { $sql .= ' ENCODING ' . $driver->quote($this->encoding); } if ($this->collate) { $sql .= ' LC_COLLATE ' . $driver->quote($this->collate); } if ($this->ctype) { $sql .= ' LC_CTYPE ' . $driver->quote($this->ctype); } if ($this->tablespace) { $sql .= ' TABLESPACE ' . $driver->quote($this->tablespace); } if ($this->connectionLimit) { $sql .= ' CONNECTION LIMIT ' . $this->connectionLimit; } } return $sql; }