comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: PostgreSQL Ada95 Binding APQ 1.0 Released
Date: Sat, 03 Aug 2002 11:30:07 -0400
Date: 2002-08-03T11:30:07-04:00	[thread overview]
Message-ID: <3D4BF6FF.2080803@cogeco.ca> (raw)

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.




             reply	other threads:[~2002-08-03 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-03 15:30 Warren W. Gay VE3WWG [this message]
2002-08-03 22:14 ` PostgreSQL Ada95 Binding APQ 1.0 Released Florian Weimer
2002-08-04 20:13   ` Björn Lundin
2002-08-05  0:50     ` PostgreSQL Ada95 Binding APQ 1.0 Released (now 1.1) Warren W. Gay VE3WWG
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox