mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
Fixed issue #94 by closing open statements
added out/ (IntelliJ) to .gitignore Signed-off-by: Vest <Vest@users.noreply.github.com>
This commit is contained in:
parent
79b68bd93d
commit
f3e226e43f
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ dev/
|
|||||||
todo
|
todo
|
||||||
deploy.secret.sh
|
deploy.secret.sh
|
||||||
release_notes.txt
|
release_notes.txt
|
||||||
|
out/
|
||||||
|
@ -278,11 +278,14 @@ class Database private constructor(var client: TelegramClient) {
|
|||||||
try {
|
try {
|
||||||
val rs = stmt!!.executeQuery(query)
|
val rs = stmt!!.executeQuery(query)
|
||||||
rs.next()
|
rs.next()
|
||||||
return rs.getInt(1)
|
|
||||||
|
val result = rs.getInt(1)
|
||||||
|
|
||||||
|
rs.close()
|
||||||
|
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
|
||||||
|
@ -111,10 +111,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 {
|
||||||
@ -145,7 +145,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)
|
||||||
@ -155,6 +154,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)
|
||||||
|
Loading…
Reference in New Issue
Block a user