grr/server/grr_response_server/databases/mysql_flows.py
def ReadClientMessages(self, client_id, cursor=None):
    """Reads all client messages available for a given client_id."""

    query = ("SELECT message, leased_until, leased_by FROM client_messages "
             "WHERE client_id = %s")

    cursor.execute(query, [mysql_utils.ClientIDToInt(client_id)])

    ret = []
    for msg, leased_until, leased_by in cursor.fetchall():
      message = rdf_flows.GrrMessage.FromSerializedString(msg)
      if leased_until:
        message.leased_by = leased_by
        message.leased_until = mysql_utils.MysqlToRDFDatetime(leased_until)
      ret.append(message)

    return sorted(ret, key=lambda msg: msg.task_id)
Reads all client messages available for a given client_id.
Reads all client messages available for a given client_id.
Reads all client messages available for a given client_id .
def ReadClientMessages(self, client_id, cursor=None):
    query = ("SELECT message, leased_until, leased_by FROM client_messages "
             "WHERE client_id = %s")
    cursor.execute(query, [mysql_utils.ClientIDToInt(client_id)])
    ret = []
    for msg, leased_until, leased_by in cursor.fetchall():
      message = rdf_flows.GrrMessage.FromSerializedString(msg)
      if leased_until:
        message.leased_by = leased_by
        message.leased_until = mysql_utils.MysqlToRDFDatetime(leased_until)
      ret.append(message)
    return sorted(ret, key=lambda msg: msg.task_id)
def ReadClientMessages ( self , client_id , cursor = None ) : query = ( "SELECT message, leased_until, leased_by FROM client_messages " "WHERE client_id = %s" ) cursor . execute ( query , [ mysql_utils . ClientIDToInt ( client_id ) ] ) ret = [ ] for msg , leased_until , leased_by in cursor . fetchall ( ) : message = rdf_flows . GrrMessage . FromSerializedString ( msg ) if leased_until : message . leased_by = leased_by message . leased_until = mysql_utils . MysqlToRDFDatetime ( leased_until ) ret . append ( message ) return sorted ( ret , key = lambda msg : msg . task_id )
Reads all client messages available for a given client_id.
Reads all client messages available for a given client_id .
"""Reads all client messages available for a given client_id."""
self
client_id
cursor