mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
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,
|
||||
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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user