public function query($sql) { if (stripos($sql, 'select') !== false) { $this->lastSql = $sql; } else { $this->lastSql = null; } if (!($this->result = $this->connection->query($sql))) { $this->showError(); } }