Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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
20 changed files
with
1,220 additions
and
64 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
); |
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
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
51 changes: 51 additions & 0 deletions
51
slick-testkit/src/main/scala/com/typesafe/slick/testkit/tests/OracleExtraTests.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.