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

Sign up
Appearance settings

Commit 2ee07a4

Browse files
committed
adding additional info to FAQ about in-memory databases
1 parent 3fa1c55 commit 2ee07a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,16 @@ For an example see [shaxbee/go-spatialite](https://github.com/shaxbee/go-spatial
459459
Each connection to :memory: opens a brand new in-memory sql database, so if
460460
the stdlib's sql engine happens to open another connection and you've only
461461
specified ":memory:", that connection will see a brand new database. A
462-
workaround is to use "file::memory:?mode=memory&cache=shared". Every
463-
connection to this string will point to the same in-memory database.
462+
workaround is to use `"file::memory:?cache=shared"` (or `"file:foobar?mode=memory&cache=shared"`). Every
463+
connection to this string will point to the same in-memory database.
464+
465+
Note that if the last database connection in the pool closes, the in-memory database is deleted. Make sure the [max idle connection limit](https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns) is > 0, and the [connection lifetime](https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime) is infinite.
464466

465467
For more information see
466468
* [#204](https://github.com/mattn/go-sqlite3/issues/204)
467469
* [#511](https://github.com/mattn/go-sqlite3/issues/511)
470+
* https://www.sqlite.org/sharedcache.html#shared_cache_and_in_memory_databases
471+
* https://www.sqlite.org/inmemorydb.html#sharedmemdb
468472

469473
- Reading from database with large amount of goroutines fails on OSX.
470474

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /