diff options
author | Adam Johnson <me@adamj.eu> | 2020-06-20 18:17:22 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-22 09:58:46 +0200 |
commit | e37f80961884c686802a5822ce09f24d8a27920f (patch) | |
tree | fc4e526878de7aa40c95546e9d8c17dc1e687e27 /django/db/backends/mysql/features.py | |
parent | e62d55a4fe6555d18eebda638de402447618b500 (diff) | |
download | django-e37f80961884c686802a5822ce09f24d8a27920f.tar.gz |
Combined MySQL backend server info queries.
Diffstat (limited to 'django/db/backends/mysql/features.py')
-rw-r--r-- | django/db/backends/mysql/features.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/django/db/backends/mysql/features.py b/django/db/backends/mysql/features.py index 85017012b1..b8aed23207 100644 --- a/django/db/backends/mysql/features.py +++ b/django/db/backends/mysql/features.py @@ -50,10 +50,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def _mysql_storage_engine(self): "Internal method used in Django tests. Don't rely on this from your code" - with self.connection.cursor() as cursor: - cursor.execute("SELECT ENGINE FROM INFORMATION_SCHEMA.ENGINES WHERE SUPPORT = 'DEFAULT'") - result = cursor.fetchone() - return result[0] + return self.connection.mysql_server_data['default_storage_engine'] @cached_property def update_can_self_select(self): @@ -82,18 +79,11 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def has_zoneinfo_database(self): - # Test if the time zone definitions are installed. CONVERT_TZ returns - # NULL if 'UTC' timezone isn't loaded into the mysql.time_zone. - with self.connection.cursor() as cursor: - cursor.execute("SELECT CONVERT_TZ('2001-01-01 01:00:00', 'UTC', 'UTC')") - return cursor.fetchone()[0] is not None + return self.connection.mysql_server_data['has_zoneinfo_database'] @cached_property def is_sql_auto_is_null_enabled(self): - with self.connection.cursor() as cursor: - cursor.execute('SELECT @@SQL_AUTO_IS_NULL') - result = cursor.fetchone() - return result and result[0] == 1 + return self.connection.mysql_server_data['sql_auto_is_null'] @cached_property def supports_over_clause(self): @@ -150,10 +140,7 @@ class DatabaseFeatures(BaseDatabaseFeatures): @cached_property def ignores_table_name_case(self): - with self.connection.cursor() as cursor: - cursor.execute('SELECT @@LOWER_CASE_TABLE_NAMES') - result = cursor.fetchone() - return result and result[0] != 0 + return self.connection.mysql_server_data['lower_case_table_names'] @cached_property def supports_default_in_lead_lag(self): |