mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 19:50:31 -07:00
Improve code and coverage
This commit is contained in:
parent
5c9e05b026
commit
8ff33bd729
2 changed files with 3 additions and 6 deletions
|
@ -248,14 +248,11 @@ executed_queries = []
|
||||||
|
|
||||||
def uses_replica_terminology(cursor):
|
def uses_replica_terminology(cursor):
|
||||||
"""Checks if REPLICA must be used instead of SLAVE"""
|
"""Checks if REPLICA must be used instead of SLAVE"""
|
||||||
cursor.execute("SELECT VERSION()")
|
cursor.execute("SELECT VERSION() AS version")
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
|
|
||||||
if isinstance(result, dict):
|
if isinstance(result, dict):
|
||||||
if 'VERSION()' in result:
|
version_str = result['version']
|
||||||
version_str = result['VERSION()']
|
|
||||||
else:
|
|
||||||
version_str = result['version()']
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
version_str = result[0]
|
version_str = result[0]
|
||||||
|
|
|
@ -19,7 +19,7 @@ class dummy_cursor_class():
|
||||||
|
|
||||||
def fetchone(self):
|
def fetchone(self):
|
||||||
if self.ret_val_type == 'dict':
|
if self.ret_val_type == 'dict':
|
||||||
return {'VERSION()': self.output}
|
return {'version': self.output}
|
||||||
|
|
||||||
elif self.ret_val_type == 'list':
|
elif self.ret_val_type == 'list':
|
||||||
return [self.output]
|
return [self.output]
|
||||||
|
|
Loading…
Add table
Reference in a new issue