35 from cubicweb import ValidationError, set_log_methods, server |
35 from cubicweb import ValidationError, set_log_methods, server |
36 from cubicweb.server import SOURCE_TYPES |
36 from cubicweb.server import SOURCE_TYPES |
37 from cubicweb.server.edition import EditedEntity |
37 from cubicweb.server.edition import EditedEntity |
38 |
38 |
39 |
39 |
40 def dbg_st_search(uri, union, varmap, args, cachekey=None, prefix='rql for'): |
40 def dbg_st_search(uri, union, args, cachekey=None, prefix='rql for'): |
41 if server.DEBUG & server.DBG_RQL: |
41 if server.DEBUG & server.DBG_RQL: |
42 global t |
42 global t |
43 print(' %s %s source: %s' % (prefix, uri, repr(union.as_string()))) |
43 print(' %s %s source: %s' % (prefix, uri, repr(union.as_string()))) |
44 t = time() |
44 t = time() |
45 if varmap: |
|
46 print(' using varmap', varmap) |
|
47 if server.DEBUG & server.DBG_MORE: |
45 if server.DEBUG & server.DBG_MORE: |
48 print(' args', repr(args)) |
46 print(' args', repr(args)) |
49 print(' cache key', cachekey) |
47 print(' cache key', cachekey) |
50 print(' solutions', ','.join(str(s.solutions) |
48 print(' solutions', ','.join(str(s.solutions) |
51 for s in union.children)) |
49 for s in union.children)) |
359 raise NotImplementedError(self) |
357 raise NotImplementedError(self) |
360 |
358 |
361 # RQL query api ############################################################ |
359 # RQL query api ############################################################ |
362 |
360 |
363 def syntax_tree_search(self, cnx, union, |
361 def syntax_tree_search(self, cnx, union, |
364 args=None, cachekey=None, varmap=None, debug=0): |
362 args=None, cachekey=None, debug=0): |
365 """return result from this source for a rql query (actually from a rql |
363 """return result from this source for a rql query (actually from a rql |
366 syntax tree and a solution dictionary mapping each used variable to a |
364 syntax tree and a solution dictionary mapping each used variable to a |
367 possible type). If cachekey is given, the query necessary to fetch the |
365 possible type). If cachekey is given, the query necessary to fetch the |
368 results (but not the results themselves) may be cached using this key. |
366 results (but not the results themselves) may be cached using this key. |
369 """ |
367 """ |