Overview
Comment: | Adaptation au nouveau KD2\DB\SQLite3 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
6ed70e24ffe77bf9e988ebb25f9449b3 |
User & Date: | bohwaz on 2020-01-20 00:14:19 |
Other Links: | branch diff | manifest | tags |
Context
2020-01-21
| ||
13:27 | Déplacement des entités, ajout de vérifications supplémentaires check-in: 5a3f31fcb9 user: bohwaz tags: dev | |
2020-01-20
| ||
00:14 | Adaptation au nouveau KD2\DB\SQLite3 check-in: 6ed70e24ff user: bohwaz tags: dev | |
00:13 | Migration et mise à jour en utilisant des fichiers versionnés check-in: ecca97c82a user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/DB.php from [1f3b4719e4] to [76f153c2da].
1 2 3 4 | <?php namespace Garradin; | | | | > > > > > > > > > > > > > | | < < < < | < | < < < < < < < < < < | | | | | | | | | | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | <?php namespace Garradin; use KD2\DB\SQLite3; class DB extends SQLite3 { /** * Application ID pour SQLite * @link https://www.sqlite.org/pragma.html#pragma_application_id */ const APPID = 0x5da2d811; static protected $_instance = null; static public function getInstance($create = false, $readonly = false) { if (null === self::$_instance) { self::$_instance = new DB('sqlite', ['file' => DB_FILE]); $flags = \SQLITE3_OPEN_READWRITE; if ($create) { $flags |= \SQLITE3_OPEN_CREATE; } self::$_instance->flags = $flags; } return self::$_instance; } private function __clone() { // Désactiver le clonage, car on ne veut qu'une seule instance } public function connect(): void { if (null !== $this->db) { return; } parent::connect(); // Activer les contraintes des foreign keys $this->db->exec('PRAGMA foreign_keys = ON;'); // 10 secondes $this->db->busyTimeout(10 * 1000); $this->exec('PRAGMA journal_mode = TRUNCATE;'); $this->db->createFunction('transliterate_to_ascii', ['Garradin\Utils', 'transliterateToAscii']); } public function close(): void { parent::close(); self::$_instance = null; } /** * Import a file containing SQL commands |
︙ | ︙ |