aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/db/driver/sqlite3.php10
-rw-r--r--phpBB/phpbb/search/fulltext_native.php10
2 files changed, 12 insertions, 8 deletions
diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php
index 2000acb251..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,6 +134,11 @@ 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)
{
// Try to recover a lost database connection
@@ -225,6 +230,7 @@ class sqlite3 extends \phpbb\db\driver\driver
if ($query_id === false)
{
+ /** @var \SQLite3Result $query_id */
$query_id = $this->query_result;
}
@@ -233,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;
}
/**
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 516316dc54..3a74955a18 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -1478,7 +1478,10 @@ class fulltext_native extends \phpbb\search\base
$this->db->sql_return_on_error(false);
}
unset($new_words, $sql_ary);
- $this->db->sql_transaction('commit');
+ }
+ else
+ {
+ $this->db->sql_transaction('begin');
}
// now update the search match table, remove links to removed words and add links to new words
@@ -1510,11 +1513,6 @@ class fulltext_native extends \phpbb\search\base
}
}
- if (empty($unique_add_words))
- {
- $this->db->sql_transaction('begin');
- }
-
$this->db->sql_return_on_error(true);
foreach ($words['add'] as $word_in => $word_ary)
{