diff --git a/lib/db.php b/lib/db.php index a3c5940..1dcd1ab 100644 --- a/lib/db.php +++ b/lib/db.php @@ -158,15 +158,9 @@ class Database { */ $this->log->d("Check if table requests exists"); - if ($this->pdo->driver === "PDO_PGSQL") { - $stmt = "SELECT * FROM information_schema.tables WHERE - table_type = 'BASE TABLE' and - table_name = 'requests'"; - } else if ($this->pdo->driver === "PDO_PSQLITE") { - // ungetestet - $stmt = "SELECT 1 FROM sqlite_master WHERE type='table' and - name='requests'"; - } + $stmt = "SELECT * FROM information_schema.tables WHERE + table_type = 'BASE TABLE' and + table_name = 'requests'"; try { $response = $this->pdo->query($stmt); } catch (PDOException $e) { @@ -234,7 +228,7 @@ class Database { $userFound = false; $users = []; $this->log->d("Search for localpart {$nick} in users"); - $query = "SELECT `name` FROM users WHERE `name` = :nick"; + $query = "SELECT name FROM users WHERE name = :nick"; $name = "@" . $nick . ":matrix.kraut.space"; $users = $this->searchUser($query, $name); $count = count($users); @@ -321,7 +315,7 @@ class Database { $this->log->i("Search for IP: {$_SERVER['REMOTE_ADDR']}"); $stmt = $this->pdo->prepare( - "SELECT `time` FROM requests WHERE ip = :ip" + "SELECT time FROM requests WHERE ip = :ip" ); try { $stmt->BindValue(':ip', $ip, PDO::PARAM_LOB);