init {
val config = HikariConfig()
- config.jdbcUrl = "jdbc:h2:~/.rssreader/feeds;TIME ZONE=UTC"
+ config.jdbcUrl = "jdbc:h2:~/.config/rssreader/feeds;TIME ZONE=UTC"
config.maximumPoolSize = 16
dataSource = HikariDataSource(config)
dataSource.connection.use { conn ->
conn.prepareStatement("""
- select * from feeds
+ select * from feeds where disabled = FALSE
""".trimIndent()).use { stmt ->
stmt.executeQuery().use { rs ->
while(rs.next()) {
dataSource.connection.use { conn ->
conn.prepareStatement("""
- select * from feeds where feedcollection_id = ?
+ select * from feeds where feedcollection_id = ? and disabled = FALSE
""".trimIndent()).use { stmt ->
stmt.setInt(1, feed.id)
stmt.executeQuery().use { rs ->
conn.prepareStatement("""
select f.* from feeds f
inner join feedcollections c on f.feedcollection_id = c.feedcollection_id
- where c.group_id = ?
+ where c.group_id = ? and disabled = FALSE
""".trimIndent()).use { stmt ->
stmt.setInt(1, group.id)
stmt.executeQuery().use { rs ->
select f.* from feeds f
inner join feedcollections c on f.feedcollection_id = c.feedcollection_id
where datediff(ss, coalesce(last_update, '1970-01-01'), now()) + 45 > case when c.update_interval > 0 then c.update_interval else ? end
+ and disabled = FALSE
""".trimIndent()).use { stmt ->
stmt.setInt(1, defaultInterval)
stmt.executeQuery().use { rs ->