Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions APIJSONORM/src/main/java/apijson/orm/AbstractSQLExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,11 +710,15 @@ protected String getKey(@NotNull SQLConfig config, @NotNull ResultSet rs, @NotNu
, final int tablePosition, @NotNull JSONObject table, final int columnIndex, Map<String, JSONObject> childMap) throws Exception {
String key = rsmd.getColumnLabel(columnIndex);// dotIndex < 0 ? lable : lable.substring(dotIndex + 1);
if (config.isHive()) {
String table_name = config.getTable();
if(AbstractSQLConfig.TABLE_KEY_MAP.containsKey(table_name)) table_name = AbstractSQLConfig.TABLE_KEY_MAP.get(table_name);
String pattern = "^" + table_name + "\\." + "[a-zA-Z]+$";
String tableName = config.getTable();
if (AbstractSQLConfig.TABLE_KEY_MAP.containsKey(tableName)) {
tableName = AbstractSQLConfig.TABLE_KEY_MAP.get(tableName);
}
String pattern = "^" + tableName + "\\." + "[a-zA-Z]+$";
boolean isMatch = Pattern.matches(pattern, key);
if(isMatch) key = key.split("\\.")[1];
if (isMatch) {
key = key.split("\\.")[1];
}
}
return key;
}
Expand Down Expand Up @@ -972,7 +976,9 @@ public ResultSet executeQuery(@NotNull SQLConfig config) throws Exception {
public int executeUpdate(@NotNull SQLConfig config) throws Exception {
PreparedStatement s = getStatement(config);
int count = s.executeUpdate(); //PreparedStatement 不用传 SQL
if (config.isHive() && count==0) count = 1;
if (config.isHive() && count == 0) {
count = 1;
}

if (config.getMethod() == RequestMethod.POST && config.getId() == null) { //自增id
ResultSet rs = s.getGeneratedKeys();
Expand Down