cubicweb/server/querier.py
changeset 12882 3ddd03309315
parent 12835 1fd029f11dc4
child 12885 194e9ae964ed
equal deleted inserted replaced
12881:38fcf5707295 12882:3ddd03309315
   632         # in this cache for user queries (which have no args)
   632         # in this cache for user queries (which have no args)
   633         self._ck_cache = {}
   633         self._ck_cache = {}
   634         # some cache usage stats
   634         # some cache usage stats
   635         self.cache_hit, self.cache_miss = 0, 0
   635         self.cache_hit, self.cache_miss = 0, 0
   636         # rql parsing / analysing helper
   636         # rql parsing / analysing helper
   637         self.solutions = repo.vreg.solutions
   637         self.compute_var_types = repo.vreg.compute_var_types
   638         rqlhelper = repo.vreg.rqlhelper
   638         rqlhelper = repo.vreg.rqlhelper
   639         # set backend on the rql helper, will be used for function checking
   639         # set backend on the rql helper, will be used for function checking
   640         rqlhelper.backend = repo.config.system_source_config['db-driver']
   640         rqlhelper.backend = repo.config.system_source_config['db-driver']
   641 
   641 
   642         def parse(rql, annotate=False, parse=rqlhelper.parse):
   642         def parse(rql, annotate=False, parse=rqlhelper.parse):
   675             rqlst = self._parse(rql)
   675             rqlst = self._parse(rql)
   676             # compute solutions for rqlst and return named args in query
   676             # compute solutions for rqlst and return named args in query
   677             # which are eids. Notice that if you may not need `eidkeys`, we
   677             # which are eids. Notice that if you may not need `eidkeys`, we
   678             # have to compute solutions anyway (kept as annotation on the
   678             # have to compute solutions anyway (kept as annotation on the
   679             # tree)
   679             # tree)
   680             eidkeys = self.solutions(cnx, rqlst, args)
   680             eidkeys = self.compute_var_types(cnx, rqlst, args)
   681             if args and rql not in self._ck_cache:
   681             if args and rql not in self._ck_cache:
   682                 self._ck_cache[rql] = eidkeys
   682                 self._ck_cache[rql] = eidkeys
   683                 if eidkeys:
   683                 if eidkeys:
   684                     cachekey = _rql_cache_key(cnx, rql, args, eidkeys)
   684                     cachekey = _rql_cache_key(cnx, rql, args, eidkeys)
   685             self._cache[cachekey] = rqlst
   685             self._cache[cachekey] = rqlst