On Thu, Jul 24, 2014 at 4:10 PM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 24 Jul 2014, at 3:07pm, Stephan Beal <sgb...@googlemail.com> wrote:
>
> > A simpler solution which would serve my goals just as well: the ability
> to
> > rename only 'main' (e.g. sqlite3_rename_db(sqlite3*, char const *
> > newName)). i don't need 'main' because main is fluid in these apps. i
> need
> > a well-defined name which sticks with a db regardless of whether it is
> > opened or attached.
>
> What happens if you open any SQLite database, then ATTACH the same
> database to the same connection ?
>
>
i was almost ready to kiss you, but that seems to not work:

[stephan@host:~/cvs/fossil/libfossil/s2]$ sqlite3 foo.db
SQLite version 3.8.4.1 2014-03-12 19:38:38
Enter ".help" for usage hints.
sqlite> create table t(a);
sqlite> attach 'foo.db' as foo;
sqlite> .schema foo.t
sqlite> .dump foo.t
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
COMMIT;
sqlite> .schema t
CREATE TABLE t(a);
sqlite>

And yet...

sqlite> insert into foo.t(a) values(1),(2),(3);
sqlite> select * from foo.t;
1
2
3
sqlite> ^D
[stephan@host:~/cvs/fossil/libfossil/s2]$ sqlite3 foo.db
SQLite version 3.8.4.1 2014-03-12 19:38:38
Enter ".help" for usage hints.
sqlite> select * from t;
1
2
3

So ... that seems to work (just not with those shell .commands, but that's
okay). i'll try it out and come back crying if it doesn't.

THANK YOU!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to