Last active
October 6, 2018 10:17
-
-
Save keirlawson/5b4d1f5dabacb9d5c564263b22313665 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class BigString(value: String) extends AnyVal | |
def getClob(rs: ResultSet, i: Int): BigString = { | |
val clob = rs.getClob(i) | |
val str = Source.fromInputStream(clob.getAsciiStream).mkString | |
BigString(str) | |
} | |
def setClob(ps: PreparedStatement, i: Int, bs: BigString): Unit = { | |
val reader = new StringReader(bs.value) | |
ps.setClob(i, reader) | |
} | |
def updateClob(rs: ResultSet, i: Int, bs: BigString): Unit = { | |
val reader = new StringReader(bs.value) | |
rs.updateClob(i, reader) | |
} | |
implicit val ClobMeta: Meta[BigString] = Meta.advanced(NonEmptyList.of(JdbcType.Clob), NonEmptyList.of("CLOB"), getClob, setClob, updateClob) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment