1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2025-07-13 17:46:25 +00:00
This commit is contained in:
Vest
2018-04-04 19:20:04 +00:00
committed by GitHub
3 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View File

@ -13,4 +13,4 @@ dev/
todo todo
deploy.secret.sh deploy.secret.sh
release_notes.txt release_notes.txt
out out/

View File

@ -279,11 +279,11 @@ class Database private constructor(var client: TelegramClient) {
rs.next() rs.next()
val result = rs.getInt(1) val result = rs.getInt(1)
rs.close() rs.close()
return result return result
} catch (e: SQLException) { } catch (e: SQLException) {
throw RuntimeException("Could not get count of messages.") throw RuntimeException("Could not get count of messages.")
} }
} }
@Synchronized @Synchronized

View File

@ -109,10 +109,10 @@ class DatabaseUpdates(protected var conn: Connection, protected var db: Database
logger.debug("No update necessary.") logger.debug("No update necessary.")
} }
stmt.close()
} catch (e: SQLException) { } catch (e: SQLException) {
throw RuntimeException(e) throw RuntimeException(e)
} }
} }
private fun getUpdateToVersion(i: Int): DatabaseUpdate { private fun getUpdateToVersion(i: Int): DatabaseUpdate {
@ -143,7 +143,6 @@ internal abstract class DatabaseUpdate(protected var conn: Connection, protected
} catch (e: SQLException) { } catch (e: SQLException) {
throw RuntimeException(e) throw RuntimeException(e)
} }
} }
@Throws(SQLException::class) @Throws(SQLException::class)
@ -153,6 +152,8 @@ internal abstract class DatabaseUpdate(protected var conn: Connection, protected
_doUpdate() _doUpdate()
logger.debug("Saving current database version to the db") logger.debug("Saving current database version to the db")
stmt.executeUpdate("INSERT INTO database_versions (version) VALUES ($version)") stmt.executeUpdate("INSERT INTO database_versions (version) VALUES ($version)")
stmt.close()
} }
@Throws(SQLException::class) @Throws(SQLException::class)