PdoPgsql.php 690 B

123456789101112131415161718192021222324
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * MINZ - Copyright 2011 Marien Fressinaud
  5. * Sous licence AGPL3 <http://www.gnu.org/licenses/>
  6. */
  7. class Minz_PdoPgsql extends Minz_Pdo {
  8. /** @param array<int,int|string|bool>|null $options */
  9. public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {
  10. parent::__construct($dsn, $username, $passwd, $options);
  11. $this->exec("SET NAMES 'UTF8';");
  12. }
  13. public function dbType(): string {
  14. return 'pgsql';
  15. }
  16. protected function preSql(string $statement): string {
  17. $statement = parent::preSql($statement);
  18. return str_replace(array('`', ' LIKE '), array('"', ' ILIKE '), $statement);
  19. }
  20. }