class DatabaseController {

    @RequestMapping(value = "/sqlValidate", method = RequestMethod.POST)
    public ServiceResult validateSQL(@RequestBody SqlValidateRequest sqlValidateRequest) throws Exception {
        DataBaseInfo dataBaseInfo = dataBaseDao.getMasterCologByDatabaseSetId(sqlValidateRequest.getDbset_id());
        String values[] = {};
        int sqlTypes[] = {};
        SQLValidateResult validResult = SQLValidation.queryValidate(dataBaseInfo.getId(), sqlValidateRequest.getSql_content(), sqlTypes, values);
        if (validResult != null && validResult.isPassed()) {
            return ServiceResult.success(SqlValidateView.builder()
                    .dbType(validResult.getDbType())
                    .rows(validResult.getAffectRows())
                    .msg(validResult.getMessage())
                    .build());
        } else {
            return ServiceResult.fail(validResult.getMessage());
        }
    }

}