Forum: Nitro [OG] RFC uri structure

Posted by Mark Van De Vyver (mvyver)
on 2007-11-02 20:27
(Received via mailing list)
Hi Devs,
The Sequel/Datasets thread was ominously silent - nonetheless pushing 
ahead.

If you were able to start Og in the following way:
Og(uri)

What would be the preferred uri format:
a) 
"dbi-<vendor>://user:pass@localhost:9876/dbname#<vendor>driveroptions"
b) 
"dbi:<vendor>://user:pass@localhost:9876/dbname#<vendor>driveroptions"
c) both
d) neither (please tell/suggest)

Some notes:
- "DBI" and <vendor> would be case insensitive.
- Not all arguments are 'required'.  The following would work (assuming 
(a)),
"DBI-mysql:///testdb"
and even
"dbi:///testdb"
In that missing arguments would employ the defaults as specific by the
settings in og.rb.

Regards
Mark
Posted by George Moschovitis (Guest)
on 2007-11-03 18:22
(Received via mailing list)
I would say

dbi-vendor...

-g.
Posted by Dan North (Guest)
on 2007-11-05 13:20
(Received via mailing list)
Perl uses a format called a DSN. Since there is already a convention, we
should try to adhere to that.

It looks roughly like: dbi:vendor:other-stuff, but I'm not sure of the
specifics.
Posted by Mark Van De Vyver (mvyver)
on 2007-11-05 21:04
(Received via mailing list)
On Nov 5, 2007 11:20 PM, Dan North <tastapod@gmail.com> wrote:
> Perl uses a format called a DSN. Since there is already a convention, we
> should try to adhere to that.

Agreed.  It looks like the Ruby DBI spec pay some homage to Perl.
Essentially the uri is parsed into the dsn.  To support both, it would
be a case of distinguishing a dsn from a uri.
I'll try to do that.

> It looks roughly like: dbi:vendor:other-stuff, but I'm not sure of the
> specifics.

That is right, the other stuff is ';' delimited: "param=value".

Anyway a complete uri at the moment will be (the generic uri 
definition):

"dbi-sqlite://username:pass@localhost:9876/dbname#other-stuff"

where other stuff is in the format of 'other-stuff' above.

this gets parsed into the dsn:

dbi:sqlite:user=username;password=pass;host=localhost;port=9876;database=dbname;other-stuff

My intention is that if a parameter value isn't given then a vendor
specific default value is employed.
So the following should work:

Og("dbi-sqlite:/")

Lats note: The uri contents are parsed into the options hash and
should (I'll give it a try) work with other (non-dbi) adapters...

Regards
Mark
This topic is locked and can not be replied to.