Am 23.11.2013 um 02:13 schrieb David E. Wheeler <da...@justatheory.com>:
> DBI Folks & Gisle, > > I want to add support for specifying database connections as URIs to Sqitch, > my DB change management system. I started working on it today, following the > examples of JDBC and PostgreSQL. Before I release, though, I’d like a bit of > feedback on a couple of things. > > First, I'm using the database name as the scheme in the URL. Some examples: > > postgresql://user@localhost:5433/dbname > sqlite:///path/to/foo.db > > This is to make it easy to tell one DB from another. But I'm wondering if I > should follow the example of JDBC more closely, and prepend "db:" or > something to them. More like DBI DSNs, too. However, it would require a bit > more work, as URI.pm does not currently recognize multiple colon-delimited > strings as scheme names AFAICT. :-( With that simplified scheme, you will never be able to support any DBI::DBD::SqlEngine derived driver. While you can configure on postgresql, mysql, oracle etc. a lot in configuration files and special tables, you can’t for DBD::CSV or DBD::DBM. The complete DBI->connect($dsn, $user, $passwd, \%attr) 4th argument is wasted in your current proposal. A lot of simple arguments can be encoded in DSN, but more complex stuff would require some kind of serialization (eg. JSON). Hacking JSON on CLI is always a charm ;) Thinking of Gofer (or other proxies) can shoot you in a new kind of hell ;) > Next, I've added a bunch of URI subclasses for various database engines. I’m > not to familiar with some of them, so if you see any listed here where the > name (to be used in the scheme) and the default port is wrong, please let me > know: > > https://github.com/theory/uri-db/blob/master/t/db.t#L9 > > Thanks! > > David > > PS: Is this something the DBI might want to use? > Cheers -- Jens Rehsack rehs...@gmail.com