wvlet.airframe.tablet.jdbc.ResultSetReader.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of airframe-tablet_2.13.0-RC2 Show documentation
Show all versions of airframe-tablet_2.13.0-RC2 Show documentation
Data format conversion library
The newest version!
package wvlet.airframe.tablet.jdbc
import java.sql.ResultSet
import wvlet.airframe.codec.JDBCCodec
import wvlet.airframe.msgpack.spi.MessagePack
import wvlet.airframe.tablet.{MessagePackRecord, Record, Schema, TabletReader}
import wvlet.log.LogSupport
/**
*
*/
class ResultSetReader(rs: ResultSet) extends TabletReader with LogSupport {
private lazy val codec = new JDBCCodec.ResultSetCodec(rs)
override def read: Option[Record] = {
if (!rs.next()) {
None
} else {
val p = MessagePack.newBufferPacker
codec.packRowAsArray(p)
val arr = p.toByteArray
Some(MessagePackRecord(arr))
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy