Пример #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)