[mysql] quota the field names when executing mysql query (#2381) (#2388)

Co-authored-by: DESKTOP-TQDONF3\狗狗jian <zhangjian@adream.org>
(cherry picked from commit f7df47e2ee)
pull/2694/head
Malcolmjian 1 year ago committed by Leonard Xu
parent 246e4013e5
commit 45b003d5f8

@ -244,7 +244,7 @@ public class StatementUtils {
RowType pkRowType, StringBuilder sql, String predicate) {
for (Iterator<String> fieldNamesIt = pkRowType.getFieldNames().iterator();
fieldNamesIt.hasNext(); ) {
sql.append(fieldNamesIt.next()).append(predicate);
sql.append(quote(fieldNamesIt.next())).append(predicate);
if (fieldNamesIt.hasNext()) {
sql.append(" AND ");
}
@ -255,7 +255,7 @@ public class StatementUtils {
StringBuilder sql = new StringBuilder();
for (Iterator<String> fieldNamesIt = pkRowType.getFieldNames().iterator();
fieldNamesIt.hasNext(); ) {
sql.append(fieldNamesIt.next());
sql.append(quote(fieldNamesIt.next()));
if (fieldNamesIt.hasNext()) {
sql.append(" , ");
}
@ -267,7 +267,7 @@ public class StatementUtils {
StringBuilder sql = new StringBuilder();
for (Iterator<String> fieldNamesIt = pkRowType.getFieldNames().iterator();
fieldNamesIt.hasNext(); ) {
sql.append("MAX(" + fieldNamesIt.next() + ")");
sql.append("MAX(" + quote(fieldNamesIt.next()) + ")");
if (fieldNamesIt.hasNext()) {
sql.append(" , ");
}

Loading…
Cancel
Save