Eric Thomas
03/29/2023, 10:10 PMaddLogger(StdOutSqlLogger)
but how can I access/interact with this info? ex:
Exposed: transaction { table.select { table.id eq 123 } }
Raw SQL ran against DB: SELECT * FROM TABLE WHERE ID = 123;
//desired result
val executedSql = SELECT * FROM TABLE WHERE ID = 123;
println(executedSql)
How can I access the raw sql executed against the DB?Alexey Soshin
03/30/2023, 11:52 AMtransaction {
val rawSQL = table.select { table.id eq 123 }.prepareSQL(this)
println(rawSQL)
}
Eric Thomas
03/30/2023, 3:59 PMobject TestTable : UUIDTable(columnName = "id", name = "test_table") {
val data = uuid("data")
}
class TestRecord(id: EntityID<UUID>) : UUIDEntity(id) {
var data by TestTable.data
}
val rawSQL = transaction {
TestRecord.findById(<id>).prepareSQL(this)
}
println("rawSQL: $rawSQL")
Alexey Soshin
03/31/2023, 10:22 AMfindById
, since it already returns you an Entity back, not a queryfindById
invocations will results in a query: some may find the data in cache