Remove commit param from PDB.sql_* methods nobody was using.

And is better left to the caller anyway.
This commit is contained in:
voussoir 2018-07-29 16:05:49 -07:00
parent 9328600355
commit 30d96139c2

View file

@ -732,14 +732,11 @@ class PDBSQLMixin:
self.on_commit_queue.append(savepoint_id) self.on_commit_queue.append(savepoint_id)
return savepoint_id return savepoint_id
def sql_delete(self, table, pairs, *, commit=False): def sql_delete(self, table, pairs):
(qmarks, bindings) = sqlhelpers.delete_filler(pairs) (qmarks, bindings) = sqlhelpers.delete_filler(pairs)
query = 'DELETE FROM %s %s' % (table, qmarks) query = 'DELETE FROM %s %s' % (table, qmarks)
self.sql_execute(query, bindings) self.sql_execute(query, bindings)
if commit:
self.commit()
def sql_execute(self, query, bindings=[]): def sql_execute(self, query, bindings=[]):
if bindings is None: if bindings is None:
bindings = [] bindings = []
@ -747,16 +744,13 @@ class PDBSQLMixin:
cur.execute(query, bindings) cur.execute(query, bindings)
return cur return cur
def sql_insert(self, table, data, *, commit=False): def sql_insert(self, table, data):
column_names = constants.SQL_COLUMNS[table] column_names = constants.SQL_COLUMNS[table]
(qmarks, bindings) = sqlhelpers.insert_filler(column_names, data) (qmarks, bindings) = sqlhelpers.insert_filler(column_names, data)
query = 'INSERT INTO %s VALUES(%s)' % (table, qmarks) query = 'INSERT INTO %s VALUES(%s)' % (table, qmarks)
self.sql_execute(query, bindings) self.sql_execute(query, bindings)
if commit:
self.commit()
def sql_select(self, query, bindings=None): def sql_select(self, query, bindings=None):
cur = self.sql_execute(query, bindings) cur = self.sql_execute(query, bindings)
while True: while True:
@ -769,14 +763,11 @@ class PDBSQLMixin:
cur = self.sql_execute(query, bindings) cur = self.sql_execute(query, bindings)
return cur.fetchone() return cur.fetchone()
def sql_update(self, table, pairs, where_key, *, commit=False): def sql_update(self, table, pairs, where_key):
(qmarks, bindings) = sqlhelpers.update_filler(pairs, where_key=where_key) (qmarks, bindings) = sqlhelpers.update_filler(pairs, where_key=where_key)
query = 'UPDATE %s %s' % (table, qmarks) query = 'UPDATE %s %s' % (table, qmarks)
self.sql_execute(query, bindings) self.sql_execute(query, bindings)
if commit:
self.commit()
class PDBTagMixin: class PDBTagMixin:
def __init__(self): def __init__(self):