@Test(expected = Exception.class) public void testQueryException() throws Exception { SQLRequest sqlRequest = new SQLRequest(); sqlRequest.setSql("select * from not_exist_table"); sqlRequest.setProject("default"); queryController.query(sqlRequest); }
@RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") public SQLResponse query(@RequestBody SQLRequest sqlRequest) { long startTimestamp = System.currentTimeMillis(); SQLResponse response = doQuery(sqlRequest); response.setDuration(System.currentTimeMillis() - startTimestamp); queryService.logQuery(sqlRequest, response, new Date(startTimestamp), new Date(System.currentTimeMillis())); return response; }
QueryController extends BasicController { @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") public SQLResponse query(@RequestBody SQLRequest sqlRequest) { long startTimestamp = System.currentTimeMillis(); SQLResponse response = doQuery(sqlRequest); response.setDuration(System.currentTimeMillis() - startTimestamp); queryService.logQuery(sqlRequest, response, new Date(startTimestamp), new Date(System.currentTimeMillis())); return response; } }
QueryController extends BasicController { @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") public SQLResponse query(@RequestBody SQLRequest sqlRequest) { long startTimestamp = System.currentTimeMillis(); SQLResponse response = doQuery(sqlRequest); response.setDuration(System.currentTimeMillis() - startTimestamp); queryService.logQuery(sqlRequest, response, new Date(startTimestamp), new Date(System.currentTimeMillis())); return response; }  }
QueryController extends BasicController { @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") public SQLResponse query(@RequestBody SQLRequest sqlRequest) { long startTimestamp = System.currentTimeMillis(); SQLResponse response = doQuery(sqlRequest); response.setDuration(System.currentTimeMillis() - startTimestamp); queryService.logQuery(sqlRequest, response, new Date(startTimestamp), new Date(System.currentTimeMillis())); return response; }  @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") SQLResponse query(@RequestBody SQLRequest sqlRequest); @RequestMapping(value = "/query/prestate", method = RequestMethod.POST, produces = "application/json") @ResponseBody @Timed(name = "query") SQLResponse prepareQuery(@RequestBody PrepareSqlRequest sqlRequest); @RequestMapping(value = "/saved_queries", method = RequestMethod.POST) @ResponseBody @Timed(name = "saveQuery") void saveQuery(@RequestBody SaveSqlRequest sqlRequest); @RequestMapping(value = "/saved_queries/{id}", method = RequestMethod.DELETE) @ResponseBody @Timed(name = "removeQuery") void removeQuery(@PathVariable String id); @RequestMapping(value = "/saved_queries", method = RequestMethod.GET) @ResponseBody @Timed(name = "getQueries") List<Query> getQueries(); @RequestMapping(value = "/query/format/{format}", method = RequestMethod.GET) @ResponseBody @Timed(name = "downloadResult") void downloadQueryResult(@PathVariable String format, SQLRequest sqlRequest, HttpServletResponse response); @RequestMapping(value = "/tables_and_columns", method = RequestMethod.GET) @ResponseBody List<TableMeta> getMetadata(MetaRequest metaRequest); void setQueryService(QueryService queryService); void setCacheManager(CacheManager cacheManager); }
QueryController extends BasicController { @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") public SQLResponse query(@RequestBody SQLRequest sqlRequest) { long startTimestamp = System.currentTimeMillis(); SQLResponse response = doQuery(sqlRequest); response.setDuration(System.currentTimeMillis() - startTimestamp); queryService.logQuery(sqlRequest, response, new Date(startTimestamp), new Date(System.currentTimeMillis())); return response; }  @RequestMapping(value = "/query", method = RequestMethod.POST) @ResponseBody @Timed(name = "query") SQLResponse query(@RequestBody SQLRequest sqlRequest); @RequestMapping(value = "/query/prestate", method = RequestMethod.POST, produces = "application/json") @ResponseBody @Timed(name = "query") SQLResponse prepareQuery(@RequestBody PrepareSqlRequest sqlRequest); @RequestMapping(value = "/saved_queries", method = RequestMethod.POST) @ResponseBody @Timed(name = "saveQuery") void saveQuery(@RequestBody SaveSqlRequest sqlRequest); @RequestMapping(value = "/saved_queries/{id}", method = RequestMethod.DELETE) @ResponseBody @Timed(name = "removeQuery") void removeQuery(@PathVariable String id); @RequestMapping(value = "/saved_queries", method = RequestMethod.GET) @ResponseBody @Timed(name = "getQueries") List<Query> getQueries(); @RequestMapping(value = "/query/format/{format}", method = RequestMethod.GET) @ResponseBody @Timed(name = "downloadResult") void downloadQueryResult(@PathVariable String format, SQLRequest sqlRequest, HttpServletResponse response); @RequestMapping(value = "/tables_and_columns", method = RequestMethod.GET) @ResponseBody List<TableMeta> getMetadata(MetaRequest metaRequest); void setQueryService(QueryService queryService); void setCacheManager(CacheManager cacheManager); static final String SUCCESS_QUERY_CACHE; static final String EXCEPTION_QUERY_CACHE; }