Loading transfer_service/db_connector.py +20 −3 Original line number Diff line number Diff line Loading @@ -427,10 +427,27 @@ class DbConnector(object): def deleteStorage(self, storageId): """Deletes a storage point.""" if self.conn: self.cursor.execute(""" SELECT count(*) > 0 AS res FROM Node WHERE location_id IN (SELECT location_id FROM storage s JOIN location l ON s.storage_id = l.storage_src_id WHERE storage_src_id = %s); """, (storageId,)) if self.cursor.fetchall()[0]["res"]: return False else: self.cursor.execute(""" DELETE FROM storage WHERE storage_id = %s; """, (storageId,)) self.conn.commit() return True Loading
transfer_service/db_connector.py +20 −3 Original line number Diff line number Diff line Loading @@ -427,10 +427,27 @@ class DbConnector(object): def deleteStorage(self, storageId): """Deletes a storage point.""" if self.conn: self.cursor.execute(""" SELECT count(*) > 0 AS res FROM Node WHERE location_id IN (SELECT location_id FROM storage s JOIN location l ON s.storage_id = l.storage_src_id WHERE storage_src_id = %s); """, (storageId,)) if self.cursor.fetchall()[0]["res"]: return False else: self.cursor.execute(""" DELETE FROM storage WHERE storage_id = %s; """, (storageId,)) self.conn.commit() return True