only commit if we have data

This commit is contained in:
j 2012-06-17 16:32:28 +02:00
parent 9f4cdb1f63
commit aed67b9e42

View file

@ -42,11 +42,11 @@ def get_sequences(itemId):
v = ', '.join([isinstance(v, basestring) and "'%s'"%v or str(v)
for v in sequence.values()])
values.append('(%s)'%v)
cursor = connection.cursor()
sql = "INSERT INTO sequence_sequence (%s) VALUES %s" % (keys, ', '.join(values));
cursor.execute(sql)
transaction.commit_unless_managed()
if values:
cursor = connection.cursor()
sql = "INSERT INTO sequence_sequence (%s) VALUES %s" % (keys, ', '.join(values));
cursor.execute(sql)
transaction.commit_unless_managed()
@task(ignore_results=True, queue='encoding')
def update_sequence_ids(itemId):