开发者

Raw result rows with named fields in ScalaQuery?

开发者 https://www.devze.com 2023-03-20 08:59 出处:网络
In ScalaQuery, I can do this to work with the \"raw\" result rows: for ( x <- queryNA[(String,Int)](\"select * from foo\")(

In ScalaQuery, I can do this to work with the "raw" result rows:

for (
  x <- queryNA[(String,Int)]("select * from foo")(
    GetResult(r => (r.<<[String], r.<<[Int]))
  )
) {
  开发者_JAVA技巧println(x)
}

But this is entirely positional (r is a PositionedResult). Is there a way to work with the results using the column names? (E.g., row.getString("foo").)

I could use another DB API that supports this, like Querulous, but I'm already using ScalaQuery in my code for its type-safe queries, and would like to stick to just one library if possible.


From the ScalaQuery mailing list: you can get the underlying ResultSet with r.rs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号