profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/Tapac/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Andrey.Tarashevskiy Tapac JetBrains

JetBrains/kara 74

A web development framework written Kotlin

TanVD/AORM 26

Clickhouse Kotlin SQL Framework

TanVD/kosogor 19

Defaults and simplified Kotlins-DSL interfaces for Gradle

JetBrains/exposed-intellij-plugin 12

Exposed Kotlin ORM framework gradle and intellij plugins

Tapac/exposed-wiki 5

Repository for Exposed wiki Pull Requests

TanVD/konfy 4

Statically typed configurations for Kotlin

TanVD/JetAudit 2

Clickhouse Logging Library

Tapac/disposable-email-domains 1

a list of disposable and temporary email address domains

Tapac/kotlin 1

The Kotlin Programming Language

kozobrodov/ADM 0

Tool for automation of "anonymous Ded Moroz" game

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 90ec36f58be0038eb46a257e569b96ed0dcb33b0

Add support for order by nulls first/last if db dialect supports it (#1344) / Workaround for MySQL and SQLServer

view details

push time in 8 hours

push eventJetBrains/Exposed

Erwin Wessels

commit sha 6b2f8734d0b24dc4d38697f6adba39b0d0c53bd3

Add support for order by nulls first/last if db dialect supports it (#1344) * Add support for order by nulls first last if db dialect supports it * Add tests for order by nulls first / last * Loose unrelated change

view details

push time in 9 hours

PR merged JetBrains/Exposed

Add support for order by nulls first/last if db dialect supports it

This PR implements a solution for #1343, and adds support for specifying if nulls must be sorted first or last, enabling the following syntax:

SELECT * FROM my_table ORDER BY my_name ASC NULLS FIRST;

This syntax is not supported by all supported vendors (looking at you, SQL Server & MySQL!), so I've added the ability to specify in the syntax whether this is supported or not. If this feature is not supported, attempting to use it will throw an IllegalStateException.

+58 -5

0 comment

9 changed files

erwinw

pr closed time in 9 hours

issue closedJetBrains/Exposed

Kotlinx.datetime support

It would be great to have a native integration with Kotlinx.datetime in addition to JodaTime and the native Java implementation.

closed time in 9 hours

Kernald

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 0420294cb6cf0a2ae9e1362100b9926c5edb8f1e

Remove empty exposed module

view details

Andrey.Tarashevskiy

commit sha bd4e5195f8566c7d636ddf93739fb092f0f06629

Kotlinx.datetime support #1325 / Fix for mysql-connector 8

view details

push time in 10 hours

issue commentJetBrains/Exposed

Can't resolve versions with BOM

Can you please check 0.34.2 build?

takaki-hoshikawa-m3

comment created time in 14 hours

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 6caedec2851656c6a9f21a801d2f86f4178d350b

Compilation fix after Kotlin 1.5.30 update

view details

Andrey.Tarashevskiy

commit sha 37d35a57b191d704952d35c131faecd9a3cbcd70

Release 0.17.14

view details

push time in 15 hours

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 7fa6e0ec6ea42a77ea620f6789a74ea1cef42986

Use @Language from jetbrains annotations for raw sql input methods #1337

view details

Andrey.Tarashevskiy

commit sha 4ea85c3110e00562f578e15c5972d7ae0f60e93a

Release 0.17.14

view details

push time in 15 hours

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha be6e761678d3c1b927c48a2bac92bf4cf5c35ffd

Bump kotlin 1.5.30, kotlinx-coroutines 1.5.2, joda-time 2.10.10,

view details

push time in 15 hours

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha a846dc4635d215cdd4a8d8a89bb750cb2690e8fc

kotlin gradle plugin updated 1.5.30

view details

Andrey.Tarashevskiy

commit sha 9ca11124cf1fe8feb7b1f5777e5a6c34f836f658

Kotlinx.datetime support #1325

view details

push time in 17 hours

issue commentJetBrains/Exposed

R2DBC support

The work in progress, you can check rdbc-poc branch and try to build it localy. R2DBC connecion will require also jdbc connection for operations with Schemas as R2DBC doesn't provide any api for extracting metadata. The example of how to connect with R2DBC can be found in tests

NorbertSandor

comment created time in a day

issue commentJetBrains/Exposed

Inline transaction

Yep, there is repetitionAttempt param in transacation.

hfhbd

comment created time in a day

issue commentJetBrains/Exposed

Inline transaction

It won't help as transaction's statement can't be marked with InvocationKind.AT_MOST_ONCE and it will prohibit. You can try something like:

@OptIn(ExperimentalContracts::class)
inline fun <T> transactionCallOnce(db: Database?, noinline statement: Transaction.() -> T): T {
    contract {
        callsInPlace(statement, InvocationKind.EXACTLY_ONCE)
    }
    return transaction(db.transactionManager.defaultIsolationLevel, 1, db, statement)
}

val user: User
transactionCallOnce {
   user = Users[42]
}

IDEA highlights that inline here can affect performance so you can remove inline and noinline and it still should work.

hfhbd

comment created time in a day

CommitCommentEvent

issue commentJetBrains/Exposed

Inline transaction

You can simply write

val user = transaction {
    Users[42]
}

but if you need to assign to val then only way is to define your own transaction function with contract and call Exposed transaction with repetition attempt 1.

hfhbd

comment created time in 2 days

created tagJetBrains/Exposed

tag0.34.2

Kotlin SQL Framework

created time in 2 days

release JetBrains/Exposed

0.34.2

released time in 2 days

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 2d138388c9eb6ce37ba9c26d275af523d705c405

Exposed release 0.34.1

view details

push time in 2 days

push eventJetBrains/Exposed

Clark Perkins

commit sha 04d9515bff7a1820a395169646d2bf2d55f19426

Fix bom for gradle projects (#1340)

view details

push time in 2 days

PR merged JetBrains/Exposed

Fix bom for gradle projects

When adding the bom as a gradle platform, like this:

implementation(platform("org.jetbrains.exposed:exposed-bom:0.34.1"))

Gradle fails with the following error:

         > No matching variant of org.jetbrains.exposed:exposed-core:0.34.1 was found. The consumer was configured to find an API of a component compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.gradle.category' with value 'platform', attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm', attribute 'javaModule' with value 'true' but:
             - Variant 'apiElements' capability org.jetbrains.exposed:exposed-core:0.34.1 declares an API of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                 - Incompatible because this component declares a component, as well as attribute 'org.gradle.category' with value 'library' and the consumer needed a component, as well as attribute 'org.gradle.category' with value 'platform'

This change resolves that error.

+1 -1

0 comment

1 changed file

clarkperkins

pr closed time in 2 days

issue closedJetBrains/Exposed

Use @Language from jetbrains annotations for raw sql input methods

Use @Language from jetbrains annotations for raw sql input methods

closed time in 2 days

Janmm14

issue commentJetBrains/Exposed

Use @Language from jetbrains annotations for raw sql input methods

Nice catch. Thank you for the idea.

Janmm14

comment created time in 2 days

push eventJetBrains/Exposed

Andrey.Tarashevskiy

commit sha 6e87761a0841589f8ebeb4f08e2c79e161972c40

Use @Language from jetbrains annotations for raw sql input methods #1337

view details

push time in 2 days

issue commentJetBrains/Exposed

SchemaUtils.createMissingTablesAndColumns

Can you specify the database on which it fails and also please attach tables mapping to check

Bqckword

comment created time in 2 days

issue closedJetBrains/Exposed

SELECT COUNT

SELECT user.id (select count(*) from user_role where user_role.user_id = user.id) FROM user

closed time in 2 days

Hell-Hope

push eventJetBrains/Exposed

Ray Smith

commit sha 26aea1e2b9dc929bba8fb2472c6c532b321014a9

fix database name extension property (#1322)

view details

push time in 2 days

PR merged JetBrains/Exposed

fix database name extension property

When using the serverTimezone (e.g. Europe/Moscow) parameter when connecting to a database, the property returned wrong the database name

+1 -1

2 comments

1 changed file

RaySmith-ttc

pr closed time in 2 days

pull request commentJetBrains/Exposed

fix database name extension property

@RaySmith-ttc Oh, nice catch! Thank you for the fix

RaySmith-ttc

comment created time in 2 days

issue closedJetBrains/Exposed

newSuspendedTransaction often doesn't honor TransactionManager.defaultDatabase changes

With the transaction {} DSL, changes made to TransactionManager.defaultDatabase seem to automatically get picked up, even across multiple threads. It seems like the same cannot be said for the newSuspendedTransaction {} DSL, as evidenced by the following tests:

diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/h2/MultiDatabaseTest.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/h2/MultiDatabaseTest.kt
index b9568ea1..95abd990 100644
--- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/h2/MultiDatabaseTest.kt
+++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/h2/MultiDatabaseTest.kt
@@ -1,6 +1,7 @@
 package org.jetbrains.exposed.sql.tests.h2
 
 import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.newSingleThreadContext
 import kotlinx.coroutines.runBlocking
 import org.jetbrains.exposed.sql.*
 import org.jetbrains.exposed.sql.tests.shared.assertEqualLists
@@ -16,7 +17,9 @@ import org.jetbrains.exposed.sql.transactions.transactionManager
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
+import java.util.concurrent.Executors
 import kotlin.test.assertEquals
+import kotlin.test.assertNotEquals
 
 class MultiDatabaseTest {
 
@@ -225,4 +228,56 @@ class MultiDatabaseTest {
         assertEquals(TransactionManager.defaultDatabase, db2)
         TransactionManager.defaultDatabase = null
     }
+
+    @Test // this test always fails for one reason or another
+    fun `when the default database is changed, coroutines should respect that`(): Unit = runBlocking {
+        assertEquals("jdbc:h2:mem:db1", db1.name) // These two asserts fail sometimes for reasons that escape me
+        assertEquals("jdbc:h2:mem:db2", db2.name) // but if you run just these tests one at a time, they pass.
+        val coroutineDispatcher1 = newSingleThreadContext("first")
+        TransactionManager.defaultDatabase = db1
+        newSuspendedTransaction(coroutineDispatcher1) {
+            assertEquals(db1.name, TransactionManager.current().db.name) // when running all tests together, this one usually fails
+            TransactionManager.current().exec("SELECT 1") { rs ->
+                rs.next()
+                assertEquals(1, rs.getInt(1))
+            }
+        }
+        TransactionManager.defaultDatabase = db2
+        newSuspendedTransaction(coroutineDispatcher1) {
+            assertEquals(db2.name, TransactionManager.current().db.name) // fails??
+            TransactionManager.current().exec("SELECT 1") { rs ->
+                rs.next()
+                assertEquals(1, rs.getInt(1))
+            }
+        }
+    }
+
+    @Test // If the first two assertions pass, the entire test passes
+    fun `when the default database is changed, threads should respect that`() {
+        assertEquals("jdbc:h2:mem:db1", db1.name)
+        assertEquals("jdbc:h2:mem:db2", db2.name)
+        val threadpool = Executors.newSingleThreadExecutor()
+        TransactionManager.defaultDatabase = db1
+        threadpool.submit {
+            transaction {
+                assertEquals(db1.name, TransactionManager.current().db.name)
+                TransactionManager.current().exec("SELECT 1") { rs ->
+                    rs.next()
+                    assertEquals(1, rs.getInt(1))
+                }
+            }
+        }
+            .get()
+        TransactionManager.defaultDatabase = db2
+        threadpool.submit {
+            transaction {
+                assertEquals(db2.name, TransactionManager.current().db.name)
+                TransactionManager.current().exec("SELECT 1") { rs ->
+                    rs.next()
+                    assertEquals(1, rs.getInt(1))
+                }
+            }
+        }
+            .get()
+    }
 }

I'm not sure if this is expected behavior or not, but as an end user, it's at least surprising behavior.

Observed in exposed 0.33.1 and tip of master (2733dc282b2f7d91555654079f77d142812b2377 at time of report).

Context

We have a lot of database integration tests. For isolation between them, we create a new database for each test. However, as you might guess from this report, sometimes the threadpool the coroutines are running on will try to execute SQL against databases from previous tests, which predictably fails. As a workaround, we're calling TransactionManager.resetCurrent(null) in our own code around transactions, which seems to help, but might be expensive.

closed time in 2 days

maxwell-carbon

issue commentJetBrains/Exposed

newSuspendedTransaction often doesn't honor TransactionManager.defaultDatabase changes

@maxwell-carbon , thank you for the detailed tests. It helps me a lot to fix and issue. The fix release will be on the week

maxwell-carbon

comment created time in 2 days