Browse Source

Anpassung für KV Datumsformat in Konnaktoren

master
Daniel Quathamer 3 hours ago
parent
commit
c52dbcf7f3
  1. 14
      src/de/superx/spring/DatabaseUtils.java
  2. 29
      src/de/superx/util/DbUtils.java
  3. BIN
      superx/WEB-INF/lib/superx6.0.jar

14
src/de/superx/spring/DatabaseUtils.java

@ -294,11 +294,17 @@ public class DatabaseUtils { @@ -294,11 +294,17 @@ public class DatabaseUtils {
conf.setConnectionTimeout(connectionTimeout);
// in HISinOne-BI context: Set PostgreSQL variables to be consistent with
// HISinOne itself (which also does some settings - see "DbHandler")
if (co.get(DbPropertyName.jdbcDriver.name()).equals(org.postgresql.Driver.class.getCanonicalName()) &&
System.getProperty(SuperXManager.SUPER_X_HISINONE_VERSION) != null) {
conf.setConnectionInitSql("SET standard_conforming_strings TO 'off'; SET datestyle TO 'ISO, DMY';");
if (co.get(DbPropertyName.jdbcDriver.name()).equals(org.postgresql.Driver.class.getCanonicalName())) {
if (System.getProperty(SuperXManager.SUPER_X_HISINONE_VERSION) != null) {
conf.setConnectionInitSql(
"SET standard_conforming_strings TO 'off'; SET datestyle TO 'ISO, DMY';"
);
} else if ("eduetl".equals(connectionName)) {
conf.setConnectionInitSql(
"SET datestyle TO 'ISO, DMY';"
);
}
}
String minConnectionsStr = co.get("poolsize_min");
String maxConnectionsStr = co.get("poolsize_max");
int defaultPoolSize = "eduetl".equals(connectionName) ? AppConfig.EDUETL_POOL_SIZE : AppConfig.DEFAULT_POOL_SIZE;

29
src/de/superx/util/DbUtils.java

@ -3,6 +3,12 @@ package de.superx.util; @@ -3,6 +3,12 @@ package de.superx.util;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.sql.*;
public final class DbUtils {
private DbUtils() { }
@ -15,4 +21,27 @@ public final class DbUtils { @@ -15,4 +21,27 @@ public final class DbUtils {
return count != null && count.intValue() > 0;
}
/**
* Ein resultset in eine Liste aus String-Maps konvertieren
*
* @param ResultSet
* @return List<Map<String, String>>
*/
public static List<Map<String, String>> resultSetToStringList(ResultSet rs) throws SQLException {
List<Map<String, String>> resultList = new ArrayList<>();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount = metaData.getColumnCount();
while (rs.next()) {
Map<String, String> row = new HashMap<>();
for (int i = 1; i <= columnCount; i++) {
String columnName = metaData.getColumnName(i);
String value = rs.getString(i);
row.put(columnName, value);
}
resultList.add(row);
}
return resultList;
}
}

BIN
superx/WEB-INF/lib/superx6.0.jar

Binary file not shown.
Loading…
Cancel
Save