def WriteAPIAuditEntry(self, entry, cursor=None):
    """Writes an audit entry to the database."""
    args = {
        "username":
            entry.username,
        "router_method_name":
            entry.router_method_name,
        "details":
            entry.SerializeToString(),
        "timestamp":
            mysql_utils.RDFDatetimeToTimestamp(rdfvalue.RDFDatetime.Now()),
    }
    query = """
    INSERT INTO api_audit_entry (username, router_method_name, details,
        timestamp)
    VALUES (%(username)s, %(router_method_name)s, %(details)s,
        FROM_UNIXTIME(%(timestamp)s))
    """
    cursor.execute(query, args)
def WriteAPIAuditEntry ( self , entry , cursor = None ) : args = { "username" : entry . username , "router_method_name" : entry . router_method_name , "details" : entry . SerializeToString ( ) , "timestamp" : mysql_utils . RDFDatetimeToTimestamp ( rdfvalue . RDFDatetime . Now ( ) ) , } query = """
    INSERT INTO api_audit_entry (username, router_method_name, details,
        timestamp)
    VALUES (%(username)s, %(router_method_name)s, %(details)s,
        FROM_UNIXTIME(%(timestamp)s))
    """ cursor . execute ( query , args )
Writes an audit entry to the database.