def execute_sql(cursor, sql_string, parameters=None):
    """Executes a given SQL string on an SQL cursor.
    """
    try:
        cursor.execute(sql_string, parameters)
    except Exception:
        print('sql_string:\n    {}\nparameters:\n    {}'.format(sql_string,
            parameters))
        raise
    data = []
    while True:
        row = cursor.fetchone()
        if row is None:
            break
        else:
            data.append(row)
    return data
