grr/server/grr_response_server/databases/mysql_flows.py
def UpdateFlow(self,
                 client_id,
                 flow_id,
                 flow_obj=db.Database.unchanged,
                 client_crash_info=db.Database.unchanged,
                 pending_termination=db.Database.unchanged,
                 processing_on=db.Database.unchanged,
                 processing_since=db.Database.unchanged,
                 processing_deadline=db.Database.unchanged,
                 cursor=None):
    """Updates flow objects in the database."""
    updates = []
    args = []
    if flow_obj != db.Database.unchanged:
      updates.append("flow=%s")
      args.append(flow_obj.SerializeToString())
    if client_crash_info != db.Database.unchanged:
      updates.append("client_crash_info=%s")
      args.append(client_crash_info.SerializeToString())
    if pending_termination != db.Database.unchanged:
      updates.append("pending_termination=%s")
      args.append(pending_termination.SerializeToString())
    if processing_on != db.Database.unchanged:
      updates.append("processing_on=%s")
      args.append(processing_on)
    if processing_since != db.Database.unchanged:
      updates.append("processing_since=%s")
      args.append(mysql_utils.RDFDatetimeToMysqlString(processing_since))
    if processing_deadline != db.Database.unchanged:
      updates.append("processing_deadline=%s")
      args.append(mysql_utils.RDFDatetimeToMysqlString(processing_deadline))

    if not updates:
      return

    query = "UPDATE flows SET "
    query += ", ".join(updates)
    query += " WHERE client_id=%s AND flow_id=%s"

    args.append(mysql_utils.ClientIDToInt(client_id))
    args.append(mysql_utils.FlowIDToInt(flow_id))
    updated = cursor.execute(query, args)
    if updated == 0:
      raise db.UnknownFlowError(client_id, flow_id)
Updates flow objects in the database.
Updates flow objects in the database.
Updates flow objects in the database .
def UpdateFlow(self,
                 client_id,
                 flow_id,
                 flow_obj=db.Database.unchanged,
                 client_crash_info=db.Database.unchanged,
                 pending_termination=db.Database.unchanged,
                 processing_on=db.Database.unchanged,
                 processing_since=db.Database.unchanged,
                 processing_deadline=db.Database.unchanged,
                 cursor=None):
    updates = []
    args = []
    if flow_obj != db.Database.unchanged:
      updates.append("flow=%s")
      args.append(flow_obj.SerializeToString())
    if client_crash_info != db.Database.unchanged:
      updates.append("client_crash_info=%s")
      args.append(client_crash_info.SerializeToString())
    if pending_termination != db.Database.unchanged:
      updates.append("pending_termination=%s")
      args.append(pending_termination.SerializeToString())
    if processing_on != db.Database.unchanged:
      updates.append("processing_on=%s")
      args.append(processing_on)
    if processing_since != db.Database.unchanged:
      updates.append("processing_since=%s")
      args.append(mysql_utils.RDFDatetimeToMysqlString(processing_since))
    if processing_deadline != db.Database.unchanged:
      updates.append("processing_deadline=%s")
      args.append(mysql_utils.RDFDatetimeToMysqlString(processing_deadline))
    if not updates:
      return
    query = "UPDATE flows SET "
    query += ", ".join(updates)
    query += " WHERE client_id=%s AND flow_id=%s"
    args.append(mysql_utils.ClientIDToInt(client_id))
    args.append(mysql_utils.FlowIDToInt(flow_id))
    updated = cursor.execute(query, args)
    if updated == 0:
      raise db.UnknownFlowError(client_id, flow_id)
def UpdateFlow ( self , client_id , flow_id , flow_obj = db . Database . unchanged , client_crash_info = db . Database . unchanged , pending_termination = db . Database . unchanged , processing_on = db . Database . unchanged , processing_since = db . Database . unchanged , processing_deadline = db . Database . unchanged , cursor = None ) : updates = [ ] args = [ ] if flow_obj != db . Database . unchanged : updates . append ( "flow=%s" ) args . append ( flow_obj . SerializeToString ( ) ) if client_crash_info != db . Database . unchanged : updates . append ( "client_crash_info=%s" ) args . append ( client_crash_info . SerializeToString ( ) ) if pending_termination != db . Database . unchanged : updates . append ( "pending_termination=%s" ) args . append ( pending_termination . SerializeToString ( ) ) if processing_on != db . Database . unchanged : updates . append ( "processing_on=%s" ) args . append ( processing_on ) if processing_since != db . Database . unchanged : updates . append ( "processing_since=%s" ) args . append ( mysql_utils . RDFDatetimeToMysqlString ( processing_since ) ) if processing_deadline != db . Database . unchanged : updates . append ( "processing_deadline=%s" ) args . append ( mysql_utils . RDFDatetimeToMysqlString ( processing_deadline ) ) if not updates : return query = "UPDATE flows SET " query += ", " . join ( updates ) query += " WHERE client_id=%s AND flow_id=%s" args . append ( mysql_utils . ClientIDToInt ( client_id ) ) args . append ( mysql_utils . FlowIDToInt ( flow_id ) ) updated = cursor . execute ( query , args ) if updated == 0 : raise db . UnknownFlowError ( client_id , flow_id )
Updates flow objects in the database.
Updates flow objects in the database .
"""Updates flow objects in the database."""
self
client_id
flow_id
flow_obj
client_crash_info
pending_termination
processing_on
processing_since
processing_deadline
cursor