Closed postmodern closed 11 years ago
I've wanted this as well, for administrative functionality like testing if databases exist, creating them, etc.
AFAICT, it's not possible with the current URI-oriented design. My workaround was to connect to known-existing DBs ("mysql" for MySQL) and then use that repository.adapter's connection. However that only works with lax permissions.
It should be possible to implement this using the current URI model. When path is ""
or "/"
, no database should be selected. This constraint is actually implemented in each C-extension.
https://github.com/datamapper/do/blob/master/do_mysql/ext/do_mysql/do_mysql.c#L230-232 https://github.com/datamapper/do/blob/master/do_postgres/ext/do_postgres/do_postgres.c#L397-399
These constraints could be removed from the C-extensions, and moved to dm-core or dm-rails, where you actually need to connect to a specific database.
This is possible to do with
mysql
/pg
, but DataObjects seems to require the Database name. Is it possible to bypass this requirement?