Closed alexkmbk closed 2 years ago
Yeah, thank you! it really works.
sure, see https://github.com/glebarez/go-sqlite#settings-pragmas-in-connection-string
but if I would like to set both: shared cache and journal mode, should I use the syntax like this: "?cache=shared&_pragma=journal_mode(MEMORY)" ?
sure, see https://github.com/glebarez/go-sqlite#settings-pragmas-in-connection-string
but if I would like to set both: shared cache and journal mode, should I use the syntax like this:
"?cache=shared&_pragma=journal_mode(MEMORY)" ?
cache
option is parsed by sqlite itself. According to docs (see URI Filenames section), you must prepend your connection string with file:
to enable this parsing.
So, in your case you should use it like this:
"file:data.db?cache=shared&_pragma=journal_mode(MEMORY)"
or "file::memory:?cache=shared&_pragma=journal_mode(MEMORY)"
(for in-memory DB)
sure, see https://github.com/glebarez/go-sqlite#settings-pragmas-in-connection-string
but if I would like to set both: shared cache and journal mode, should I use the syntax like this: "?cache=shared&_pragma=journal_mode(MEMORY)" ?
cache
option is parsed by sqlite itself. According to docs (see URI Filenames section), you must prepend your connection string withfile:
to enable this parsing.So, in your case you should use it like this:
"file:data.db?cache=shared&_pragma=journal_mode(MEMORY)"
or"file::memory:?cache=shared&_pragma=journal_mode(MEMORY)"
(for in-memory DB)
yes, thanks!
sure, see https://github.com/glebarez/go-sqlite#settings-pragmas-in-connection-string