[optimisation] insert is / is_instance_of using sql stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 15 Oct 2009 20:31:44 +0200
branchstable
changeset 3693 92581287726f
parent 3692 54aa8d13aab4
child 3694 33dbb1da1db9
[optimisation] insert is / is_instance_of using sql
server/hooks.py
--- a/server/hooks.py	Thu Oct 15 20:31:13 2009 +0200
+++ b/server/hooks.py	Thu Oct 15 20:31:44 2009 +0200
@@ -85,16 +85,18 @@
     if hasattr(entity, '_cw_recreating'):
         return
     try:
-        session.add_relation(entity.eid, 'is',
-                             eschema_type_eid(session, entity.id))
+        #session.add_relation(entity.eid, 'is',
+        #                     eschema_type_eid(session, entity.id))
+        session.system_sql('INSERT INTO is_relation(eid_from,eid_to) VALUES (%s,%s)'
+                           % (entity.eid, eschema_type_eid(session, entity.id)))
     except IndexError:
         # during schema serialization, skip
         return
-    # XXX < 2.50 bw compat
-    if not session.get_shared_data('do-not-insert-is_instance_of'):
-        for etype in entity.e_schema.ancestors() + [entity.e_schema]:
-            session.add_relation(entity.eid, 'is_instance_of',
-                                 eschema_type_eid(session, etype))
+    for etype in entity.e_schema.ancestors() + [entity.e_schema]:
+        #session.add_relation(entity.eid, 'is_instance_of',
+        #                     eschema_type_eid(session, etype))
+        session.system_sql('INSERT INTO is_instance_of_relation(eid_from,eid_to) VALUES (%s,%s)'
+                           % (entity.eid, eschema_type_eid(session, etype)))
 
 
 def setowner_after_add_user(session, entity):