Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2ad20b5

Browse filesBrowse files
zachee54xerial
authored andcommitted
Support temporary databases with no file name (xerial#396)
When no database is specified, SQLite is supposed to create a temporary database, i.e. residing in memory but able to be flushed to disk under memory pressure. Actually, the driver forces SQLite to open an in-memory database instead. These databases cannot be flushed to disk and might come out of memory.
1 parent e87979d commit 2ad20b5
Copy full SHA for 2ad20b5

2 files changed

+2-3Lines changed: 2 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/org/sqlite/JDBC.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/sqlite/JDBC.java
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public Connection connect(String url, Properties info) throws SQLException {
9696
* @return The location to the database.
9797
*/
9898
static String extractAddress(String url) {
99-
// if no file name is given use a memory database
100-
return PREFIX.equalsIgnoreCase(url) ? ":memory:" : url.substring(PREFIX.length());
99+
return url.substring(PREFIX.length());
101100
}
102101

103102
/**
Collapse file

‎src/main/java/org/sqlite/SQLiteConnection.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/sqlite/SQLiteConnection.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private static DB open(String url, String origFileName, Properties props) throws
181181
SQLiteConfig config = new SQLiteConfig(newProps);
182182

183183
// check the path to the file exists
184-
if (!":memory:".equals(fileName) && !fileName.startsWith("file:") && !fileName.contains("mode=memory")) {
184+
if (!fileName.isEmpty() && !":memory:".equals(fileName) && !fileName.startsWith("file:") && !fileName.contains("mode=memory")) {
185185
if (fileName.startsWith(RESOURCE_NAME_PREFIX)) {
186186
String resourceName = fileName.substring(RESOURCE_NAME_PREFIX.length());
187187

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.