cubicweb/server/sources/native.py
changeset 12756 d91c229de97f
parent 12739 c6f8ca03718f
child 12758 db95a417a5ec
equal deleted inserted replaced
12755:7df6c6048bc8 12756:d91c229de97f
   497                 return authentifier.authenticate(cnx, login, **kwargs)
   497                 return authentifier.authenticate(cnx, login, **kwargs)
   498             except AuthenticationError:
   498             except AuthenticationError:
   499                 continue
   499                 continue
   500         raise AuthenticationError()
   500         raise AuthenticationError()
   501 
   501 
   502     def syntax_tree_search(self, cnx, union, args=None, cachekey=None):
   502     def syntax_tree_search(self, cnx, union, args=None, cachekey=None, rql_query_tracing_token=None):
   503         """return result from this source for a rql query (actually from
   503         """return result from this source for a rql query (actually from
   504         a rql syntax tree and a solution dictionary mapping each used
   504         a rql syntax tree and a solution dictionary mapping each used
   505         variable to a possible type). If cachekey is given, the query
   505         variable to a possible type). If cachekey is given, the query
   506         necessary to fetch the results (but not the results themselves)
   506         necessary to fetch the results (but not the results themselves)
   507         may be cached using this key.
   507         may be cached using this key.
   521                 self.cache_miss += 1
   521                 self.cache_miss += 1
   522                 sql, qargs, cbs = self._rql_sqlgen.generate(union, args)
   522                 sql, qargs, cbs = self._rql_sqlgen.generate(union, args)
   523                 self._cache[cachekey] = sql, qargs, cbs
   523                 self._cache[cachekey] = sql, qargs, cbs
   524         args = self.merge_args(args, qargs)
   524         args = self.merge_args(args, qargs)
   525         assert isinstance(sql, str), repr(sql)
   525         assert isinstance(sql, str), repr(sql)
   526         cursor = cnx.system_sql(sql, args)
   526         cursor = cnx.system_sql(sql, args, rql_query_tracing_token=rql_query_tracing_token)
   527         results = self.process_result(cursor, cnx, cbs)
   527         results = self.process_result(cursor, cnx, cbs)
   528         assert dbg_results(results)
   528         assert dbg_results(results)
   529         return results
   529         return results
   530 
   530 
   531     @contextmanager
   531     @contextmanager
   678             attrs = {'eid_from': subject, 'eid_to': object}
   678             attrs = {'eid_from': subject, 'eid_to': object}
   679             sql = self.sqlgen.delete('%s_relation' % rtype, attrs)
   679             sql = self.sqlgen.delete('%s_relation' % rtype, attrs)
   680         self.doexec(cnx, sql, attrs)
   680         self.doexec(cnx, sql, attrs)
   681 
   681 
   682     @statsd_timeit
   682     @statsd_timeit
   683     def doexec(self, cnx, query, args=None, rollback=True):
   683     def doexec(self, cnx, query, args=None, rollback=True, rql_query_tracing_token=None):
   684         """Execute a query.
   684         """Execute a query.
   685         it's a function just so that it shows up in profiling
   685         it's a function just so that it shows up in profiling
   686         """
   686         """
   687         cursor = cnx.cnxset.cu
   687         cursor = cnx.cnxset.cu
   688         if server.DEBUG & server.DBG_SQL:
   688         if server.DEBUG & server.DBG_SQL: