server/querier.py
changeset 7954 a3d3220669d6
parent 7779 3826d8480a68
child 8127 96d343a5e01b
equal deleted inserted replaced
7953:a37531c8a4a6 7954:a3d3220669d6
    23 
    23 
    24 __docformat__ = "restructuredtext en"
    24 __docformat__ = "restructuredtext en"
    25 
    25 
    26 from itertools import repeat
    26 from itertools import repeat
    27 
    27 
    28 from logilab.common.cache import Cache
       
    29 from logilab.common.compat import any
    28 from logilab.common.compat import any
    30 from rql import RQLSyntaxError
    29 from rql import RQLSyntaxError
    31 from rql.stmts import Union, Select
    30 from rql.stmts import Union, Select
    32 from rql.nodes import (Relation, VariableRef, Constant, SubQuery, Function,
    31 from rql.nodes import (Relation, VariableRef, Constant, SubQuery, Function,
    33                        Exists, Not)
    32                        Exists, Not)
    34 
    33 
    35 from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid
    34 from cubicweb import ValidationError, Unauthorized, QueryError, UnknownEid
    36 from cubicweb import server, typed_eid
    35 from cubicweb import server, typed_eid
    37 from cubicweb.rset import ResultSet
    36 from cubicweb.rset import ResultSet
    38 
    37 
       
    38 from cubicweb.utils import QueryCache
    39 from cubicweb.server.utils import cleanup_solutions
    39 from cubicweb.server.utils import cleanup_solutions
    40 from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata
    40 from cubicweb.server.rqlannotation import SQLGenAnnotator, set_qdata
    41 from cubicweb.server.ssplanner import READ_ONLY_RTYPES, add_types_restriction
    41 from cubicweb.server.ssplanner import READ_ONLY_RTYPES, add_types_restriction
    42 from cubicweb.server.edition import EditedEntity
    42 from cubicweb.server.edition import EditedEntity
    43 from cubicweb.server.session import security_enabled
    43 from cubicweb.server.session import security_enabled
   597 
   597 
   598     def set_schema(self, schema):
   598     def set_schema(self, schema):
   599         self.schema = schema
   599         self.schema = schema
   600         repo = self._repo
   600         repo = self._repo
   601         # rql st and solution cache.
   601         # rql st and solution cache.
   602         self._rql_cache = Cache(repo.config['rql-cache-size'])
   602         self._rql_cache = QueryCache(repo.config['rql-cache-size'])
   603         # rql cache key cache. Don't bother using a Cache instance: we should
   603         # rql cache key cache. Don't bother using a Cache instance: we should
   604         # have a limited number of queries in there, since there are no entries
   604         # have a limited number of queries in there, since there are no entries
   605         # in this cache for user queries (which have no args)
   605         # in this cache for user queries (which have no args)
   606         self._rql_ck_cache = {}
   606         self._rql_ck_cache = {}
   607         # some cache usage stats
   607         # some cache usage stats