forked from zio/zio-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
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
* 154: (Draft) Implement `renderUpate` for Oracle * zio#154: (Draft) Implement `renderUpdate` for Oracle * zio#154: Implement `renderUpdate` for Oracle * zio#154: Extend tests of `renderUpdate` for Oracle * zio#154: fix formatting * zio#154: fix 2.12.15 compatibility * zio#154: adjust docs * zio#154: fix non-related flaky test
- Loading branch information
Showing
9 changed files
with
141 additions
and
53 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
33 changes: 0 additions & 33 deletions
33
oracle/src/test/scala/zio/sql/oracle/OracleModuleSpec.scala
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
oracle/src/test/scala/zio/sql/oracle/OracleSqlModuleSpec.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,62 @@ | ||
package zio.sql.oracle | ||
|
||
import zio.test.Assertion._ | ||
import zio.test.TestAspect._ | ||
import zio.test._ | ||
|
||
import scala.language.postfixOps | ||
|
||
object OracleSqlModuleSpec extends OracleRunnableSpec with ShopSchema { | ||
|
||
import Customers._ | ||
|
||
override def specLayered: Spec[SqlDriver, Exception] = suite("Oracle module")( | ||
test("Can update selected rows") { | ||
|
||
/** | ||
* UPDATE customers SET customers.first_name = 'Antek' | ||
* WHERE 1 = 1 and customers.verified = 0 and customers.verified <> 1 | ||
*/ | ||
val query = | ||
update(customers) | ||
.set(fName, "Antek") | ||
.where(verified isNotTrue) | ||
.where(verified <> true) // we intentionally verify two syntax variants | ||
|
||
assertZIO(execute(query))(equalTo(1)) | ||
}, | ||
test("Can update all rows") { | ||
|
||
/** | ||
* UPDATE customers SET customers.first_name = 'Antek' WHERE 1 = 1 | ||
*/ | ||
val query = update(customers).set(fName, "Antek") | ||
|
||
assertZIO(execute(query))(equalTo(5)) | ||
}, | ||
test("Can delete from single table with a condition") { | ||
|
||
/** | ||
* DELETE FROM customers WHERE customers.verified = 0 | ||
*/ | ||
val query = deleteFrom(customers) where (verified isNotTrue) | ||
|
||
val expected = 1 | ||
val result = execute(query) | ||
|
||
assertZIO(result)(equalTo(expected)) | ||
}, | ||
test("Can delete all from a single table") { | ||
|
||
/** | ||
* DELETE FROM customers | ||
*/ | ||
val query = deleteFrom(customers) | ||
|
||
val expected = 4 | ||
val result = execute(query) | ||
|
||
assertZIO(result)(equalTo(expected)) | ||
} | ||
) @@ sequential | ||
} |
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