Small sql fixes.

- Remove unused SqlTable.Entry
- Fix wording of two log messages
- Remove unused import
This commit is contained in:
Ryan Roden-Corrent 2017-06-10 18:41:24 -04:00
parent f4f52ee204
commit e436f48164
2 changed files with 3 additions and 6 deletions

View File

@ -25,7 +25,7 @@ import time
from PyQt5.QtCore import pyqtSlot, QUrl, QTimer from PyQt5.QtCore import pyqtSlot, QUrl, QTimer
from qutebrowser.commands import cmdutils, cmdexc from qutebrowser.commands import cmdutils, cmdexc
from qutebrowser.utils import (utils, objreg, log, qtutils, usertypes, message, from qutebrowser.utils import (utils, objreg, log, usertypes, message,
debug, standarddir) debug, standarddir)
from qutebrowser.misc import objects, sql from qutebrowser.misc import objects, sql
@ -257,7 +257,7 @@ class WebHistory(sql.SqlTable):
f.write('\n'.join(lines)) f.write('\n'.join(lines))
except OSError as e: except OSError as e:
raise cmdexc.CommandError('Could not write history: {}', e) raise cmdexc.CommandError('Could not write history: {}', e)
message.info("Dumped history to {}.".format(dest)) message.info("Dumped history to {}".format(dest))
def init(parent=None): def init(parent=None):

View File

@ -89,7 +89,7 @@ class Query(QSqlQuery):
log.sql.debug('Running SQL query: "{}"'.format(self.lastQuery())) log.sql.debug('Running SQL query: "{}"'.format(self.lastQuery()))
for key, val in values.items(): for key, val in values.items():
self.bindValue(':{}'.format(key), val) self.bindValue(':{}'.format(key), val)
log.sql.debug('self bindings: {}'.format(self.boundValues())) log.sql.debug('query bindings: {}'.format(self.boundValues()))
if not self.exec_(): if not self.exec_():
raise SqlException('Failed to exec query "{}": "{}"'.format( raise SqlException('Failed to exec query "{}": "{}"'.format(
self.lastQuery(), self.lastError().text())) self.lastQuery(), self.lastError().text()))
@ -107,7 +107,6 @@ class SqlTable(QObject):
"""Interface to a sql table. """Interface to a sql table.
Attributes: Attributes:
Entry: The class wrapping row data from this table.
_name: Name of the SQL table this wraps. _name: Name of the SQL table this wraps.
Signals: Signals:
@ -136,8 +135,6 @@ class SqlTable(QObject):
.format(name, ','.join(column_defs))) .format(name, ','.join(column_defs)))
q.run() q.run()
# pylint: disable=invalid-name
self.Entry = collections.namedtuple(name + '_Entry', fields)
def create_index(self, name, field): def create_index(self, name, field):
"""Create an index over this table. """Create an index over this table.