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)
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()
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)
def DeleteArtifact(self, name): """Deletes an artifact with given name from the database.""" try: del self.artifacts[name] except KeyError: raise db.UnknownArtifactError(name)