add placeholders of table name for sqls

This commit is contained in:
printempw 2016-08-25 13:25:55 +08:00
parent cece50e1a3
commit 4de91cc543

View File

@ -70,9 +70,13 @@ class Database
public function query($sql)
{
// compile patterns
$sql = str_replace('{table}', $this->table_name, $sql);
$result = $this->connection->query($sql);
if ($this->connection->error)
throw new E("Database query error: ".$this->connection->error.", Statement: ".$sql, -1);
return $result;
}