javeme commented on code in PR #1924:
URL: 
https://github.com/apache/incubator-hugegraph/pull/1924#discussion_r917404875


##########
hugegraph-mysql/src/main/java/com/baidu/hugegraph/backend/store/mysql/MysqlTable.java:
##########
@@ -286,25 +286,22 @@ protected List<Object> 
buildColumnsParams(MysqlBackendEntry.Row entry,
     }
 
     protected String buildUpdateIfPresentTemplate(MysqlBackendEntry.Row entry) 
{
-
         StringBuilder update = new StringBuilder();
         update.append("UPDATE ").append(this.table());
         update.append(" SET ");
 
         List<HugeKeys> idNames = this.idColumnName();
 
         int i = 0;
-        int size = entry.columns().size();
         for (HugeKeys key : entry.columns().keySet()) {
             if (idNames.contains(key)) {
-                size--;
                 continue;
             }
-            update.append(formatKey(key));
-            update.append("=?");
-            if (++i != size) {
+            if (i++ > 0) {
                 update.append(", ");
             }
+            update.append(formatKey(key));
+            update.append("=?");

Review Comment:
   SQL example:
   `UPDATE il SET INDEX_TYPE=21, FIELDS='[76]', STATUS=4, USER_DATA='xx', 
BASE_VALUE=16, NAME='personByAge', BASE_TYPE=1, WHERE ID=1`
   =>
   `UPDATE il SET INDEX_TYPE=21, FIELDS='[76]', STATUS=4, USER_DATA='xx', 
BASE_VALUE=16, NAME='personByAge', BASE_TYPE=1 WHERE ID=1`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to