add a FAQ entry about :memory: races

Closes #204
Closes #309

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
This commit is contained in:
Tycho Andersen 2017-01-26 14:55:07 -07:00
parent 7ed900a7c4
commit ded1ba664d
1 changed files with 9 additions and 0 deletions

View File

@ -68,6 +68,15 @@ FAQ
Yes for readonly. But, No for writable. See #50, #51, #209. Yes for readonly. But, No for writable. See #50, #51, #209.
* Why is it racy if I use a `sql.Open("sqlite", ":memory:")` database?
Each connection to :memory: opens a brand new in-memory sql database, so if
the stdlib's sql engine happens to open another connection and you've only
specified ":memory:", that connection will see a brand new database. A
workaround is to use "file::memory:?mode=memory&cache=shared". Every
connection to this string will point to the same in-memory database. See
#204 for more info.
License License
------- -------