Skip to content

Commit e0d06ee

Browse files
marc1706CHItA
authored andcommitted
[ticket/14044] Fix Sqlite error in tests
PHPBB3-14044
1 parent 597297b commit e0d06ee

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

phpBB/phpbb/db/driver/sqlite3.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,19 @@ public function sql_query($query = '', $cache_ttl = 0)
136136
{
137137
if (($this->query_result = @$this->dbo->query($query)) === false)
138138
{
139-
$this->sql_error($query);
139+
// Try to recover a lost database connection
140+
if ($this->dbo && !@$this->dbo->lastErrorMsg())
141+
{
142+
if ($this->sql_connect($this->server, $this->user, '', $this->dbname))
143+
{
144+
$this->query_result = @$this->dbo->query($query);
145+
}
146+
}
147+
148+
if ($this->query_result === false)
149+
{
150+
$this->sql_error($query);
151+
}
140152
}
141153

142154
if (defined('DEBUG'))

phpBB/phpbb/search/fulltext_native.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,10 +1478,7 @@ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_
14781478
$this->db->sql_return_on_error(false);
14791479
}
14801480
unset($new_words, $sql_ary);
1481-
}
1482-
else
1483-
{
1484-
$this->db->sql_transaction('begin');
1481+
$this->db->sql_transaction('commit');
14851482
}
14861483

14871484
// now update the search match table, remove links to removed words and add links to new words
@@ -1513,6 +1510,11 @@ public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_
15131510
}
15141511
}
15151512

1513+
if (!count($unique_add_words))
1514+
{
1515+
$this->db->sql_transaction('begin');
1516+
}
1517+
15161518
$this->db->sql_return_on_error(true);
15171519
foreach ($words['add'] as $word_in => $word_ary)
15181520
{

0 commit comments

Comments
 (0)