grr/server/grr_response_server/databases/mysql_flows.py
def _WriteFlowProcessingRequests(self, requests, cursor):
    """Returns a (query, args) tuple that inserts the given requests."""
    timestamp = rdfvalue.RDFDatetime.Now()
    timestamp_str = mysql_utils.RDFDatetimeToMysqlString(timestamp)

    templates = []
    args = []
    for req in requests:
      templates.append("(%s, %s, %s, %s, %s)")
      req = req.Copy()
      req.timestamp = timestamp
      args.append(mysql_utils.ClientIDToInt(req.client_id))
      args.append(mysql_utils.FlowIDToInt(req.flow_id))
      args.append(timestamp_str)
      args.append(req.SerializeToString())
      if req.delivery_time:
        args.append(mysql_utils.RDFDatetimeToMysqlString(req.delivery_time))
      else:
        args.append(None)

    query = ("INSERT INTO flow_processing_requests "
             "(client_id, flow_id, timestamp, request, delivery_time) VALUES ")
    query += ", ".join(templates)
    cursor.execute(query, args)
Returns a (query, args) tuple that inserts the given requests.
Returns a (query, args) tuple that inserts the given requests.
Returns a ( query args ) tuple that inserts the given requests .
def _WriteFlowProcessingRequests(self, requests, cursor):
    timestamp = rdfvalue.RDFDatetime.Now()
    timestamp_str = mysql_utils.RDFDatetimeToMysqlString(timestamp)
    templates = []
    args = []
    for req in requests:
      templates.append("(%s, %s, %s, %s, %s)")
      req = req.Copy()
      req.timestamp = timestamp
      args.append(mysql_utils.ClientIDToInt(req.client_id))
      args.append(mysql_utils.FlowIDToInt(req.flow_id))
      args.append(timestamp_str)
      args.append(req.SerializeToString())
      if req.delivery_time:
        args.append(mysql_utils.RDFDatetimeToMysqlString(req.delivery_time))
      else:
        args.append(None)
    query = ("INSERT INTO flow_processing_requests "
             "(client_id, flow_id, timestamp, request, delivery_time) VALUES ")
    query += ", ".join(templates)
    cursor.execute(query, args)
def _WriteFlowProcessingRequests ( self , requests , cursor ) : timestamp = rdfvalue . RDFDatetime . Now ( ) timestamp_str = mysql_utils . RDFDatetimeToMysqlString ( timestamp ) templates = [ ] args = [ ] for req in requests : templates . append ( "(%s, %s, %s, %s, %s)" ) req = req . Copy ( ) req . timestamp = timestamp args . append ( mysql_utils . ClientIDToInt ( req . client_id ) ) args . append ( mysql_utils . FlowIDToInt ( req . flow_id ) ) args . append ( timestamp_str ) args . append ( req . SerializeToString ( ) ) if req . delivery_time : args . append ( mysql_utils . RDFDatetimeToMysqlString ( req . delivery_time ) ) else : args . append ( None ) query = ( "INSERT INTO flow_processing_requests " "(client_id, flow_id, timestamp, request, delivery_time) VALUES " ) query += ", " . join ( templates ) cursor . execute ( query , args )
Returns a (query, args) tuple that inserts the given requests.
Returns a ( query args ) tuple that inserts the given requests .
"""Returns a (query, args) tuple that inserts the given requests."""
self
requests
cursor