anpasssung DB Verbindung und Ini ausgabe

This commit is contained in:
Sebastian Zeidler
2019-08-09 17:13:55 +02:00
parent 2b72562170
commit 2f91ce6e4f
8 changed files with 95 additions and 6 deletions

View File

@ -4,6 +4,8 @@ import java.sql.*;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
public class db_connect extends DB.base {
@ -50,7 +52,41 @@ public class db_connect extends DB.base {
close();
}
/**
*
* @param channelId
* @return
*/
public Map<String, String> getChannelSettings(String channelId) {
Map<String, String> result = new HashMap<>();
result.put("lang", "de");
if(!isActive()) {
result.put("sqlActive", "0");
return result;
}
open();
try {
conn = getConn();
String SQL_SELECT = "SELECT * FROM shadowrun_channelSettings where channelId = ?";
PreparedStatement preparedStatement = conn.prepareStatement(SQL_SELECT);
preparedStatement.setString(1, channelId);
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
result.remove("lang");
result.put("lang", rs.getString("lang"));
}
}
catch (SQLException e) {
e.printStackTrace();
}
close();
return result;
}
}
/*
@ -65,5 +101,15 @@ public class db_connect extends DB.base {
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
;
CREATE TABLE `shadowrun_log` (
`id` INT NOT NULL AUTO_INCREMENT,
`zeitstempel` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`channelId` VARCHAR(50) NOT NULL DEFAULT '0',
`lang` VARCHAR(255) NOT NULL DEFAULT 'de'
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
;
*/