| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 30084d9 commit eff8d95
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,7 +149,7 @@ public static JSONObject init(boolean shutdownWhenServerError) throws ServerExce | |||
| 149 | 149 | , true | |
| 150 | 150 | ) | |
| 151 | 151 | .setTag(item.getString(JSONRequest.KEY_TAG)) | |
| 152 | - .setVersion(item.getInteger(JSONRequest.KEY_VERSION)) | ||
| 152 | + .setVersion(item.getIntValue(JSONRequest.KEY_VERSION)) | ||
| 153 | 153 | .parseResponse(demo); | |
| 154 | 154 | ||
| 155 | 155 | if (JSONResponse.isSuccess(r) == false) { | |
@@ -328,10 +328,10 @@ private JSONArray getChildCommentIdList(long tid) { | |||
| 328 | 328 | * @return | |
| 329 | 329 | * @throws ServerException | |
| 330 | 330 | */ | |
| 331 | - public JSONObject getFunctionDemo(@NotNull JSONObject request) throws ServerException { | ||
| 331 | + public JSONObject getFunctionDemo(@NotNull JSONObject request) { | ||
| 332 | 332 | JSONObject demo = JSON.parseObject(request.getString("demo")); | |
| 333 | 333 | if (demo == null) { | |
| 334 | - throw new ServerException("服务器内部错误,字段 demo 的值必须为合法且非 null 的 JSONObejct 字符串!"); | ||
| 334 | + demo = new JSONObject(); | ||
| 335 | 335 | } | |
| 336 | 336 | if (demo.containsKey("result()") == false) { | |
| 337 | 337 | demo.put("result()", getFunctionCall(request.getString("name"), request.getString("arguments"))); | |
@@ -353,15 +353,15 @@ public String getFunctionDetail(@NotNull JSONObject request) { | |||
| 353 | 353 | * @return | |
| 354 | 354 | */ | |
| 355 | 355 | private static String getFunctionCall(String name, String arguments) { | |
| 356 | - return name + "(" + arguments + ")"; | ||
| 356 | + return name + "(" + StringUtil.getTrimedString(arguments) + ")"; | ||
| 357 | 357 | } | |
| 358 | 358 | ||
| 359 | 359 | /**TODO 仅用来测试 "key-()":"getIdList()" 和 "key()":"getIdList()" | |
| 360 | 360 | * @param request | |
| 361 | 361 | * @return JSONArray 只能用JSONArray,用long[]会在SQLConfig解析崩溃 | |
| 362 | 362 | * @throws Exception | |
| 363 | 363 | */ | |
| 364 | - public JSONArray getIdList(@NotNull JSONObject request) throws Exception { | ||
| 364 | + public JSONArray getIdList(@NotNull JSONObject request) { | ||
| 365 | 365 | return new JSONArray(new ArrayList<Object>(Arrays.asList(12, 15, 301, 82001, 82002, 38710))); | |
| 366 | 366 | } | |
| 367 | 367 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -195,9 +195,9 @@ public JSONObject execute(@NotNull SQLConfig config, boolean unknowType) throws | |||
| 195 | 195 | switch (config.getMethod()) { | |
| 196 | 196 | case HEAD: | |
| 197 | 197 | case HEADS: | |
| 198 | - executedSQLCount ++; | ||
| 199 | - | ||
| 200 | 198 | rs = executeQuery(config); | |
| 199 | + | ||
| 200 | + executedSQLCount ++; | ||
| 201 | 201 | ||
| 202 | 202 | result = rs.next() ? AbstractParser.newSuccessResult() | |
| 203 | 203 | : AbstractParser.newErrorResult(new SQLException("数据库错误, rs.next() 失败!")); | |
@@ -236,9 +236,11 @@ public JSONObject execute(@NotNull SQLConfig config, boolean unknowType) throws | |||
| 236 | 236 | return result; | |
| 237 | 237 | } | |
| 238 | 238 | ||
| 239 | - executedSQLCount ++; | ||
| 240 | - | ||
| 241 | 239 | rs = executeQuery(config); | |
| 240 | + | ||
| 241 | + if (config.isExplain() == false) { //只有 SELECT 才能 EXPLAIN | ||
| 242 | + executedSQLCount ++; | ||
| 243 | + } | ||
| 242 | 244 | break; | |
| 243 | 245 | ||
| 244 | 246 | default://OPTIONS, TRACE等 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments