예제 #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)
예제 #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()
예제 #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 = %s",
                       [name])

        row = cursor.fetchone()
        if row is None:
            raise db.UnknownArtifactError(name)
        else:
            return _RowToArtifact(row)
예제 #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)