summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/mysql/base.py')
-rw-r--r--django/db/backends/mysql/base.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index f9908dbcb5..08632a0ec5 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -51,10 +51,10 @@ server_version_re = re.compile(r'(\d{1,2})\.(\d{1,2})\.(\d{1,2})')
class CursorWrapper:
"""
- A thin wrapper around MySQLdb's normal cursor class so that we can catch
- particular exception instances and reraise them with the right types.
+ A thin wrapper around MySQLdb's normal cursor class that catches particular
+ exception instances and reraises them with the correct types.
- Implemented as a wrapper, rather than a subclass, so that we aren't stuck
+ Implemented as a wrapper, rather than a subclass, so that it isn't stuck
to the particular underlying representation returned by Connection.cursor().
"""
codes_for_integrityerror = (1048,)
@@ -269,8 +269,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def disable_constraint_checking(self):
"""
- Disables foreign key checks, primarily for use in adding rows with forward references. Always returns True,
- to indicate constraint checks need to be re-enabled.
+ Disable foreign key checks, primarily for use in adding rows with
+ forward references. Always return True to indicate constraint checks
+ need to be re-enabled.
"""
self.cursor().execute('SET foreign_key_checks=0')
return True
@@ -289,14 +290,14 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def check_constraints(self, table_names=None):
"""
- Checks each table name in `table_names` for rows with invalid foreign
+ Check each table name in `table_names` for rows with invalid foreign
key references. This method is intended to be used in conjunction with
`disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with invalid references were entered while constraint
checks were off.
- Raises an IntegrityError on the first invalid foreign key reference
- encountered (if any) and provides detailed information about the
+ Raise an IntegrityError on the first invalid foreign key reference
+ encountered (if any) and provide detailed information about the
invalid reference in the error message.
Backends can override this method if they can more directly apply