grr/server/grr_response_server/databases/mysql_clients.py
def MultiReadClientLabels(self, client_ids, cursor=None):
    """Reads the user labels for a list of clients."""

    int_ids = [mysql_utils.ClientIDToInt(cid) for cid in client_ids]
    query = ("SELECT client_id, owner_username, label "
             "FROM client_labels "
             "WHERE client_id IN ({})").format(", ".join(
                 ["%s"] * len(client_ids)))

    ret = {client_id: [] for client_id in client_ids}
    cursor.execute(query, int_ids)
    for client_id, owner, label in cursor.fetchall():
      ret[mysql_utils.IntToClientID(client_id)].append(
          rdf_objects.ClientLabel(name=label, owner=owner))

    for r in itervalues(ret):
      r.sort(key=lambda label: (label.owner, label.name))
    return ret
Reads the user labels for a list of clients.
Reads the user labels for a list of clients.
Reads the user labels for a list of clients .
def MultiReadClientLabels(self, client_ids, cursor=None):
    int_ids = [mysql_utils.ClientIDToInt(cid) for cid in client_ids]
    query = ("SELECT client_id, owner_username, label "
             "FROM client_labels "
             "WHERE client_id IN ({})").format(", ".join(
                 ["%s"] * len(client_ids)))
    ret = {client_id: [] for client_id in client_ids}
    cursor.execute(query, int_ids)
    for client_id, owner, label in cursor.fetchall():
      ret[mysql_utils.IntToClientID(client_id)].append(
          rdf_objects.ClientLabel(name=label, owner=owner))
    for r in itervalues(ret):
      r.sort(key=lambda label: (label.owner, label.name))
    return ret
def MultiReadClientLabels ( self , client_ids , cursor = None ) : int_ids = [ mysql_utils . ClientIDToInt ( cid ) for cid in client_ids ] query = ( "SELECT client_id, owner_username, label " "FROM client_labels " "WHERE client_id IN ({})" ) . format ( ", " . join ( [ "%s" ] * len ( client_ids ) ) ) ret = { client_id : [ ] for client_id in client_ids } cursor . execute ( query , int_ids ) for client_id , owner , label in cursor . fetchall ( ) : ret [ mysql_utils . IntToClientID ( client_id ) ] . append ( rdf_objects . ClientLabel ( name = label , owner = owner ) ) for r in itervalues ( ret ) : r . sort ( key = lambda label : ( label . owner , label . name ) ) return ret
Reads the user labels for a list of clients.
Reads the user labels for a list of clients .
"""Reads the user labels for a list of clients."""
self
client_ids
cursor