All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wvlet.airframe.tablet.jdbc.ResultSetReader.scala Maven / Gradle / Ivy

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