Exemplo n.º 1
0
 def results(self):
     """Retrieves query results."""
     error, result = yield from self._communicate(
         self._RESULTS + self._query_id + self._connection.SUCCESS_TERM,
         success_term_twice=True)
     if error:
         raise errors.QueryError(result)
     return result[1:]
Exemplo n.º 2
0
 def close(self):
     """Closes this Query."""
     error, result = yield from self._communicate(
         self._CLOSE + self._query_id + self._connection.SUCCESS_TERM,
         success_term_twice=True)
     if error:
         raise errors.QueryError(result)
     logger.info(result)
Exemplo n.º 3
0
 def query(self, q):
     """Creates C{BaseXQuery}"""
     error, _ = yield from self._communicate(self._QUERY + q +
                                             self._connection.SUCCESS_TERM)
     if error:
         raise errors.QueryError(_)
     else:
         return query.BaseXQuery(self._connection, _)
Exemplo n.º 4
0
 def execute(self):
     """Executes the Query."""
     error, result = yield from self._communicate(
         self._EXECUTE + self._query_id + self._connection.SUCCESS_TERM,
         success_term_twice=True,
     )
     if error:
         raise errors.QueryError(result)
     return result
Exemplo n.º 5
0
 def updating(self):
     """Determine, if query updating."""
     error, result = yield from self._communicate(
         self._UPDATING + self._query_id + self._connection.SUCCESS_TERM,
         success_term_twice=True,
     )
     if error:
         raise errors.QueryError(result)
     return True if result == 'true' else False
Exemplo n.º 6
0
 def context(self, value, type=b''):
     """Bind context variable to a query."""
     error, result = yield from self._communicate(
         self._CONTEXT + self._query_id +
         self._connection.SUCCESS_TERM + value +
         self._connection.SUCCESS_TERM + type +
         self._connection.SUCCESS_TERM, success_term_twice=True,
     )
     if error:
         raise errors.QueryError(result)
     logger.info(result)