diff --git a/django/core/management/base.py b/django/core/management/base.py
index 4016faa..4afe500 100644
a
|
b
|
class BaseCommand(object):
|
219 | 219 | if output: |
220 | 220 | if self.output_transaction: |
221 | 221 | # This needs to be imported here, because it relies on settings. |
222 | | from django.db import connection |
| 222 | from django.db import connections |
| 223 | connection = connections[options.get('database', DEFAULT_DB_ALIAS)] |
223 | 224 | if connection.ops.start_transaction_sql(): |
224 | 225 | print self.style.SQL_KEYWORD(connection.ops.start_transaction_sql()) |
225 | 226 | print output |
226 | 227 | if self.output_transaction: |
227 | | print self.style.SQL_KEYWORD("COMMIT;") |
| 228 | print self.style.SQL_KEYWORD(connection.ops.end_transaction_sql()) |
228 | 229 | except CommandError, e: |
229 | 230 | sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e))) |
230 | 231 | sys.exit(1) |
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py
index 5918935..a823503 100644
a
|
b
|
class BaseDatabaseOperations(object):
|
352 | 352 | Returns the SQL statement required to start a transaction. |
353 | 353 | """ |
354 | 354 | return "BEGIN;" |
| 355 | |
| 356 | def end_transaction_sql(self, fails=False): |
| 357 | if fails: |
| 358 | return "ROLLBACK;" |
| 359 | return "COMMIT;" |
355 | 360 | |
356 | 361 | def tablespace_sql(self, tablespace, inline=False): |
357 | 362 | """ |