cubicweb/server/querier.py
changeset 12885 194e9ae964ed
parent 12882 3ddd03309315
child 12886 fa565be41647
equal deleted inserted replaced
12884:9754c40c732a 12885:194e9ae964ed
    34 from cubicweb.rset import ResultSet
    34 from cubicweb.rset import ResultSet
    35 from cubicweb.debug import emit_to_debug_channel
    35 from cubicweb.debug import emit_to_debug_channel
    36 
    36 
    37 from cubicweb.utils import QueryCache, RepeatList
    37 from cubicweb.utils import QueryCache, RepeatList
    38 from cubicweb.misc.source_highlight import highlight_terminal
    38 from cubicweb.misc.source_highlight import highlight_terminal
    39 from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata
    39 from cubicweb.server.rqlannotation import RQLAnnotator, set_qdata
    40 from cubicweb.server.ssplanner import (READ_ONLY_RTYPES, add_types_restriction,
    40 from cubicweb.server.ssplanner import (READ_ONLY_RTYPES, add_types_restriction,
    41                                        SSPlanner)
    41                                        SSPlanner)
    42 from cubicweb.server.edition import EditedEntity
    42 from cubicweb.server.edition import EditedEntity
    43 from cubicweb.statsd_logger import statsd_timeit, statsd_c
    43 from cubicweb.statsd_logger import statsd_timeit, statsd_c
    44 
    44 
   214                     self.cnx.transaction_data[key] = (union, self.args)
   214                     self.cnx.transaction_data[key] = (union, self.args)
   215         else:
   215         else:
   216             noinvariant = ()
   216             noinvariant = ()
   217         if cached is None:
   217         if cached is None:
   218             self.rqlhelper.simplify(union)
   218             self.rqlhelper.simplify(union)
   219             self.querier.sqlgen_annotate(union)
   219             self.querier.rqlannotator.annotate(union)
   220             set_qdata(self.schema.rschema, union, noinvariant)
   220             set_qdata(self.schema.rschema, union, noinvariant)
   221         if union.has_text_query:
   221         if union.has_text_query:
   222             self.cache_key = None
   222             self.cache_key = None
   223 
   223 
   224     def _insert_security(self, union):
   224     def _insert_security(self, union):
   479         self.schema = schema
   479         self.schema = schema
   480         self.clear_caches()
   480         self.clear_caches()
   481         # rql planner
   481         # rql planner
   482         self._planner = SSPlanner(schema, self._repo.vreg.rqlhelper)
   482         self._planner = SSPlanner(schema, self._repo.vreg.rqlhelper)
   483         # sql generation annotator
   483         # sql generation annotator
   484         self.sqlgen_annotate = SQLGenAnnotator(schema).annotate
   484         self.rqlannotator = RQLAnnotator(schema)
   485 
   485 
   486     def clear_caches(self, eids=None, etypes=None):
   486     def clear_caches(self, eids=None, etypes=None):
   487         if eids is None:
   487         if eids is None:
   488             self.rql_cache = RQLCache(self._repo, self.schema)
   488             self.rql_cache = RQLCache(self._repo, self.schema)
   489         else:
   489         else: