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 Newsgroups: comp.lang.ada Subject: Re: Ada DB bindings and APQ References: <1km3c584awura$.y7djkir1ozya$.dlg@40tude.net> From: Brian May Date: Wed, 15 Dec 2004 09:40:29 +1100 Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:pCgyTb3jb/Hcx/SFMO/1Lz4dtvk= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: snoopy.microcomaustralia.com.au X-Trace: news.melbourne.pipenetworks.com 1103064004 202.173.153.89 (15 Dec 2004 08:40:04 +1000) X-Complaints-To: abuse@pipenetworks.com X-Abuse-Info: Please forward all headers to enable your complaint to be properly processed. Path: g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!news1.optus.net.au!optus!news.mel.connect.com.au!news-north.connect.com.au!duster.adelaide.on.net!news.melbourne.pipenetworks.com!not-for-mail Xref: g2news1.google.com comp.lang.ada:6949 Date: 2004-12-15T09:40:29+11:00 List-Id: >>>>> "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 Example 26-3. Connect to SQLite on a Unix machine using options sqlite:////full/unix/path/to/file.db?mode=0666 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. -- Brian May