-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EXPOSED-353 dateLiteral does not work on OracleDB 12c or 19c #1338
- Loading branch information
1 parent
d3c5dbc
commit 50619c5
Showing
2 changed files
with
50 additions
and
1 deletion.
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
42 changes: 42 additions & 0 deletions
42
exposed-java-time/src/test/kotlin/org/jetbrains/exposed/DateLiteralTest.kt
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,42 @@ | ||
package org.jetbrains.exposed | ||
|
||
import junit.framework.TestCase.assertNull | ||
import org.jetbrains.exposed.DateLiteralTest.TableWithDate.date | ||
import org.jetbrains.exposed.dao.id.IntIdTable | ||
import org.jetbrains.exposed.sql.StdOutSqlLogger | ||
import org.jetbrains.exposed.sql.addLogger | ||
import org.jetbrains.exposed.sql.insert | ||
import org.jetbrains.exposed.sql.javatime.date | ||
import org.jetbrains.exposed.sql.javatime.dateLiteral | ||
import org.jetbrains.exposed.sql.selectAll | ||
import org.jetbrains.exposed.sql.tests.DatabaseTestsBase | ||
import org.jetbrains.exposed.sql.tests.shared.assertEquals | ||
import org.junit.Test | ||
import java.time.LocalDate | ||
|
||
class DateLiteralTest : DatabaseTestsBase() { | ||
object TableWithDate : IntIdTable() { | ||
val date = date("date") | ||
} | ||
|
||
@Test | ||
fun testAbcDef() { | ||
withTables(TableWithDate) { | ||
addLogger(StdOutSqlLogger) | ||
|
||
val future = LocalDate.of(3000, 1, 1) | ||
val past = LocalDate.of(1500, 1, 1) | ||
TableWithDate.insert { | ||
it[date] = future | ||
} | ||
|
||
assertEquals(future, TableWithDate.selectAll().first()[date]) | ||
|
||
assertEquals(future, TableWithDate.selectAll().where { date greater past }.first()[date]) | ||
|
||
assertEquals(future, TableWithDate.selectAll().where { date greater dateLiteral(past) }.first()[date]) | ||
|
||
assertNull(TableWithDate.selectAll().where { date less dateLiteral(past) }.firstOrNull()) | ||
} | ||
} | ||
} |