server/sources/extlite.py
branchstable
changeset 2062 20f18837107c
parent 2053 fb156d69bfd9
child 2067 668cc93f8578
--- a/server/sources/extlite.py	Mon Jun 08 18:32:23 2009 +0200
+++ b/server/sources/extlite.py	Mon Jun 08 20:34:28 2009 +0200
@@ -214,6 +214,22 @@
         sql = self.sqladapter.sqlgen.delete(SQL_PREFIX + etype, attrs)
         sqlcursor.execute(sql, attrs)
 
+    def local_add_relation(self, session, subject, rtype, object):
+        """add a relation to the source
+
+        This is not provided as add_relation implementation since usually
+        source don't want to simply do this, so let raise NotImplementedError
+        and the source implementor may use this method if necessary
+        """
+        sqlcursor = session.pool[self.uri]
+        attrs = {'eid_from': subject, 'eid_to': object}
+        sql = self.sqladapter.sqlgen.insert('%s_relation' % rtype, attrs)
+        sqlcursor.execute(sql, attrs)
+
+    def add_relation(self, session, subject, rtype, object):
+        """add a relation to the source"""
+        raise NotImplementedError()
+
     def delete_relation(self, session, subject, rtype, object):
         """delete a relation from the source"""
         rschema = self.schema.rschema(rtype)