Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #127 from slick/tmp/dont-lift-bound-rows
Throw an exception when trying to lift a bound table row to a Query.
  • Loading branch information
szeiger committed Apr 9, 2013
2 parents 3806205 + 2e5dc1b commit acad723
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/scala/scala/slick/driver/JdbcProfile.scala
Expand Up @@ -6,6 +6,7 @@ import scala.slick.compiler.QueryCompiler
import scala.slick.lifted._
import scala.slick.jdbc.{CompileInsert, JdbcCodeGen, JdbcBackend, JdbcType, MappedJdbcType}
import scala.slick.profile.{SqlDriver, SqlProfile, Capability}
import scala.slick.SlickException

/**
* A profile for accessing SQL databases via JDBC.
Expand Down Expand Up @@ -36,7 +37,10 @@ trait JdbcProfile extends SqlProfile with JdbcTableComponent
implicit val slickDriver: driver.type = driver
implicit def columnToOptionColumn[T : BaseTypedType](c: Column[T]): Column[Option[T]] = c.?
implicit def valueToConstColumn[T : TypedType](v: T) = new ConstColumn[T](v)
implicit def tableToQuery[T <: AbstractTable[_]](t: T) = Query[T, NothingContainer#TableNothing, T](t)(Shape.tableShape)
implicit def tableToQuery[T <: AbstractTable[_]](t: T) = {
if(t.op ne null) throw new SlickException("Trying to implicitly lift a single table row to a Query. If this is really what you want, use an explicit Query(...) call instead")
Query[T, NothingContainer#TableNothing, T](t)(Shape.tableShape)
}
implicit def columnToOrdered[T](c: Column[T]): ColumnOrdered[T] = c.asc
implicit def ddlToDDLInvoker(d: DDL): DDLInvoker = new DDLInvoker(d)
implicit def queryToQueryInvoker[T, U](q: Query[T, _ <: U]): QueryInvoker[U] = createQueryInvoker[U](selectStatementCompiler.run(Node(q)).tree)
Expand Down

0 comments on commit acad723

Please sign in to comment.