- rewrite sqlite3 table_exists() to avoid error in PHP 8

This commit is contained in:
Max Pozdeev 2021-06-27 15:44:21 +03:00
parent a2af3e7f77
commit 858aea023d

View file

@ -152,10 +152,15 @@ class Database_Sqlite3
function table_exists($table)
{
$table = $this->dbh->quote($table);
$q = $this->dbh->query("SELECT 1 FROM $table WHERE 1=0");
if($q === false) return false;
else return true;
$exists = $this->sq("SELECT 1 FROM sqlite_master WHERE type='table' AND name=?", $table);
if ($exists == "1") {
return true;
}
$exists = $this->sq("SELECT 1 FROM sqlite_temp_master WHERE type='table' AND name=?", $table);
if ($exists == "1") {
return true;
}
return false;
}
}