diff options
| author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-11-03 20:35:24 +0100 |
|---|---|---|
| committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-11-03 20:35:24 +0100 |
| commit | c783c37c73beb2756d900f18dd24430c1b9f41ff (patch) | |
| tree | 81bfded9172093113bd9d952a26532cfd361d388 /phpBB/phpbb/db | |
| parent | 8b7f711a184220928f42d5ec079af18d259981d0 (diff) | |
| parent | f991e484da91e24f82fbcb05d0b2ae11ca51852b (diff) | |
| download | forums-c783c37c73beb2756d900f18dd24430c1b9f41ff.tar forums-c783c37c73beb2756d900f18dd24430c1b9f41ff.tar.gz forums-c783c37c73beb2756d900f18dd24430c1b9f41ff.tar.bz2 forums-c783c37c73beb2756d900f18dd24430c1b9f41ff.tar.xz forums-c783c37c73beb2756d900f18dd24430c1b9f41ff.zip | |
Merge pull request #3995 from CHItA/ticket/14044
[ticket/14044] Deduplicate the installers
* CHItA/ticket/14044:
[ticket/14044] Add config as global in notify user
[ticket/14044] Fix language selection data loss
[ticket/14044] Patch language::set_fallback_array()
[ticket/14044] Fix tests
[ticket/14044] Fix wrong descriptions in install
[ticket/14044] Solve missing email template error
[ticket/14044] global $table_prefix in constants.php
[ticket/14044] Try to fix missing table prefix
[ticket/14044] Use the correct language file version
[ticket/14044] Automatically trigger rollback on insert in transaction
[ticket/14044] Use empty instead of !count
[ticket/14044] Fix Sqlite error in tests
[ticket/14044] Deduplicate the installers
Diffstat (limited to 'phpBB/phpbb/db')
| -rw-r--r-- | phpBB/phpbb/db/driver/sqlite3.php | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php index b7f6e60337..0508500c52 100644 --- a/phpBB/phpbb/db/driver/sqlite3.php +++ b/phpBB/phpbb/db/driver/sqlite3.php @@ -102,7 +102,7 @@ class sqlite3 extends \phpbb\db\driver\driver break; case 'rollback': - return $this->dbo->exec('ROLLBACK'); + return @$this->dbo->exec('ROLLBACK'); break; } @@ -134,9 +134,26 @@ class sqlite3 extends \phpbb\db\driver\driver if ($this->query_result === false) { + if ($this->transaction === true && strpos($query, 'INSERT') === 0) + { + $query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query); + } + if (($this->query_result = @$this->dbo->query($query)) === false) { - $this->sql_error($query); + // Try to recover a lost database connection + if ($this->dbo && !@$this->dbo->lastErrorMsg()) + { + if ($this->sql_connect($this->server, $this->user, '', $this->dbname)) + { + $this->query_result = @$this->dbo->query($query); + } + } + + if ($this->query_result === false) + { + $this->sql_error($query); + } } if (defined('DEBUG')) @@ -213,6 +230,7 @@ class sqlite3 extends \phpbb\db\driver\driver if ($query_id === false) { + /** @var \SQLite3Result $query_id */ $query_id = $this->query_result; } @@ -221,7 +239,7 @@ class sqlite3 extends \phpbb\db\driver\driver return $cache->sql_fetchrow($query_id); } - return is_object($query_id) ? $query_id->fetchArray(SQLITE3_ASSOC) : false; + return is_object($query_id) ? @$query_id->fetchArray(SQLITE3_ASSOC) : false; } /** |
