1------------------------------------------------------------------------------ 2-- -- 3-- APQ DATABASE BINDINGS -- 4-- -- 5-- A P Q -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2002-2007, Warren W. Gay VE3WWG -- 10-- Copyright (C) 2007-2011, KOW Framework Project -- 11-- -- 12-- -- 13-- APQ is free software; you can redistribute it and/or modify it under -- 14-- terms of the GNU General Public License as published by the Free Soft- -- 15-- ware Foundation; either version 2, or (at your option) any later ver- -- 16-- sion. APQ is distributed in the hope that it will be useful, but WITH- -- 17-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 18-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 19-- for more details. You should have received a copy of the GNU General -- 20-- Public License distributed with APQ; see file COPYING. If not, write -- 21-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- 22-- MA 02111-1307, USA. -- 23-- -- 24-- As a special exception, if other files instantiate generics from this -- 25-- unit, or you link this unit with other files to produce an executable, -- 26-- this unit does not by itself cause the resulting executable to be -- 27-- covered by the GNU General Public License. This exception does not -- 28-- however invalidate any other reasons why the executable file might be -- 29-- covered by the GNU Public License. -- 30-- -- 31------------------------------------------------------------------------------ 32 33 34 35------------------------------------------------------------------------------- 36-- This is the base package for the PostreSQL driver for APQ. -- 37------------------------------------------------------------------------------- 38 39with ada.Strings.Unbounded; 40 41package APQ.PostgreSQL is 42 pragma linker_options("-lpq"); 43 44 45 type Result_Type is ( 46 Empty_Query, 47 Command_OK, 48 Tuples_OK, 49 Copy_Out, 50 Copy_In, 51 Bad_Response, 52 Nonfatal_Error, 53 Fatal_Error 54 ); 55 56 for Result_Type use ( 57 Empty_Query => 0, 58 Command_OK => 1, 59 Tuples_OK => 2, 60 Copy_Out => 3, 61 Copy_In => 4, 62 Bad_Response => 5, 63 Nonfatal_Error => 6, 64 Fatal_Error => 7 65 ); 66 67 68 subtype PG_Smallint is APQ_Smallint; -- For compatibility only (use APQ.Row_ID_Type instead) 69 subtype PG_Integer is APQ_Integer; -- For compatibility only (use APQ.Row_ID_Type instead) 70 subtype PG_Bigint is APQ_Bigint; -- For compatibility only (use APQ.Row_ID_Type instead) 71 subtype PG_Real is APQ_Real; -- For compatibility only (use APQ.Row_ID_Type instead) 72 subtype PG_Double is APQ_Double; -- For compatibility only (use APQ.Row_ID_Type instead) 73 subtype PG_Serial is APQ_Serial; -- For compatibility only (use APQ.Row_ID_Type instead) 74 subtype PG_Bigserial is APQ_Bigserial; -- For compatibility only (use APQ.Row_ID_Type instead) 75 76 subtype PG_Oid is APQ.Row_ID_Type; -- For compatibility only (use APQ.Row_ID_Type instead) 77 subtype PG_Boolean is Boolean; -- For compatibility only (use APQ_Boolean or Boolean instead) 78 subtype PG_Date is APQ_Date; -- For compatibility only (use APQ_Date instead) 79 subtype PG_Time is APQ_Time; -- For compatibility only (use APQ_Time instead) 80 subtype PG_Timestamp is APQ_Timestamp; -- For compatibility only (use APQ_Timestamp instead) 81 -- subtype PG_Timezone is APQ_Timezone; -- For compatibility only (use APQ_Timestamp instead) 82 subtype PG_Bitstring is APQ_Bitstring; -- For compatibility only (use APQ_Timestamp instead) 83 84 type Mode_Type is ( 85 Write, 86 Read, 87 Read_Write 88 ); 89 for Mode_Type use ( 90 Write => 16#00020000#, -- Write access 91 Read => 16#00040000#, -- Read access 92 Read_Write => 16#00060000# -- Read/Write access 93 ); 94 for Mode_Type'Size use 32; 95 96 type root_option_record2 is private; 97 98private 99 100 type root_option_record2 is tagged 101 record 102 is_valid : boolean := false; 103 key_u : ada.Strings.Unbounded.Unbounded_String := ada.Strings.Unbounded.To_Unbounded_String(""); 104 value_u : ada.Strings.Unbounded.Unbounded_String := ada.Strings.Unbounded.To_Unbounded_String(""); 105 end record; 106 107 108 type PQOid_Type is mod 2 ** 32; -- Currently PostgreSQL uses unsigned int for Oid 109 110 Null_Row_ID : constant Row_ID_Type := 0; -- Value representing no OID 111 112end APQ.PostgreSQL; 113