1--  This file is covered by the Internet Software Consortium (ISC) License
2--  Reference: ../../License.txt
3
4with CommonText;
5with Spatial_Data.Well_Known_Binary;
6with Ada.Calendar.Formatting;
7with Ada.Strings.Wide_Unbounded;
8with Ada.Strings.Wide_Wide_Unbounded;
9with Ada.Strings.UTF_Encoding;
10
11package AdaBase.Results is
12
13   package CT   renames CommonText;
14   package AC   renames Ada.Calendar;
15   package ACF  renames Ada.Calendar.Formatting;
16   package SUW  renames Ada.Strings.Wide_Unbounded;
17   package SUWW renames Ada.Strings.Wide_Wide_Unbounded;
18   package SUTF renames Ada.Strings.UTF_Encoding;
19   package GEO  renames Spatial_Data;
20   package WKB  renames Spatial_Data.Well_Known_Binary;
21
22   subtype Textual   is CT.Text;
23   subtype Textwide  is SUW.Unbounded_Wide_String;
24   subtype Textsuper is SUWW.Unbounded_Wide_Wide_String;
25   subtype Text_UTF8 is SUTF.UTF_8_String;
26
27   TARGET_TYPE_TOO_NARROW : exception;
28   CONVERSION_FAILED      : exception;
29   UNSUPPORTED_CONVERSION : exception;
30   COLUMN_DOES_NOT_EXIST  : exception;
31   CONSTRUCTOR_DO_NOT_USE : exception;
32
33   -------------------------------------------
34   --  Supported Field Types (Standardized) --
35   -------------------------------------------
36
37   type Bit1   is mod 2 ** 1;
38   type NByte1 is mod 2 ** 8;
39   type NByte2 is mod 2 ** 16;
40   type NByte3 is mod 2 ** 24;
41   type NByte4 is mod 2 ** 32;
42   type NByte8 is mod 2 ** 64;
43   type Byte8  is range -2 ** 63 .. 2 ** 63 - 1;
44   type Byte4  is range -2 ** 31 .. 2 ** 31 - 1;
45   type Byte3  is range -2 ** 23 .. 2 ** 23 - 1;
46   type Byte2  is range -2 ** 15 .. 2 ** 15 - 1;
47   type Byte1  is range -2 **  7 .. 2 **  7 - 1;
48   type Real9  is digits 9;
49   type Real18 is digits 18;
50
51   subtype NByte0 is Boolean;
52
53   type Enumtype is record enumeration : Textual; end record;
54   type Settype is array (Positive range <>) of Enumtype;
55   type Chain   is array (Positive range <>) of NByte1;
56   type Bits    is array (Natural range <>)  of Bit1;
57
58   type NByte0_Access   is access all NByte0;
59   type NByte1_Access   is access all NByte1;
60   type NByte2_Access   is access all NByte2;
61   type NByte3_Access   is access all NByte3;
62   type NByte4_Access   is access all NByte4;
63   type NByte8_Access   is access all NByte8;
64   type Byte1_Access    is access all Byte1;
65   type Byte2_Access    is access all Byte2;
66   type Byte3_Access    is access all Byte3;
67   type Byte4_Access    is access all Byte4;
68   type Byte8_Access    is access all Byte8;
69   type Real9_Access    is access all Real9;
70   type Real18_Access   is access all Real18;
71   type Str1_Access     is access all Textual;
72   type Str2_Access     is access all Textwide;
73   type Str4_Access     is access all Textsuper;
74   type Time_Access     is access all AC.Time;
75   type Chain_Access    is access all Chain;
76   type Enum_Access     is access all Enumtype;
77   type Settype_Access  is access all Settype;
78   type Geometry_Access is access all GEO.Geometry;
79   type Bits_Access     is access all Bits;
80   type S_UTF8_Access   is access all Text_UTF8;
81
82   Blank_String   : constant Textual   := CT.blank;
83   Blank_WString  : constant Textwide  := SUW.Null_Unbounded_Wide_String;
84   Blank_WWString : constant Textsuper :=
85                       SUWW.Null_Unbounded_Wide_Wide_String;
86
87   ------------------------------------------------
88   --  CONSTANTS FOR PARAMETER TYPE DEFINITIONS  --
89   ------------------------------------------------
90   PARAM_IS_BOOLEAN   : constant NByte0 := False;
91   PARAM_IS_NBYTE_1   : constant NByte1 := 0;
92   PARAM_IS_NBYTE_2   : constant NByte2 := 0;
93   PARAM_IS_NBYTE_3   : constant NByte3 := 0;
94   PARAM_IS_NBYTE_4   : constant NByte4 := 0;
95   PARAM_IS_NBYTE_8   : constant NByte8 := 0;
96   PARAM_IS_BYTE_1    : constant Byte1 := 0;
97   PARAM_IS_BYTE_2    : constant Byte2 := 0;
98   PARAM_IS_BYTE_3    : constant Byte3 := 0;
99   PARAM_IS_BYTE_4    : constant Byte4 := 0;
100   PARAM_IS_BYTE_8    : constant Byte8 := 0;
101   PARAM_IS_REAL_9    : constant Real9  := 0.0;
102   PARAM_IS_REAL_18   : constant Real18 := 0.0;
103   PARAM_IS_CHAIN     : constant Chain := (1 .. 1 => 0);
104   PARAM_IS_BITS      : constant Bits  := (0 .. 0 => 0);
105   PARAM_IS_ENUM      : constant Enumtype  := (enumeration => Blank_String);
106   PARAM_IS_SET       : constant Settype   := (1 .. 1 => (PARAM_IS_ENUM));
107   PARAM_IS_TEXTUAL   : constant Textual   := Blank_String;
108   PARAM_IS_TEXTWIDE  : constant Textwide  := Blank_WString;
109   PARAM_IS_TEXTSUPER : constant Textsuper := Blank_WWString;
110   PARAM_IS_TEXT_UTF8 : constant Text_UTF8 := blankstring;
111   PARAM_IS_TIMESTAMP : constant AC.Time :=
112                        ACF.Time_Of (Year       => AC.Year_Number'First,
113                                     Month      => AC.Month_Number'First,
114                                     Day        => AC.Day_Number'First,
115                                     Hour       => ACF.Hour_Number'First,
116                                     Minute     => ACF.Minute_Number'First,
117                                     Second     => ACF.Second_Number'First,
118                                     Sub_Second => ACF.Second_Duration'First);
119
120end AdaBase.Results;
121