Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add Slick Extensions drivers
These are the drivers for DB2, Oracle and SQL Server from Slick Extensions 3.1.0, integrated into the main project and updated to work on master for 3.2. See http://slick.typesafe.com/news/2016/02/01/slick-extensions-licensing-change.html for details.
- Loading branch information
Showing
with
1,220 additions
and 64 deletions.
- +3 −8 README.md
- +3 −4 project/Build.scala
- +5 −0 slick-testkit/src/codegen/resources/dbs/oracle1.sql
- +5 −1 slick-testkit/src/codegen/scala/slick/test/codegen/GenerateMainSources.scala
- +65 −2 slick-testkit/src/main/resources/testkit-reference.conf
- +51 −0 slick-testkit/src/main/scala/com/typesafe/slick/testkit/tests/OracleExtraTests.scala
- +4 −1 slick-testkit/src/main/scala/com/typesafe/slick/testkit/util/BuildCapabilitiesTable.scala
- +88 −1 slick-testkit/src/main/scala/com/typesafe/slick/testkit/util/StandardTestDBs.scala
- +12 −0 slick-testkit/src/test/scala/slick/test/profile/ProfileTest.scala
- +7 −0 slick/src/main/resources/reference.conf
- +172 −0 slick/src/main/scala/slick/jdbc/DB2Profile.scala
- +408 −0 slick/src/main/scala/slick/jdbc/OracleProfile.scala
- +309 −0 slick/src/main/scala/slick/jdbc/SQLServerProfile.scala
- +1 −10 slick/src/sphinx/conf.py
- +0 −25 slick/src/sphinx/extensions.rst
- +0 −2 slick/src/sphinx/index.rst
- +0 −2 slick/src/sphinx/introduction.rst
- +4 −4 slick/src/sphinx/supported-databases.rst
- +2 −4 slick/src/sphinx/upgrade.rst
- +81 −0 test-dbs/README.md
@@ -0,0 +1,5 @@ | ||
CREATE TABLE "PERSON"( | ||
"ID" NUMBER(11,0) NOT NULL ENABLE, | ||
"PERSON_TYPE" CHAR(1 BYTE) DEFAULT 'Y' NOT NULL ENABLE, | ||
CONSTRAINT "PERSON_PK" PRIMARY KEY ("ID") | ||
); |
@@ -0,0 +1,51 @@ | ||
package com.typesafe.slick.testkit.tests | ||
|
||
import com.typesafe.slick.testkit.util.{AsyncTest, JdbcTestDB} | ||
import slick.jdbc.OracleProfile | ||
|
||
class OracleExtraTests extends AsyncTest[JdbcTestDB] { | ||
lazy val oracleProfile = tdb.profile.asInstanceOf[OracleProfile] | ||
import oracleProfile.api._ | ||
|
||
def testBlobCompare = { | ||
class A(tag: Tag) extends Table[(Int, Option[Array[Byte]])](tag, "a") { | ||
def id = column[Int]("id") | ||
def a = column[Option[Array[Byte]]]("a") | ||
def * = (id, a) | ||
} | ||
val as = TableQuery[A] | ||
|
||
DBIO.seq( | ||
as.schema.create, | ||
as += (1, Some(Array[Byte](1, 2, 3))), | ||
as.filter(_ => LiteralColumn[Option[Int]](None).isDefined).map(_.id).result.map(_ shouldBe Nil), | ||
as.filter(_ => LiteralColumn[Option[Int]](None).bind.isDefined).map(_.id).result.map(_ shouldBe Nil), | ||
as.filter(_.a.isEmpty).map(_.id).result.map(_ shouldBe Nil), | ||
as.filter(_.a === (Some(Array[Byte](1, 2, 3)): Option[Array[Byte]])).map(_.id).result.map(_ shouldBe Seq(1)), | ||
as.filter(_.a === (None: Option[Array[Byte]])).map(_.id).result.map(_ shouldBe Nil), | ||
as.filter(_.a === (Some(Array[Byte](1, 2, 3)): Option[Array[Byte]]).bind).map(_.id).result.map(_ shouldBe Seq(1)), | ||
as.filter(_.a === (None: Option[Array[Byte]]).bind).map(_.id).result.map(_ shouldBe Nil), | ||
as.filter(_ => LiteralColumn[Option[Int]](None) === (None: Option[Int])).map(_.id).result.map(_ shouldBe Nil) | ||
) | ||
} | ||
|
||
def testSequenceAndTriggerName = { | ||
class A(tag: Tag) extends Table[(Int, Int)](tag, "A_SEQTRG") { | ||
def id = column[Int]("ID", O.PrimaryKey, O.AutoInc, O.AutoIncSequenceName("SEQ_SEQTRG"), O.AutoIncTriggerName("TRG_SEQTRG")) | ||
def a = column[Int]("A") | ||
def * = (id, a) | ||
} | ||
val as = TableQuery[A] | ||
|
||
//as.schema.createStatements.foreach(println) | ||
as.schema.createStatements.should(_.find(_.contains("sequence \"SEQ_SEQTRG\"")).isDefined) | ||
as.schema.createStatements.should(_.find(_.contains("trigger \"TRG_SEQTRG\"")).isDefined) | ||
|
||
DBIO.seq( | ||
as.schema.create, | ||
as.map(_.a) ++= Seq(1, 2, 3), | ||
as.to[Set].result.map(_ shouldBe Set((1,1), (2,2), (3,3))), | ||
as.schema.drop | ||
) | ||
} | ||
} |
Oops, something went wrong.