GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 请求新增接口http://localhost:8080/post · Issue #218 · APIJSON/APIJSON

请求新增接口http://localhost:8080/post #218

New issue
Copy link
New issue
Copy link
Closed
#219
Closed
请求新增接口http://localhost:8080/post#218
#219
Copy link

Description

@gujiachun
gujiachun
opened on Apr 19, 2021
Issue body actions

版本:v4.6.7
1)执行http://localhost:8080/post
{
"Moment":{
"content":"adsfasdfasdfasdf"
},
"tag":"Moment"
}
可以成功执行
2)但如果我需要看执行性能
{
"Moment":{
"content":"adsfasdfasdfasdf"
},
"tag":"Moment",
"@Explain":true
}
就会报异常。

异常代码:
`boolean explain = config.isExplain();
if (explain) { //如果先执行 explain,则 execute 会死循环,所以只能先执行非 explain
config.setExplain(false); //对下面 config.getSQL(false); 生效
JSONObject res = getSQLExecutor().execute(config, false);

                            //执行了第二次导致的错误
			config.setExplain(explain);
			JSONObject explainResult = config.isMain() && config.getPosition() != 0 ? null : getSQLExecutor().execute(config, false);

			if (explainResult == null) {
				result = res;
			}
			else {
				result = new JSONObject(true);
				result.put(KEY_EXPLAIN, explainResult);
				result.putAll(res);
			}
		}`

Activity

  1. TommyLemon commented on Apr 19, 2021

    @TommyLemon
    TommyLemon
    on Apr 19, 2021
    Member
    More actions

    SQL 对 SELECT 外的操作不支持 EXPLAIN。这里应该只对 RequestMethod.isQueryMethod(config.getMethod, true) 执行 EXPLAIN SQL,其它的操作直接 return 一个只有 "sql": config.getSQL(false) 这个键值对的 JSONObject。

    感谢反馈,可以提个 Pull Request,会把你加到贡献者列表里哦
    https://github.com/Tencent/APIJSON/blob/master/CONTRIBUTING.md

  2. gujiachun
    added a commit that references this issue on Apr 20, 2021

    fix: @Explain在更新方法应用的错误

    838b3b0
  3. TommyLemon
    closed this as completedin #219on Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.