DuckDBResultSet
com.softinio.duck4s.algebra.DuckDBResultSet
case class DuckDBResultSet(underlying: ResultSet, statement: Statement) extends AutoCloseable
A wrapper around a JDBC ResultSet that provides automatic resource management for both the result set and its associated statement.
This class is designed to be used with the using pattern or explicit resource management to ensure that both the underlying ResultSet and its Statement are properly closed when no longer needed. The class exports common ResultSet methods for convenient access.
Value parameters
- statement
-
the Statement that created this ResultSet, needed for proper cleanup
- underlying
-
the underlying JDBC ResultSet
Attributes
- See also
-
DuckDBConnection for creating result sets
DuckDBPreparedStatement for parameterized queries
- Since
-
0.1.0
- Example
-
import scala.util.Using // Automatic resource management val result = Using(connection.executeQuery("SELECT * FROM users")) { rs => while (rs.next()) { println(s"Name: ${rs.getString("name")}, Age: ${rs.getInt("age")}") } } // Or with explicit management val rs = connection.executeQuery("SELECT count(*) FROM users") try { if (rs.next()) { val count = rs.getInt(1) println(s"Total users: $count") } } finally { rs.close() // Closes both ResultSet and Statement }
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait AutoCloseableclass Objecttrait Matchableclass Any
Members list
In this article