570 |
570 |
571 def execute(self, session, rql, args=None, eid_key=None, build_descr=True): |
571 def execute(self, session, rql, args=None, eid_key=None, build_descr=True): |
572 """execute a rql query, return resulting rows and their description in |
572 """execute a rql query, return resulting rows and their description in |
573 a `ResultSet` object |
573 a `ResultSet` object |
574 |
574 |
575 * `rql` should be an unicode string or a plain ascii string |
575 * `rql` should be an Unicode string or a plain ASCII string |
576 * `args` the optional parameters dictionary associated to the query |
576 * `args` the optional parameters dictionary associated to the query |
577 * `build_descr` is a boolean flag indicating if the description should |
577 * `build_descr` is a boolean flag indicating if the description should |
578 be built on select queries (if false, the description will be en empty |
578 be built on select queries (if false, the description will be en empty |
579 list) |
579 list) |
580 * `eid_key` must be both a key in args and a substitution in the rql |
580 * `eid_key` must be both a key in args and a substitution in the rql |
581 query. It should be used to enhance cacheability of rql queries. |
581 query. It should be used to enhance cacheability of rql queries. |
582 It may be a tuple for keys in args. |
582 It may be a tuple for keys in args. |
583 eid_key must be providen in case where a eid substitution is providen |
583 `eid_key` must be provided in cases where a eid substitution is provided |
584 and resolve some ambiguity in the possible solutions infered for each |
584 and resolves ambiguities in the possible solutions inferred for each |
585 variable in the query. |
585 variable in the query. |
586 |
586 |
587 on INSERT queries, there will be on row with the eid of each inserted |
587 on INSERT queries, there will be one row with the eid of each inserted |
588 entity |
588 entity |
589 |
589 |
590 result for DELETE and SET queries is undefined yet |
590 result for DELETE and SET queries is undefined yet |
591 |
591 |
592 to maximize the rql parsing/analyzing cache performance, you should |
592 to maximize the rql parsing/analyzing cache performance, you should |
593 always use substitute arguments in queries (eg avoid query such as |
593 always use substitute arguments in queries (i.e. avoid query such as |
594 'Any X WHERE X eid 123'!) |
594 'Any X WHERE X eid 123'!) |
595 """ |
595 """ |
596 if server.DEBUG & (server.DBG_RQL | server.DBG_SQL): |
596 if server.DEBUG & (server.DBG_RQL | server.DBG_SQL): |
597 if server.DEBUG & (server.DBG_MORE | server.DBG_SQL): |
597 if server.DEBUG & (server.DBG_MORE | server.DBG_SQL): |
598 print '*'*80 |
598 print '*'*80 |