Get all queued entries for a queue and a name.
    If name is None, then find all queue entries

    Return the rows on success (empty list if not found)
    Raise on error

def queuedb_findall(path, queue_id, name=None, offset=None, limit=None):
    """
    Get all queued entries for a queue and a name.
    If name is None, then find all queue entries

    Return the rows on success (empty list if not found)
    Raise on error
    """
    sql = "SELECT * FROM queue WHERE queue_id = ? ORDER BY rowid ASC"
    args = (queue_id,)
    
    if name:
        sql += ' AND name = ?'
        args += (name,)

    if limit:
        sql += ' LIMIT ?'
        args += (limit,)
    
    if offset:
        sql += ' OFFSET ?'
        args += (offset,)

    sql += ';'
    
    db = queuedb_open(path)
    if db is None:
        raise Exception("Failed to open %s" % path)

    cur = db.cursor()
    rows = queuedb_query_execute(cur, sql, args)

    count = 0
    ret = []
    for row in rows:
        dat = {}
        dat.update(row)
        ret.append(dat)

    db.close()
    return ret