fixed parent selector
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -15,7 +15,6 @@ import static java.lang.System.Logger.Level.*;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.xrbpowered.jparsedown.JParsedown;
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import de.srsoftware.tools.Query;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
@@ -27,12 +26,13 @@ import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Util {
|
||||
@@ -188,4 +188,19 @@ jspreadsheet(document.getElementById('spreadsheet'), {
|
||||
public static String dateTimeOf(long epochMilis){
|
||||
return LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMilis), ZoneId.systemDefault()).format(TIME_FORMATTER);
|
||||
}
|
||||
|
||||
public static String toJson(ResultSet rs) {
|
||||
try {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
var meta = rs.getMetaData();
|
||||
for (int col = 1; col <= meta.getColumnCount(); col++) {
|
||||
var key = meta.getColumnName(col);
|
||||
var val = rs.getObject(col);
|
||||
map.put(key, val);
|
||||
}
|
||||
return new JSONObject(map).toString();
|
||||
} catch (SQLException e){
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user