Skip to content

Add check for purely in-memory or temporary database when incrementing newConnection #105

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

Merged
merged 5 commits into from
Nov 5, 2023

Conversation

05nelsonm
Copy link
Contributor

Fixes #104

Comment on lines +268 to +272
it.withStatement("insert into test(num, str)values(?,?)") {
bindLong(1, 233)
bindString(2, "asdfg")
executeInsert()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a 2nd insertion so that conn1.size == 1 and conn2.size == 2 to differentiate between the 2 ephemeral databases created

Comment on lines -258 to -267
assertFails {
val connFail = man.surpriseMeConnection()
connFail.withTransaction {
it.withStatement("insert into test(num, str)values(?,?)") {
bindLong(1, 232)
bindString(2, "asdf")
executeInsert()
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this, as the only reason it was failing was b/c create callback was not being invoked after first new connection was created.

}

assertEquals(1, conn2.longForQuery("select count(*) from test"))
assertEquals(1, conn1.longForQuery("select count(*) from test"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this assertion to demonstrate that conn2 did nothing to conn1 database (I assumed it was a copy/paste mistake)

@kpgalligan kpgalligan merged commit 1d04c24 into touchlab:main Nov 5, 2023
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

Successfully merging this pull request may close these issues.

create callback invoked only on first connection for in-memory/temporary DBs
2 participants