PdoSqlite.php 713 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * MINZ - Copyright 2011 Marien Fressinaud
  4. * Sous licence AGPL3 <http://www.gnu.org/licenses/>
  5. */
  6. class Minz_PdoSqlite extends Minz_Pdo {
  7. /** @param array<int,int|string|bool>|null $options */
  8. public function __construct(string $dsn, ?string $username = null, ?string $passwd = null, ?array $options = null) {
  9. parent::__construct($dsn, $username, $passwd, $options);
  10. $this->exec('PRAGMA foreign_keys = ON;');
  11. }
  12. public function dbType(): string {
  13. return 'sqlite';
  14. }
  15. /**
  16. * @param string|null $name
  17. * @return string|false
  18. */
  19. #[\ReturnTypeWillChange]
  20. public function lastInsertId($name = null) {
  21. return parent::lastInsertId(); //We discard the name, only used by PostgreSQL
  22. }
  23. }