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:]
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)
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, _)
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
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
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)