Is it possible to set sqlite pragma when using exposed. I tried calling exec but it throws an exception "Query returns results"
t
tapac
02/04/2020, 5:46 PM
Try to define custom statement:
Copy code
fun main() {
//...
transaction.exec(PragmaStatement("automatic_index"))
}
class PragmaStatement(val value: String) : Statement<Unit>(StatementType.OTHER, emptyList()) {
override fun arguments(): Iterable<Iterable<Pair<IColumnType, Any?>>> = emptyList()
override fun prepareSQL(transaction: Transaction): String = "PRAGMA $value"
override fun PreparedStatement.executeInternal(transaction: Transaction): Unit? {
this.executeUpdate()
return null
}
}
a
Abby
02/04/2020, 7:12 PM
Thanks, I'll give that ago tomorrow. 😄 Looks promising very promising as I'd got as far as the fact it was using the UpdateStatement class and that throws the exception