def db_check(name,
             table=None,
             **connection_args):
    '''
    Repairs the full database or just a given table

    CLI Example:

    .. code-block:: bash

        salt '*' mysql.db_check dbname
        salt '*' mysql.db_check dbname dbtable
    '''
    ret = []
    if table is None:
        # we need to check all tables
        tables = db_tables(name, **connection_args)
        for table in tables:
            log.info('Checking table \'%s\' in db \'%s\'..', name, table)
            ret.append(__check_table(name, table, **connection_args))
    else:
        log.info('Checking table \'%s\' in db \'%s\'..', name, table)
        ret = __check_table(name, table, **connection_args)
    return ret