kotlin-exposed

Is there a way to run raw sql with Kotlin's Exposed library

时光毁灭记忆、已成空白 提交于 2020-05-14 21:51:43
问题 I'm trying to run some sql specific to postgres and would like to reuse the transaction management within Exposed. 回答1: With help from Kiskae's answer, I was able to run the raw sql with: transaction { val conn = TransactionManager.current().connection val statement = conn.createStatement() val query = "REFRESH MATERIALIZED VIEW someview" statement.execute(query) } 回答2: Exposed has the Transaction.exec(String) method which probably does what you want. See https://github.com/JetBrains/Exposed