mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-18 16:31:26 -07:00
add utils function to get server type (MySQL vs MariaDB)
This commit is contained in:
parent
a7ea11353c
commit
3da5b34006
2 changed files with 8 additions and 0 deletions
|
@ -194,6 +194,13 @@ def mysql_common_argument_spec():
|
|||
)
|
||||
|
||||
|
||||
def get_server_type(cursor):
|
||||
""" Return MySQL or MariaDB after quering the server
|
||||
using SELECT VERSION()"""
|
||||
srv_ver = get_server_version(cursor)
|
||||
return 'mariadb' if 'mariadb' in srv_ver.lower() else "mysql"
|
||||
|
||||
|
||||
def get_server_version(cursor):
|
||||
"""Returns a string representation of the server version."""
|
||||
cursor.execute("SELECT VERSION() AS version")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue