diff --git a/django/core/management/base.py b/django/core/management/base.py
index 4016faa..a07fc7d 100644
a
|
b
|
class BaseCommand(object):
|
218 | 218 | output = self.handle(*args, **options) |
219 | 219 | if output: |
220 | 220 | if self.output_transaction: |
221 | | # This needs to be imported here, because it relies on settings. |
222 | | from django.db import connection |
| 221 | # This needs to be imported here, because it relies on |
| 222 | # settings. |
| 223 | from django.db import connections, DEFAULT_DB_ALIAS |
| 224 | connection = connections[options.get('database', DEFAULT_DB_ALIAS)] |
223 | 225 | if connection.ops.start_transaction_sql(): |
224 | 226 | print self.style.SQL_KEYWORD(connection.ops.start_transaction_sql()) |
225 | 227 | print output |
226 | 228 | if self.output_transaction: |
227 | | print self.style.SQL_KEYWORD("COMMIT;") |
| 229 | print self.style.SQL_KEYWORD(connection.ops.end_transaction_sql()) |
228 | 230 | except CommandError, e: |
229 | 231 | sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e))) |
230 | 232 | 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 | """ |