grr/server/grr_response_server/databases/mysql_artifacts.py
def WriteArtifact(self, artifact, cursor=None):
    """Writes new artifact to the database."""
    name = str(artifact.name)

    try:
      cursor.execute(
          "INSERT INTO artifacts (name_hash, definition) VALUES (%s, %s)",
          [mysql_utils.Hash(name),
           artifact.SerializeToString()])
    except MySQLdb.IntegrityError as error:
      if error.args[0] == mysql_error_constants.DUP_ENTRY:
        raise db.DuplicatedArtifactError(name, cause=error)
      else:
        raise
Writes new artifact to the database.
Writes new artifact to the database.
Writes new artifact to the database .
def WriteArtifact(self, artifact, cursor=None):
    name = str(artifact.name)
    try:
      cursor.execute(
          "INSERT INTO artifacts (name_hash, definition) VALUES (%s, %s)",
          [mysql_utils.Hash(name),
           artifact.SerializeToString()])
    except MySQLdb.IntegrityError as error:
      if error.args[0] == mysql_error_constants.DUP_ENTRY:
        raise db.DuplicatedArtifactError(name, cause=error)
      else:
        raise
def WriteArtifact ( self , artifact , cursor = None ) : name = str ( artifact . name ) try : cursor . execute ( "INSERT INTO artifacts (name_hash, definition) VALUES (%s, %s)" , [ mysql_utils . Hash ( name ) , artifact . SerializeToString ( ) ] ) except MySQLdb . IntegrityError as error : if error . args [ 0 ] == mysql_error_constants . DUP_ENTRY : raise db . DuplicatedArtifactError ( name , cause = error ) else : raise
Writes new artifact to the database.
Writes new artifact to the database .
"""Writes new artifact to the database."""
self
artifact
cursor