Fixed parameter ordering while storing values (#12467)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2022-03-13 12:13:00 +01:00 committed by GitHub
parent 8e414d45a0
commit 9e6b901d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -343,7 +343,7 @@ public class JdbcBaseDAO {
String sql = StringUtilsExt.replaceArrayMerge(sqlInsertItemValue,
new String[] { "#tableName#", "#tablePrimaryValue#" }, new String[] { storedVO.getTableName(), "?" });
java.sql.Timestamp timestamp = new java.sql.Timestamp(date.toInstant().toEpochMilli());
Object[] params = new Object[] { storedVO.getValue(), timestamp, storedVO.getValue() };
Object[] params = new Object[] { timestamp, storedVO.getValue(), storedVO.getValue() };
logger.debug("JDBC::doStoreItemValue sql={} timestamp={} value='{}'", sql, timestamp, storedVO.getValue());
Yank.execute(sql, params);
}

View File

@ -42,20 +42,22 @@ public class StringUtilsExt {
* @return
*/
public static final String replaceArrayMerge(String str, String separate, Object[] separators) {
String s = str;
for (int i = 0; i < separators.length; i++) {
str = str.replaceFirst(separate, (String) separators[i]);
s = s.replaceFirst(separate, (String) separators[i]);
}
return str;
return s;
}
/**
* @see #replaceArrayMerge(String str, String separate, Object[] separators)
*/
public static final String replaceArrayMerge(String str, String[] separate, String[] separators) {
String s = str;
for (int i = 0; i < separators.length; i++) {
str = str.replaceFirst(separate[i], separators[i]);
s = s.replaceFirst(separate[i], separators[i]);
}
return str;
return s;
}
/**