@error_handler
def fetch_results(request, id, first_row=0):
 first_row = long(first_row)
 results = type('Result', (object,), {'rows': 0, 'columns': [], 'has_more': False, 'start_row': 0})
 fetch_error = False
 error_message = ''
 query_history = authorized_get_query_history(request, id, must_exist=True)
 query_server = query_history.get_query_server_config()
 design = SQLdesign.loads(query_history.design.data)
 db = dbms.get(request.user, query_server)
 try:
  database = design.query.get('database', 'default')
  db.use(database)
  datatable = db.execute_and_wait(design)
  results = db.client.create_result(datatable)
  status = 0
 except Exception as e:
  fetch_error = True
  error_message = str(e)
  status = (-1)
 response = {'status': status, 'message': ((fetch_error and error_message) or ''), 'results': results_to_dict(results)}
 return JsonResponse(response)

@ error_handler def fetch_results ( request , id , first_row = 0 ) : first_row = long ( first_row ) results = type ( 'Result' , ( object , ) , { 'rows' : 0 , 'columns' : [ ] , 'has_more' : False , 'start_row' : 0 } ) fetch_error = False error_message = '' query_history = authorized_get_query_history ( request , id , must_exist = True ) query_server = query_history . get_query_server_config ( ) design = SQLdesign . loads ( query_history . design . data ) db = dbms . get ( request . user , query_server ) try : database = design . query . get ( 'database' , 'default' ) db . use ( database ) datatable = db . execute_and_wait ( design ) results = db . client . create_result ( datatable ) status = 0 except Exception as e : fetch_error = True error_message = str ( e ) status = ( - 1 ) response = { 'status' : status , 'message' : ( ( fetch_error and error_message ) or '' ) , 'results' : results_to_dict ( results ) } return JsonResponse ( response )
returns the results of the queryhistory with the given id .