Slick 3.0.0 中纯 SQL 查询的 Blob 或 BYTEA
Blob or BYTEA from Plain SQL Query in Slick 3.0.0
我正在尝试使用 Slick 3.0.0return 来自 Postgres 9.4 数据库的 BLOB
我的简单尝试是
import slick.driver.PostgresDriver.api._
import slick.jdbc.JdbcBackend.Database
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
object QueryRunner extends App {
val db = Database.forURL("jdbc:postgresql://localhost:5432/test","test_migration","test_migration",driver = "org.postgresql.Driver")
def selectRegions = sql"Select region_data from test.regions".as[java.sql.Blob]
val result = db.run(selectRegions)
val regionData = Await.result(result,1.seconds)}
那return就是我
错误:(16, 65) 找不到参数 rconv 的隐式值:slick.jdbc.GetResult[java.sql.Blob]
def selectRegions = sql"Select region_data from core.regions".as[java.sql.Blob]
我觉得既然 Blob 和 BYTEA 有点专业,我一定是缺少导入?
Slick 的标准 Postgres 驱动程序目前不支持 Blob 以及许多其他特定于 Postgres 的类型。见 http://slick.typesafe.com/doc/3.1.0-M1/schemas.html:
The following primitive types are supported out of the box for
JDBC-based databases in JdbcProfile (with certain limitations imposed
by the individual database drivers):
Numeric types: Byte, Short, Int, Long, BigDecimal, Float, Double
LOB types: java.sql.Blob, java.sql.Clob, Array[Byte]
Date types: java.sql.Date, java.sql.Time, java.sql.Timestamp
Boolean
String
Unit
java.util.UUID
社区努力在修改后的 Postgres 驱动程序中添加对其他类型的支持。您可以监控这项工作的结果:https://github.com/tminglei/slick-pg.
我正在尝试使用 Slick 3.0.0return 来自 Postgres 9.4 数据库的 BLOB
我的简单尝试是
import slick.driver.PostgresDriver.api._
import slick.jdbc.JdbcBackend.Database
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
object QueryRunner extends App {
val db = Database.forURL("jdbc:postgresql://localhost:5432/test","test_migration","test_migration",driver = "org.postgresql.Driver")
def selectRegions = sql"Select region_data from test.regions".as[java.sql.Blob]
val result = db.run(selectRegions)
val regionData = Await.result(result,1.seconds)}
那return就是我
错误:(16, 65) 找不到参数 rconv 的隐式值:slick.jdbc.GetResult[java.sql.Blob] def selectRegions = sql"Select region_data from core.regions".as[java.sql.Blob]
我觉得既然 Blob 和 BYTEA 有点专业,我一定是缺少导入?
Slick 的标准 Postgres 驱动程序目前不支持 Blob 以及许多其他特定于 Postgres 的类型。见 http://slick.typesafe.com/doc/3.1.0-M1/schemas.html:
The following primitive types are supported out of the box for JDBC-based databases in JdbcProfile (with certain limitations imposed by the individual database drivers):
Numeric types: Byte, Short, Int, Long, BigDecimal, Float, Double
LOB types: java.sql.Blob, java.sql.Clob, Array[Byte]
Date types: java.sql.Date, java.sql.Time, java.sql.Timestamp
Boolean
String
Unit
java.util.UUID
社区努力在修改后的 Postgres 驱动程序中添加对其他类型的支持。您可以监控这项工作的结果:https://github.com/tminglei/slick-pg.