PdoSqlite.php 738 B

12345678910111213141516171819202122232425262728
  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_PdoSqlite 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('PRAGMA foreign_keys = ON;');
  12. }
  13. public function dbType(): string {
  14. return 'sqlite';
  15. }
  16. /**
  17. * @param string|null $name
  18. * @return string|false
  19. */
  20. #[\ReturnTypeWillChange]
  21. public function lastInsertId($name = null) {
  22. return parent::lastInsertId(); //We discard the name, only used by PostgreSQL
  23. }
  24. }