Skip to content

Commit 37481e7

Browse files
committed
Java:MultiDataSource 中 SQLAuto: 强校验 SQL 解决部份情况 WHERE id/userId = val / IN(val) 判断 val 取值错误
1 parent 067eddb commit 37481e7

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/boot/DemoController.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,11 +2439,9 @@ public String execute(@RequestBody String request, HttpSession session) {
24392439
if (isEq && ! sqlRest.startsWith("'")) {
24402440
for (int i = 0; i < sqlRest.length(); i++) {
24412441
char c = sqlRest.charAt(i);
2442-
if (c == '+' || c == '-' || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
2443-
continue;
2442+
if (c == '?' || c == '+' || c == '-' || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) {
2443+
endInd ++;
24442444
}
2445-
2446-
endInd = i;
24472445
}
24482446
} else {
24492447
endInd = sqlRest.indexOf(isEq ? "'" : ")", isEq ? 1 : 0);

0 commit comments

Comments
 (0)