Skip to content

Commit

Permalink
Use PrepareStatement to replace string concatenation (#3393)
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Cod3r committed Jul 21, 2020
1 parent 5eb7d6a commit 2eaed4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1078,8 +1078,8 @@ public int configInfoCount() {

@Override
public int configInfoCount(String tenant) {
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like '" + tenant + "'";
Integer result = databaseOperate.queryOne(sql, Integer.class);
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like ?";
Integer result = databaseOperate.queryOne(sql, new Object[] {tenant}, Integer.class);
if (result == null) {
throw new IllegalArgumentException("configInfoCount error");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1130,8 +1130,8 @@ public int configInfoCount() {

@Override
public int configInfoCount(String tenant) {
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like '" + tenant + "'";
Integer result = jt.queryForObject(sql, Integer.class);
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like ?";
Integer result = jt.queryForObject(sql, new Object[] {tenant}, Integer.class);
if (result == null) {
throw new IllegalArgumentException("configInfoCount error");
}
Expand Down

0 comments on commit 2eaed4b

Please sign in to comment.