Exemple #1
0
    def DeleteArtifact(self, name, cursor=None):
        """Deletes an artifact with given name from the database."""

        cursor.execute("DELETE FROM artifacts WHERE name = %s", [name])

        if cursor.rowcount == 0:
            raise db.UnknownArtifactError(name)
Exemple #2
0
  def ReadArtifact(self, name):
    """Looks up an artifact with given name from the database."""
    try:
      artifact = self.artifacts[name]
    except KeyError:
      raise db.UnknownArtifactError(name)

    return artifact.Copy()
Exemple #3
0
    def ReadArtifact(self, name, cursor=None):
        """Looks up an artifact with given name from the database."""
        cursor.execute("SELECT definition FROM artifacts WHERE name_hash = %s",
                       [mysql_utils.Hash(name)])

        row = cursor.fetchone()
        if row is None:
            raise db.UnknownArtifactError(name)
        else:
            return _RowToArtifact(row)
Exemple #4
0
 def DeleteArtifact(self, name):
   """Deletes an artifact with given name from the database."""
   try:
     del self.artifacts[name]
   except KeyError:
     raise db.UnknownArtifactError(name)