PdoPgsql.php 739 B

1234567891011121314151617181920212223242526272829
  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. /**
  9. * @param array<int,int|string|bool>|null $options
  10. * @throws PDOException
  11. */
  12. public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {
  13. parent::__construct($dsn, $username, $passwd, $options);
  14. $this->exec("SET NAMES 'UTF8';");
  15. }
  16. #[\Override]
  17. public function dbType(): string {
  18. return 'pgsql';
  19. }
  20. #[\Override]
  21. protected function preSql(string $statement): string {
  22. $statement = parent::preSql($statement);
  23. return str_replace(['`', ' LIKE '], ['"', ' ILIKE '], $statement);
  24. }
  25. }