Simplified MySQL storage engine detection using INFORMATION_SCHEMA.ENGINES table
Query the table introduced in MySQL 5.1; refs #23144.
This commit is contained in:
parent
b748a8bc67
commit
88b2a20f04
|
@ -194,15 +194,9 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
||||||
def _mysql_storage_engine(self):
|
def _mysql_storage_engine(self):
|
||||||
"Internal method used in Django tests. Don't rely on this from your code"
|
"Internal method used in Django tests. Don't rely on this from your code"
|
||||||
with self.connection.cursor() as cursor:
|
with self.connection.cursor() as cursor:
|
||||||
cursor.execute('CREATE TABLE INTROSPECT_TEST (X INT)')
|
cursor.execute("SELECT ENGINE FROM INFORMATION_SCHEMA.ENGINES WHERE SUPPORT = 'DEFAULT'")
|
||||||
# This command is MySQL specific; the second column
|
|
||||||
# will tell you the default table type of the created
|
|
||||||
# table. Since all Django's test tables will have the same
|
|
||||||
# table type, that's enough to evaluate the feature.
|
|
||||||
cursor.execute("SHOW TABLE STATUS WHERE Name='INTROSPECT_TEST'")
|
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
cursor.execute('DROP TABLE INTROSPECT_TEST')
|
return result[0]
|
||||||
return result[1]
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def can_introspect_foreign_keys(self):
|
def can_introspect_foreign_keys(self):
|
||||||
|
|
Loading…
Reference in New Issue