On Wed, Apr 20, 2016 at 2:49 PM, Jay Kreibich <jay at kreibi.ch> wrote:

> > To attach several memory DBs, it's more like
> >
> > ATTACH DATABASE "file:mem1?mode=memory" as db1;
> > ATTACH DATABASE "file:mem2?mode=memory" as db2;
> > etc... ?DD
>
> There is no requirement to use the URI style file type, you can just
> re-opening the special value ?:memory:?.
>
> $ ./sqlite3
> SQLite version 3.8.4.2 2014-03-26 18:51:19
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> ATTACH DATABASE ":memory:" AS db2;
> sqlite> ATTACH DATABASE ":memory:" AS db3;
> sqlite> .databases
> seq  name             file
> ---  ---------------
> ----------------------------------------------------------
> 0    main
> 2    db2
> 3    db3


[DD] Thanks. I mistakenly assumes ":memory:" was a "singleton" memory DB
for that particular connection.
[DD] Thanks to your example, and a little testing on my own, I now realize
each one is an independent
[DD] memory DB, and not just different "aliases" to just one memory DB.

[DD] And I was also confused by something we did a few weeks ago, which is
to have several named
[DD] memory DBs, and connecting several times (as independent connections)
to one of those mem DB's by name.
[DD] I believe this use case is only possible with URI style file type. All
in-process of course. Am I wrong on that too? --DD

Reply via email to