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,7 +42,7 @@ def get_sequences(itemId):
v = ', '.join([isinstance(v, basestring) and "'%s'"%v or str(v)
for v in sequence.values()])
values.append('(%s)'%v)
if values:
cursor = connection.cursor()
sql = "INSERT INTO sequence_sequence (%s) VALUES %s" % (keys, ', '.join(values));
cursor.execute(sql)