Skip to content

Commit 96526c8

Browse files
committed
Server: 完成 @Explain 查执行计划
1 parent 7b17747 commit 96526c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/demo/server/DemoSQLConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DemoSQLConfig extends AbstractSQLConfig {
3939

4040
static {
4141
DEFAULT_DATABASE = DATABASE_MYSQL; //TODO 默认数据库类型,改成你自己的
42-
DEFAULT_SCHEMA = "sys"; //TODO 默认模式名,改成你自己的
42+
DEFAULT_SCHEMA = "sys"; //TODO 默认模式名,改成你自己的,默认情况是 MySQL: sys, PostgreSQL: public, SQL Server: dbo, Oracle:
4343

4444
// 由 DemoVerifier.init 方法读取数据库 Access 表来替代手动输入配置
4545
// //表名映射,隐藏真实表名,对安全要求很高的表可以这么做

APIJSON-Java-Server/APIJSONORM/src/main/java/zuo/biao/apijson/server/AbstractSQLConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,7 @@ public static String getSQL(AbstractSQLConfig config) throws Exception {
21042104
default:
21052105
config.setPreparedValueList(new ArrayList<Object>());
21062106
String column = config.getColumnString();
2107-
return (config.isExplain() ? "EXPLAIN " : "") + "SELECT " + (config.getCache() == JSONRequest.CACHE_RAM ? "SQL_NO_CACHE " : "") + column + " FROM " + getConditionString(column, tablePath, config);
2107+
return (config.isExplain() ? (config.isSQLServer() || config.isOracle() ? "SET STATISTICS PROFILE ON;\n" : "EXPLAIN ") : "") + "SELECT " + (config.getCache() == JSONRequest.CACHE_RAM ? "SQL_NO_CACHE " : "") + column + " FROM " + getConditionString(column, tablePath, config);
21082108
}
21092109
}
21102110

0 commit comments

Comments
 (0)