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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,61de38e1ae41188c,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-03 08:30:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.cgocable.net!read2.cgocable.net.POSTED!53ab2750!not-for-mail Message-ID: <3D4BF6FF.2080803@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020618 Netscape/7.0b1 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: PostgreSQL Ada95 Binding APQ 1.0 Released Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 03 Aug 2002 11:30:07 -0400 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read2.cgocable.net 1028388678 24.150.168.167 (Sat, 03 Aug 2002 11:31:18 EDT) NNTP-Posting-Date: Sat, 03 Aug 2002 11:31:18 EDT Organization: Cogeco Cable Xref: archiver1.google.com comp.lang.ada:27654 Date: 2002-08-03T11:30:07-04:00 List-Id: The APQ 1.0 Ada95 binding for PostgreSQL is a very easy to use binding for SQL interactions with the database. This binding uses the C language libpq library and does NOT require ODBC software. This makes PostgreSQL available to Ada95 programmers with the minimum of software prerequesites. The following features are provided: - it is a thick binding (for a natural Ada95 experience) - it is very simple to use: only 3 objects to know - Connection_Type - Query_Type - Blob_Type - support for strong Ada95 data types - generic function and procedure support - full NULL indicator support - full BLOB support - Ada95 stream I/O for blobs - Additional DATE, TIME and TIMESTAMP support routines - ACL License (Ada Community License) - Experimental Decimal child package support - 100+ page reference manual - almost every function has an example - no embedded SQL precompiler needed The following were APQ design goals: - very simple to use (#1 priority) - easy to read both SQL and Ada code - reliable (exceptions for error conditions) - strong blob support - no C language interfaces or types ;-) - easy to install (no ODBC! Requires only Postgres libpq) - easy to debug (To_String on Query_Type for example returns the full SQL text used) Tested and developed on FreeBSD 4.4, using GNAT 3.13p. While untested for Linux, it should install OK on modern Linux platforms. It should port well to other UNIX platforms as well. Here is an abbreviated sample of what a query looks like using the APQ binding (using weak data types for brevity): declare C : Connection_Type; Q : Query_Type; begin Connect(C); -- Using environment variables here Prepare(Q, "SELECT CUST_NO,CUST_NAME,BIRTHDAY"); Append_Line(Q,"FROM CUSTOMER"); Execute(Q,C); while not End_of_Query(Q) loop Fetch(Q); declare procedure Value is new Date_Fetch(PG_Date,Boolean); Cust_No : PG_Integer := Value(Q,1); Cust_Name : String := Value(Q,2); Birthday : PG_DATE; -- Date of birth i_Birthday : Boolean; -- NULL indicator for Birthday begin Value(Q,3,Birthday,i_Birthday); ... -- Process row results end; end loop; end; -- Finalization of Q and C closes and disconnects You can download the source+manual, or just the PDF manual alone from http://home.cogeco.ca/~ve3wwg . Enjoy, Warren.