Skip to content

Commit

Permalink
拼错单词 globle 纠正为 global
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Mar 27, 2022
1 parent 1e5e587 commit d7c3115
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 65 deletions.
20 changes: 10 additions & 10 deletions APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java
Expand Up @@ -332,22 +332,22 @@ else if (sqlConfig.isClickHouse()) {
}

if (isTable) {
if (parser.getGlobleDatabase() != null && sqlRequest.get(JSONRequest.KEY_DATABASE) == null) {
sqlRequest.put(JSONRequest.KEY_DATABASE, parser.getGlobleDatabase());
if (parser.getGlobalDatabase() != null && sqlRequest.get(JSONRequest.KEY_DATABASE) == null) {
sqlRequest.put(JSONRequest.KEY_DATABASE, parser.getGlobalDatabase());
}
if (parser.getGlobleSchema() != null && sqlRequest.get(JSONRequest.KEY_SCHEMA) == null) {
sqlRequest.put(JSONRequest.KEY_SCHEMA, parser.getGlobleSchema());
if (parser.getGlobalSchema() != null && sqlRequest.get(JSONRequest.KEY_SCHEMA) == null) {
sqlRequest.put(JSONRequest.KEY_SCHEMA, parser.getGlobalSchema());
}
if (parser.getGlobleDatasource() != null && sqlRequest.get(JSONRequest.KEY_DATASOURCE) == null) {
sqlRequest.put(JSONRequest.KEY_DATASOURCE, parser.getGlobleDatasource());
if (parser.getGlobalDatasource() != null && sqlRequest.get(JSONRequest.KEY_DATASOURCE) == null) {
sqlRequest.put(JSONRequest.KEY_DATASOURCE, parser.getGlobalDatasource());
}

if (isSubquery == false) { //解决 SQL 语法报错,子查询不能 EXPLAIN
if (parser.getGlobleExplain() != null && sqlRequest.get(JSONRequest.KEY_EXPLAIN) == null) {
sqlRequest.put(JSONRequest.KEY_EXPLAIN, parser.getGlobleExplain());
if (parser.getGlobalExplain() != null && sqlRequest.get(JSONRequest.KEY_EXPLAIN) == null) {
sqlRequest.put(JSONRequest.KEY_EXPLAIN, parser.getGlobalExplain());
}
if (parser.getGlobleCache() != null && sqlRequest.get(JSONRequest.KEY_CACHE) == null) {
sqlRequest.put(JSONRequest.KEY_CACHE, parser.getGlobleCache());
if (parser.getGlobalCache() != null && sqlRequest.get(JSONRequest.KEY_CACHE) == null) {
sqlRequest.put(JSONRequest.KEY_CACHE, parser.getGlobalCache());
}
}
}
Expand Down
94 changes: 47 additions & 47 deletions APIJSONORM/src/main/java/apijson/orm/AbstractParser.java
Expand Up @@ -187,69 +187,69 @@ public AbstractParser<T> setRequest(JSONObject request) {
return this;
}

protected Boolean globleFormat;
public AbstractParser<T> setGlobleFormat(Boolean globleFormat) {
this.globleFormat = globleFormat;
protected Boolean globalFormat;
public AbstractParser<T> setGlobalFormat(Boolean globalFormat) {
this.globalFormat = globalFormat;
return this;
}
@Override
public Boolean getGlobleFormat() {
return globleFormat;
public Boolean getGlobalFormat() {
return globalFormat;
}
protected String globleRole;
public AbstractParser<T> setGlobleRole(String globleRole) {
this.globleRole = globleRole;
protected String globalRole;
public AbstractParser<T> setGlobalRole(String globalRole) {
this.globalRole = globalRole;
return this;
}
@Override
public String getGlobleRole() {
return globleRole;
public String getGlobalRole() {
return globalRole;
}
protected String globleDatabase;
public AbstractParser<T> setGlobleDatabase(String globleDatabase) {
this.globleDatabase = globleDatabase;
protected String globalDatabase;
public AbstractParser<T> setGlobalDatabase(String globalDatabase) {
this.globalDatabase = globalDatabase;
return this;
}
@Override
public String getGlobleDatabase() {
return globleDatabase;
public String getGlobalDatabase() {
return globalDatabase;
}
protected String globleSchema;
public AbstractParser<T> setGlobleSchema(String globleSchema) {
this.globleSchema = globleSchema;
protected String globalSchema;
public AbstractParser<T> setGlobalSchema(String globalSchema) {
this.globalSchema = globalSchema;
return this;
}
@Override
public String getGlobleSchema() {
return globleSchema;
public String getGlobalSchema() {
return globalSchema;
}
protected String globleDatasource;
protected String globalDatasource;
@Override
public String getGlobleDatasource() {
return globleDatasource;
public String getGlobalDatasource() {
return globalDatasource;
}
public AbstractParser<T> setGlobleDatasource(String globleDatasource) {
this.globleDatasource = globleDatasource;
public AbstractParser<T> setGlobalDatasource(String globalDatasource) {
this.globalDatasource = globalDatasource;
return this;
}

protected Boolean globleExplain;
public AbstractParser<T> setGlobleExplain(Boolean globleExplain) {
this.globleExplain = globleExplain;
protected Boolean globalExplain;
public AbstractParser<T> setGlobalExplain(Boolean globalExplain) {
this.globalExplain = globalExplain;
return this;
}
@Override
public Boolean getGlobleExplain() {
return globleExplain;
public Boolean getGlobalExplain() {
return globalExplain;
}
protected String globleCache;
public AbstractParser<T> setGlobleCache(String globleCache) {
this.globleCache = globleCache;
protected String globalCache;
public AbstractParser<T> setGlobalCache(String globalCache) {
this.globalCache = globalCache;
return this;
}
@Override
public String getGlobleCache() {
return globleCache;
public String getGlobalCache() {
return globalCache;
}

@Override
Expand Down Expand Up @@ -383,22 +383,22 @@ public JSONObject parseResponse(JSONObject request) {
}

//必须在parseCorrectRequest后面,因为parseCorrectRequest可能会添加 @role
if (isNeedVerifyRole() && globleRole == null) {
if (isNeedVerifyRole() && globalRole == null) {
try {
setGlobleRole(requestObject.getString(JSONRequest.KEY_ROLE));
setGlobalRole(requestObject.getString(JSONRequest.KEY_ROLE));
requestObject.remove(JSONRequest.KEY_ROLE);
} catch (Exception e) {
return extendErrorResult(requestObject, e, requestMethod, getRequestURL(), isRoot);
}
}

try {
setGlobleFormat(requestObject.getBoolean(JSONRequest.KEY_FORMAT));
setGlobleDatabase(requestObject.getString(JSONRequest.KEY_DATABASE));
setGlobleSchema(requestObject.getString(JSONRequest.KEY_SCHEMA));
setGlobleDatasource(requestObject.getString(JSONRequest.KEY_DATASOURCE));
setGlobleExplain(requestObject.getBoolean(JSONRequest.KEY_EXPLAIN));
setGlobleCache(requestObject.getString(JSONRequest.KEY_CACHE));
setGlobalFormat(requestObject.getBoolean(JSONRequest.KEY_FORMAT));
setGlobalDatabase(requestObject.getString(JSONRequest.KEY_DATABASE));
setGlobalSchema(requestObject.getString(JSONRequest.KEY_SCHEMA));
setGlobalDatasource(requestObject.getString(JSONRequest.KEY_DATASOURCE));
setGlobalExplain(requestObject.getBoolean(JSONRequest.KEY_EXPLAIN));
setGlobalCache(requestObject.getString(JSONRequest.KEY_CACHE));

requestObject.remove(JSONRequest.KEY_FORMAT);
requestObject.remove(JSONRequest.KEY_DATABASE);
Expand Down Expand Up @@ -435,7 +435,7 @@ public JSONObject parseResponse(JSONObject request) {

requestObject = error == null ? extendSuccessResult(requestObject, isRoot) : extendErrorResult(requestObject, error, requestMethod, getRequestURL(), isRoot);

JSONObject res = (globleFormat != null && globleFormat) && JSONResponse.isSuccess(requestObject) ? new JSONResponse(requestObject) : requestObject;
JSONObject res = (globalFormat != null && globalFormat) && JSONResponse.isSuccess(requestObject) ? new JSONResponse(requestObject) : requestObject;

long endTime = System.currentTimeMillis();
long duration = endTime - startTime;
Expand Down Expand Up @@ -493,8 +493,8 @@ public void onVerifyRole(@NotNull SQLConfig config) throws Exception {

if (isNeedVerifyRole()) {
if (config.getRole() == null) {
if (globleRole != null) {
config.setRole(globleRole);
if (globalRole != null) {
config.setRole(globalRole);
} else {
config.setRole(getVisitor().getId() == null ? AbstractVerifier.UNKNOWN : AbstractVerifier.LOGIN);
}
Expand Down Expand Up @@ -548,7 +548,7 @@ public JSONObject parseCorrectRequest(RequestMethod method, String tag, int vers
JSONObject target = wrapRequest(method, tag, object, true);

//JSONObject clone 浅拷贝没用,Structure.parse 会导致 structure 里面被清空,第二次从缓存里取到的就是 {}
return getVerifier().verifyRequest(method, name, target, request, maxUpdateCount, getGlobleDatabase(), getGlobleSchema(), creator);
return getVerifier().verifyRequest(method, name, target, request, maxUpdateCount, getGlobalDatabase(), getGlobalSchema(), creator);
}


Expand Down
14 changes: 7 additions & 7 deletions APIJSONORM/src/main/java/apijson/orm/Parser.java
Expand Up @@ -118,13 +118,13 @@ JSONObject parseCorrectRequest(RequestMethod method, String tag, int version, St
Verifier<T> getVerifier();


Boolean getGlobleFormat();
String getGlobleRole();
String getGlobleDatabase();
String getGlobleSchema();
String getGlobleDatasource();
Boolean getGlobleExplain();
String getGlobleCache();
Boolean getGlobalFormat();
String getGlobalRole();
String getGlobalDatabase();
String getGlobalSchema();
String getGlobalDatasource();
Boolean getGlobalExplain();
String getGlobalCache();


int getTransactionIsolation();
Expand Down
2 changes: 1 addition & 1 deletion APIJSONORM/src/main/java/apijson/orm/Verifier.java
Expand Up @@ -74,7 +74,7 @@ public interface Verifier<T> {
* @throws Exception
*/
JSONObject verifyRequest(RequestMethod method, String name, JSONObject target, JSONObject request,
int maxUpdateCount, String globleDatabase, String globleSchema, SQLCreator creator) throws Exception;
int maxUpdateCount, String globalDatabase, String globalSchema, SQLCreator creator) throws Exception;

/**验证返回结果的数据和结构
* @param table
Expand Down

0 comments on commit d7c3115

Please sign in to comment.