comparison idavoll/pgsql_backend.py @ 85:ec557449d1aa

Implement node retraction, with storage support for pgsql.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 09 Nov 2004 16:48:20 +0000
parents ec354aab3949
children 59378610b16e
comparison
equal deleted inserted replaced
84:34be83a0bd2e 85:ec557449d1aa
287 print e 287 print e
288 288
289 result = cursor.fetchall() 289 result = cursor.fetchall()
290 return [r[0] for r in result] 290 return [r[0] for r in result]
291 291
292 def remove_items(self, node_id, item_ids):
293 return self.dbpool.runInteraction(self._remove_items, node_id, item_ids)
294
295 def _remove_items(self, cursor, node_id, item_ids):
296 deleted = []
297
298 for item_id in item_ids:
299 cursor.execute("""DELETE FROM items WHERE
300 node_id=(SELECT id FROM nodes WHERE node=%s) AND
301 item=%s""",
302 (node_id.encode('utf-8'),
303 item_id.encode('utf-8')))
304
305 if cursor.rowcount:
306 deleted.append(item_id)
307
308 return deleted
309
292 class BackendService(backend.BackendService): 310 class BackendService(backend.BackendService):
293 """ PostgreSQL backend Service for a JEP-0060 pubsub service """ 311 """ PostgreSQL backend Service for a JEP-0060 pubsub service """
294 312
295 class NodeCreationService(backend.NodeCreationService): 313 class NodeCreationService(backend.NodeCreationService):
296 pass 314 pass
307 class AffiliationsService(backend.AffiliationsService): 325 class AffiliationsService(backend.AffiliationsService):
308 pass 326 pass
309 327
310 class ItemRetrievalService(backend.ItemRetrievalService): 328 class ItemRetrievalService(backend.ItemRetrievalService):
311 pass 329 pass
330
331 class RetractionService(backend.RetractionService):
332 pass