def version(**connection_args):
    '''
    Return the version of a MySQL server using the output from the ``SELECT
    VERSION()`` query.

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.version
    '''
    dbc = _connect(**connection_args)
    if dbc is None:
        return ''
    cur = dbc.cursor()
    qry = 'SELECT VERSION()'
    try:
        _execute(cur, qry)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return ''

    try:
        return salt.utils.data.decode(cur.fetchone()[0])
    except IndexError:
        return ''
def version ( ** connection_args ) : dbc = _connect ( ** connection_args ) if dbc is None : return '' cur = dbc . cursor ( ) qry = 'SELECT VERSION()' try : _execute ( cur , qry ) except MySQLdb . OperationalError as exc : err = 'MySQL Error {0}: {1}' . format ( * exc . args ) __context__ [ 'mysql.error' ] = err log . error ( err ) return '' try : return salt . utils . data . decode ( cur . fetchone ( ) [ 0 ] ) except IndexError : return ''
Return the version of a MySQL server using the output from the ``SELECT
    VERSION()`` query.

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.version