server/querier.py
changeset 10609 e2d8e81bfe68
parent 10589 7c23b7de2b8d
child 10612 84468b90e9c1
equal deleted inserted replaced
10608:7fc548d9dd8e 10609:e2d8e81bfe68
    21 from __future__ import print_function
    21 from __future__ import print_function
    22 
    22 
    23 __docformat__ = "restructuredtext en"
    23 __docformat__ = "restructuredtext en"
    24 
    24 
    25 from itertools import repeat
    25 from itertools import repeat
       
    26 
       
    27 from six.moves import range
    26 
    28 
    27 from rql import RQLSyntaxError, CoercionError
    29 from rql import RQLSyntaxError, CoercionError
    28 from rql.stmts import Union
    30 from rql.stmts import Union
    29 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj, Relation, Exists, Not
    31 from rql.nodes import ETYPE_PYOBJ_MAP, etype_from_pyobj, Relation, Exists, Not
    30 from yams import BASE_TYPES
    32 from yams import BASE_TYPES
   641             elif rqlst.TYPE == 'insert':
   643             elif rqlst.TYPE == 'insert':
   642                 # on insert plan, some entities may have been auto-casted,
   644                 # on insert plan, some entities may have been auto-casted,
   643                 # so compute description manually even if there is only
   645                 # so compute description manually even if there is only
   644                 # one solution
   646                 # one solution
   645                 basedescr = [None] * len(plan.selected)
   647                 basedescr = [None] * len(plan.selected)
   646                 todetermine = zip(xrange(len(plan.selected)), repeat(False))
   648                 todetermine = zip(range(len(plan.selected)), repeat(False))
   647                 descr = _build_descr(cnx, results, basedescr, todetermine)
   649                 descr = _build_descr(cnx, results, basedescr, todetermine)
   648             # FIXME: get number of affected entities / relations on non
   650             # FIXME: get number of affected entities / relations on non
   649             # selection queries ?
   651             # selection queries ?
   650         # return a result set object
   652         # return a result set object
   651         return ResultSet(results, rql, args, descr)
   653         return ResultSet(results, rql, args, descr)
   668     # not so easy, looks for variable which changes from one solution
   670     # not so easy, looks for variable which changes from one solution
   669     # to another
   671     # to another
   670     unstables = rqlst.get_variable_indices()
   672     unstables = rqlst.get_variable_indices()
   671     basedescr = []
   673     basedescr = []
   672     todetermine = []
   674     todetermine = []
   673     for i in xrange(len(rqlst.children[0].selection)):
   675     for i in range(len(rqlst.children[0].selection)):
   674         ttype = _selection_idx_type(i, rqlst, args)
   676         ttype = _selection_idx_type(i, rqlst, args)
   675         if ttype is None or ttype == 'Any':
   677         if ttype is None or ttype == 'Any':
   676             ttype = None
   678             ttype = None
   677             isfinal = True
   679             isfinal = True
   678         else:
   680         else: