From: Ryan C. <rya...@ya...> - 2002-11-15 18:45:34
|
--- Bruce Butterfield <ba...@en...> wrote: > I think that the connect function should have completely flexible > arguments; the way this is done in most language bindings is to use > a > single string argument which is driver-dependent. The only good > rationale I can come up with for using a (more scheme-y) assoc list > > would be if connections were to be built dynamically by calls to > (for > instance) different functions which would supply bits of connection > info > to the caller. I don't think this is a very likely scenario. Or if the backend expects some of the arguments to be passed separately. This is in fact the way PostgreSQL works. (libpq might take a string, but the backend protocol expects a message with the database, username, etc in different positions.) > So, we either have: > > (connect connect-str) > > ex: > (connect "db=mydb;user=bab;password=foo") > (connect "oracle_sid=fred user=bab port=1521") > > or > > (connect connect-args) > > ex: > (connect '((db . "mydb")(user . "bab")(password . "foo"))) > > I think the second example looks contrived; remember that it will > have > to be converted to something very like the string used in the > previous > example when passed to the driver. Not always, see above. My vote would be against the "single string" form. It's easier to go from '((db "mydb") (user "bab")...) to "db=mydb;user=bab..." than to parse the string. I would prefer either the association list or totally driver dependent args. Ryan __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com |