LoginSignup
2
0

More than 5 years have passed since last update.

ResultSet からの値取得を Scala っぽく書くには

Posted at

IteratorResultSet を回して Tuple にするなり case class にするなりが一番素直なのかなぁと。

val rs:java.sql.ResultSet = ???
Iterator.continually{ rs }.takeWhile{ _.next() }.map{ rs =>
  (rs.getInt(1), rs.getString(2), ...)
}
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0