-
Notifications
You must be signed in to change notification settings - Fork 540
Can't create JDBC shared memory DB #4018
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
Comments
this would be an issue with the underlying driver and not sqldelight, in this case https://github.com/xerial/sqlite-jdbc |
@AlecStrong This is not an underlying issue with jdbc since you can see them using these connection URIs in their tests: https://github.com/xerial/sqlite-jdbc/blob/3d04d7df0c89240add2c92189adb30b6cb7e6ae0/src/test/java/org/sqlite/ConnectionTest.java#L282 The fact that the same URIs do not work in sqldelight points to it being a sqldelight issue. |
SQLDelight's SQLite driver ultimately runs the same |
Would like to re-open this issue
if providing a url that is not the hard coded value specified by i.e., if the uri contains |
Here's what is being checked for in So, Must check for the following 3 conditions:
|
Thanks for following up on this issue and investigating further. Based on what you found I think this is something that can/should be fixed in the |
On it! |
So, little issue here with the difference between a temporary database, and an in-memory database.
If the path expression within the If the path within If the path within Currently, the nomenclature used (i.e. |
Would something like the following work for you @dellisd ? companion {
/**
* some documentation ...
* */
const val URL_PREFIX = "jdbc:sqlite:"
/**
* some documentation ...
* */
const val URL_TEMPORARY = JDBC_PREFIX + ""
/**
* some documentation ...
* */
const val URL_IN_MEMORY = JDBC_PREFIX + ":memory:"
@Deprecated("reasons ... TODO")
const val IN_MEMORY = "jdbc:sqlite:"
} |
My opinion would be that the I can see how this could be a breaking change if someone were using |
100% agree, it'd be much cleaner of an API change. The behavioral change of modifying |
Regarding the nomenclature issue about See #4653 |
SQLDelight Version
1.5.4
Application Operating System
Android
Describe the Bug
JDBC supports sqlite's in-memory DB with shared cache, you can see this in their tests where connections are made with URIs such as
jdbc:sqlite:file:memdb1?mode=memory&cache=shared
jdbc:sqlite:file::memory:?cache=shared
But sqldelight's JdbcSqliteDriver does not support such URIs. I can only get in-memory DBs to work using
JdbcSqliteDriver.IN_MEMORY
which is hard-coded tojdbc:sqlite:
.For example, I want to use this in my tests so that I can test separate classes accessing a common DB in memory as if it exists on disk:
This results in the stacktrace below.
The code only runs if I use
JdbcSqliteDriver.IN_MEMORY
, but that gives incorrect behavior because thendb1
anddb2
are completely separate in-memory databases.Stacktrace
The text was updated successfully, but these errors were encountered: