> Every time you open a :memory: database you get a separate instance,
> identified only by its sqlite3* handle. I'm not sure if ATTACH would
> work with :memory:, but even if it does it would just create a new,
> empty in-memory database, not refer to the one (of possibly many) you
> already have open and populated.

sqlite> create table x(y text);
sqlite> insert into x(y) values('one');
sqlite> select * from x;
one
sqlite> attach ":memory:" as db1;
sqlite> create table db1.x(y text);
sqlite> insert into db1.x(y) values('two');
sqlite> select * from db1.x;
two
sqlite> select * from x;
one
sqlite> attach ":memory:" as db2;
sqlite> create table db2.x(y text);
sqlite>  insert into db2.x(y) values('three');
sqlite>  select * from db2.x;
three
sqlite>  select * from db1.x;
two
sqlite>  select * from x;
one
sqlite>

Reply via email to