Open timothee-haudebourg opened 4 years ago
I agree this behaviour is not very obvious!
I stumbled upon this because I got no results from SELECT * FROM sqlite_master
whereas querying the tables would work fine. Because of the ATTACH
you instead need to SELECT * FROM quaint.sqlite_master
, i.e. specify your db_name
(quaint
is the default for db_name
which appears is not documented).
https://github.com/prisma/quaint/pull/126 addresses this I think. I'll have another look at it tomorrow and try to get it merged.
Awesome!
This is something I had to discover the hard way, since it is not documented.
Even while it takes a file path as parameter,
Sqlite::new
does not open the file but creates an in-memory database. The methodattach_database
seems to used to attach the file afterward? This is quite weird to be honest.If
Sqlite::new
takes a file name, then it should use the given file as main schema. If you want to keepnew
to create in-memory database, I would advocate removing its input parameter and add a newSqlite::open
method to open an on-disk file.Also the method
attach_database
should comply to the sqlite semantics: take a file name and a schema name, and bind them together.