Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite datetime No transaction in context. #1130

Closed
hizhengfu opened this issue Jan 11, 2021 · 2 comments
Closed

sqlite datetime No transaction in context. #1130

hizhengfu opened this issue Jan 11, 2021 · 2 comments

Comments

@hizhengfu
Copy link
Contributor

class SqliteTest {

    object Tests : IntIdTable() {
        val name = varchar("name", length = 50) // Column<String>
        val dateTime = datetime("date-time").clientDefault { DateTime() }.nullable()
    }

    @Test
    fun test1() {
        val db = Database.connect("jdbc:sqlite:file:mem:test", driver = "org.sqlite.JDBC")

        var list1: List<ResultRow>? = null
        transaction(db) {
            SchemaUtils.create(Tests)

            Tests.insert {
                it[name] = "test1"
            }

            list1 = Tests.selectAll().toList()

            list1?.forEach {
                println(it[Tests.name])
                println(it[Tests.dateTime])
            }
        }
        list1?.forEach {
            println(it[Tests.name])
            println(it[Tests.dateTime])// if println this line show "No transaction in context."
        }

    }
}

datetime field transaction outside error No transaction in context.

@hizhengfu
Copy link
Contributor Author

Is it possible to release a new version, thanks.

@Tapac
Copy link
Contributor

Tapac commented Jan 17, 2021

Will be released next week, still need to check a few more issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants