hello.
i have found an issue. when running mysql on Windows table name are created in lower case ie: instead of creating the 'Version' table 'version' is created instead.
Mysql the so not uber database so old code base that is ridiculous such product survive an thrive in the face of mariaDB.
Mysql on windows cause problems for checkVersion() method witch cant retrive the version since it look for table name "Version"
the faulty code
//recreateTable() alway get trigered because currentVersion always=0
/**
* Private constructor (due to Singleton)
*/
public DatabaseManagerImpl() {
connetion = new ConnectionDB();
final int currentVersion = connetion.checkVersion();
BotLogger.info(LOGTAG, "Current db version: " + currentVersion);
if (currentVersion < CreationStrings.version) {
recreateTable(currentVersion); // <=========== alway run since currentVersion=0
}
}
and my patched version of ConnectionDB().checkVersion() to ignore case (i used compareToIgnore() case instead of String.compare())
public int checkVersion() {
int max = 0;
try {
final DatabaseMetaData metaData = this.currentConection.getMetaData();
final ResultSet res = metaData.getTables(null, null, "",
new String[]{"TABLE"});
while (res.next()) {
String tmp=res.getString("TABLE_NAME");
if (res.getString("TABLE_NAME").compareToIgnoreCase("Versions") == 0) {
final ResultSet result = runSqlQuery("SELECT Max(Version) FROM Versions");
while (result.next()) {
max = (max > result.getInt(1)) ? max : result.getInt(1);
}
}
}
} catch (SQLException e) {
BotLogger.error(LOGTAG, e);
}
return max;
}
Now newer Mysql server enforce Feature of timeShifting cause driver to fails when trying to retrive a connection handle with message that you need to adjust timeshift & timezone ! i realy hate mysql
workaround for me not sure if it is a one size fits all: (appended useJDBCCompliantTimezoneShift,useLegacyDatetimeCode,serverTimezone)
static final String linkDB = "jdbc:mysql://localhost:3306/" + databaseName + "?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
i also have a couple of question
- I have to retrieve text message and photo posted by the users participating in a public channel & realtime . But didn't found any idea on how to do nor if the MessageHandler is on any use.
2)What channel the Deepthought bot is supposed to be listenning to ?
thanks very much for the TelegramAPI by the way the Deepthought maven dep dont use the latest
so i tuned the pom.xml:
<telegramapi.version>66.2</telegramapi.version>
hello.
i have found an issue. when running mysql on Windows table name are created in lower case ie: instead of creating the 'Version' table 'version' is created instead.
Mysql the so not uber database so old code base that is ridiculous such product survive an thrive in the face of mariaDB.
Mysql on windows cause problems for checkVersion() method witch cant retrive the version since it look for table name "Version"
the faulty code
//recreateTable() alway get trigered because currentVersion always=0
and my patched version of ConnectionDB().checkVersion() to ignore case (i used compareToIgnore() case instead of String.compare())
Now newer Mysql server enforce Feature of timeShifting cause driver to fails when trying to retrive a connection handle with message that you need to adjust timeshift & timezone ! i realy hate mysql
workaround for me not sure if it is a one size fits all: (appended useJDBCCompliantTimezoneShift,useLegacyDatetimeCode,serverTimezone)
i also have a couple of question
2)What channel the Deepthought bot is supposed to be listenning to ?
thanks very much for the TelegramAPI by the way the Deepthought maven dep dont use the latest
so i tuned the pom.xml: