Fixed parameter ordering while storing values (#12467)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
8e414d45a0
commit
9e6b901d53
@ -343,7 +343,7 @@ public class JdbcBaseDAO {
|
|||||||
String sql = StringUtilsExt.replaceArrayMerge(sqlInsertItemValue,
|
String sql = StringUtilsExt.replaceArrayMerge(sqlInsertItemValue,
|
||||||
new String[] { "#tableName#", "#tablePrimaryValue#" }, new String[] { storedVO.getTableName(), "?" });
|
new String[] { "#tableName#", "#tablePrimaryValue#" }, new String[] { storedVO.getTableName(), "?" });
|
||||||
java.sql.Timestamp timestamp = new java.sql.Timestamp(date.toInstant().toEpochMilli());
|
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());
|
logger.debug("JDBC::doStoreItemValue sql={} timestamp={} value='{}'", sql, timestamp, storedVO.getValue());
|
||||||
Yank.execute(sql, params);
|
Yank.execute(sql, params);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,20 +42,22 @@ public class StringUtilsExt {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static final String replaceArrayMerge(String str, String separate, Object[] separators) {
|
public static final String replaceArrayMerge(String str, String separate, Object[] separators) {
|
||||||
|
String s = str;
|
||||||
for (int i = 0; i < separators.length; i++) {
|
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)
|
* @see #replaceArrayMerge(String str, String separate, Object[] separators)
|
||||||
*/
|
*/
|
||||||
public static final String replaceArrayMerge(String str, String[] separate, String[] separators) {
|
public static final String replaceArrayMerge(String str, String[] separate, String[] separators) {
|
||||||
|
String s = str;
|
||||||
for (int i = 0; i < separators.length; i++) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user