From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ee0dc912649d50d4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!feed.cgocable.net!read2.cgocable.net.POSTED!53ab2750!not-for-mail From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada DB bindings and APQ References: <1km3c584awura$.y7djkir1ozya$.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <17Ovd.52$Wt5.33108@read2.cgocable.net> Date: Tue, 14 Dec 2004 22:23:38 -0500 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read2.cgocable.net 1103081021 24.150.168.167 (Tue, 14 Dec 2004 22:23:41 EST) NNTP-Posting-Date: Tue, 14 Dec 2004 22:23:41 EST Organization: Cogeco Cable Xref: g2news1.google.com comp.lang.ada:6952 Date: 2004-12-14T22:23:38-05:00 List-Id: Brian May wrote: >>>>>>"Warren" == Warren W Gay VE3WWG writes: > Warren> I'm not against the "factory" idea, but i don't think it > Warren> will prove to be very practical. The problem is that every > Warren> database vendor has its own unique way of identifying > Warren> users to the database. PostgreSQL is perhaps the strangest > Warren> of them all, and they all overlap, but none of them agree > Warren> on the required set of parameters. You can possibly make > Warren> them agree in some situations, but this doesn't address > Warren> existing databases well. > > The solution here is to use a notation for identifying the database > that will work for all database. > > I have to say I really like the PHP pear URL like syntax, copied from: > > > > Example 26-1. Connect to database through a socket > > mysql://user@unix(/path/to/socket)/pear > > Example 26-2. Connect to database on a non standard port > > pgsql://user:pass@tcp(localhost:5555)/pear That's not bad actually. That would also let the application designer put all that nasty config data in one environment variable (or command argument). > Example 26-3. Connect to SQLite on a Unix machine using options > > sqlite:////full/unix/path/to/file.db?mode=0666 Not sure why there are so many leading slashes in this case. > Example 26-4. Connect to SQLite on a Windows machine using options > > sqlite:///c:/full/windows/path/to/file.db?mode=0666 > > Example 26-5. Connect to MySQLi using SSL > > mysqli://user:pass@localhost/pear?key=client-key.pem&cert=client-cert.pem > > Example 26-6. Connecting to MS Access sometimes requires admin as the user name > > odbc(access)://admin@/datasourcename > > Example 26-7. Connecting to ODBC with a specific cursor > > odbc(access)://admin@/datasourcename?cursor=SQL_CUR_USE_ODBC > > pgsql://someuser:apasswd@localhost/thedb > > I think this is rather important as it would mean you don't need to > recompile the application in order to use a different database. It > also means the code doesn't have to explicitly support connecting to > every possible database that APQ supports. > > Instead you just need *one* config option "database_url" that contains > the URL as per one of the above format. > > If you want sample code to pass the URL, it is already written, it > just needs to be ported from PHP to Ada... Not sure how easy this will > be. I like this idea. What it needs on the Linux/*NIX side is to use dynamically loaded libraries, so that it doesn't insist on all other shared libraries, even when not used. The shared library should only be loaded when required. -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg