mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
- rewrite sqlite3 table_exists() to avoid error in PHP 8
This commit is contained in:
parent
a2af3e7f77
commit
858aea023d
1 changed files with 9 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue