File: database.ads

package info (click to toggle)
libgnatcoll-db 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,592 kB
  • sloc: ansic: 128,019; ada: 28,171; sql: 15,778; python: 2,266; makefile: 621; sh: 45
file content (365 lines) | stat: -rw-r--r-- 17,259 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
------------------------------------------------------------------------------
--                       Database interface utilities                       --
--                                                                          --
--                     Copyright (C) 2017-2018, AdaCore                     --
------------------------------------------------------------------------------

with GNATCOLL.SQL; use GNATCOLL.SQL;
pragma Warnings (Off, "no entities of * are referenced");
pragma Warnings (Off, "use clause for package * has no effect");
with GNATCOLL.SQL_Fields; use GNATCOLL.SQL_Fields;
pragma Warnings (On, "no entities of * are referenced");
pragma Warnings (On, "use clause for package * has no effect");
with Database_Names; use Database_Names;
package Database is
   pragma Style_Checks (Off);
   pragma Elaborate_Body;

   type T_Abstract_Action_Item
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Action_Item, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Action_Item, Instance, N_Id, Index);
      Date_Done : SQL_Field_Time (Ta_Action_Item, Instance, N_Date_Done, Index);
      Priority : SQL_Field_Integer (Ta_Action_Item, Instance, N_Priority, Index);
      Se_Nb : SQL_Field_Integer (Ta_Action_Item, Instance, N_Se_Nb, Index);
      Status : SQL_Field_Integer (Ta_Action_Item, Instance, N_Status, Index);
      What_Done : SQL_Field_Text (Ta_Action_Item, Instance, N_What_Done, Index);
      Who_Done : SQL_Field_Integer (Ta_Action_Item, Instance, N_Who_Done, Index);
   end record;

   type T_Action_Item (Instance : Cst_String_Access)
      is new T_Abstract_Action_Item (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Action_Item (Index : Integer)
      is new T_Abstract_Action_Item (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Config
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Config, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Config, Instance, N_Id, Index);
      Sales_Message : SQL_Field_Boolean (Ta_Config, Instance, N_Sales_Message, Index);
   end record;

   type T_Config (Instance : Cst_String_Access)
      is new T_Abstract_Config (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Config (Index : Integer)
      is new T_Abstract_Config (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Contract
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Contract, Instance, Index) with
   record
      Contract_Nb : SQL_Field_Integer (Ta_Contract, Instance, N_Contract_Nb, Index);
      Contract_Type : SQL_Field_Integer (Ta_Contract, Instance, N_Contract_Type, Index);
      Se_Nb : SQL_Field_Integer (Ta_Contract, Instance, N_Se_Nb, Index);
   end record;

   type T_Contract (Instance : Cst_String_Access)
      is new T_Abstract_Contract (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Contract (Index : Integer)
      is new T_Abstract_Contract (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Mailing_List
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Mailing_List, Instance, Index) with
   record
      Default_Status : SQL_Field_Integer (Ta_Mailing_List, Instance, N_Default_Status, Index);
      Id : SQL_Field_Integer (Ta_Mailing_List, Instance, N_Id, Index);
      Name : SQL_Field_Text (Ta_Mailing_List, Instance, N_Name, Index);
   end record;

   type T_Mailing_List (Instance : Cst_String_Access)
      is new T_Abstract_Mailing_List (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Mailing_List (Index : Integer)
      is new T_Abstract_Mailing_List (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Mailing_List_Recipients
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Mailing_List_Recipients, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Mailing_List_Recipients, Instance, N_Id, Index);
      Email : SQL_Field_Integer (Ta_Mailing_List_Recipients, Instance, N_Email, Index);
      List : SQL_Field_Integer (Ta_Mailing_List_Recipients, Instance, N_List, Index);
      Subscription_Type : SQL_Field_Integer (Ta_Mailing_List_Recipients, Instance, N_Subscription_Type, Index);
   end record;

   type T_Mailing_List_Recipients (Instance : Cst_String_Access)
      is new T_Abstract_Mailing_List_Recipients (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Mailing_List_Recipients (Index : Integer)
      is new T_Abstract_Mailing_List_Recipients (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Mailing_List_Subscription_Type
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Mailing_List_Subscription_Type, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Mailing_List_Subscription_Type, Instance, N_Id, Index);
      Name : SQL_Field_Text (Ta_Mailing_List_Subscription_Type, Instance, N_Name, Index);
   end record;

   type T_Mailing_List_Subscription_Type (Instance : Cst_String_Access)
      is new T_Abstract_Mailing_List_Subscription_Type (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Mailing_List_Subscription_Type (Index : Integer)
      is new T_Abstract_Mailing_List_Subscription_Type (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Region
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Region, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Region, Instance, N_Id, Index);
      Name : SQL_Field_Text (Ta_Region, Instance, N_Name, Index);
   end record;

   type T_Region (Instance : Cst_String_Access)
      is new T_Abstract_Region (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Region (Index : Integer)
      is new T_Abstract_Region (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Sales_Entity
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Sales_Entity, Instance, Index) with
   record
      Act_Nb : SQL_Field_Integer (Ta_Sales_Entity, Instance, N_Act_Nb, Index);
      Date_Created : SQL_Field_Date (Ta_Sales_Entity, Instance, N_Date_Created, Index);
      Region : SQL_Field_Integer (Ta_Sales_Entity, Instance, N_Region, Index);
      Sales_Rep : SQL_Field_Integer (Ta_Sales_Entity, Instance, N_Sales_Rep, Index);
      Se_Nb : SQL_Field_Integer (Ta_Sales_Entity, Instance, N_Se_Nb, Index);
   end record;

   type T_Sales_Entity (Instance : Cst_String_Access)
      is new T_Abstract_Sales_Entity (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Sales_Entity (Index : Integer)
      is new T_Abstract_Sales_Entity (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Staff
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Staff, Instance, Index) with
   record
      Active : SQL_Field_Boolean (Ta_Staff, Instance, N_Active, Index);
      Id : SQL_Field_Integer (Ta_Staff, Instance, N_Id, Index);
      Login : SQL_Field_Text (Ta_Staff, Instance, N_Login, Index);
      Preferred_Email : SQL_Field_Integer (Ta_Staff, Instance, N_Preferred_Email, Index);
      Region : SQL_Field_Integer (Ta_Staff, Instance, N_Region, Index);
      Salary : SQL_Field_Money (Ta_Staff, Instance, N_Salary, Index);
   end record;

   type T_Staff (Instance : Cst_String_Access)
      is new T_Abstract_Staff (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Staff (Index : Integer)
      is new T_Abstract_Staff (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Staff_Email
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Staff_Email, Instance, Index) with
   record
      Email_Address : SQL_Field_Text (Ta_Staff_Email, Instance, N_Email_Address, Index);
      Id : SQL_Field_Integer (Ta_Staff_Email, Instance, N_Id, Index);
      Staff : SQL_Field_Integer (Ta_Staff_Email, Instance, N_Staff, Index);
   end record;

   type T_Staff_Email (Instance : Cst_String_Access)
      is new T_Abstract_Staff_Email (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Staff_Email (Index : Integer)
      is new T_Abstract_Staff_Email (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Subscription
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Subscription, Instance, Index) with
   record
      Subscription_Nb : SQL_Field_Integer (Ta_Subscription, Instance, N_Subscription_Nb, Index);
      Contract_Type : SQL_Field_Integer (Ta_Subscription, Instance, N_Contract_Type, Index);
   end record;

   type T_Subscription (Instance : Cst_String_Access)
      is new T_Abstract_Subscription (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Subscription (Index : Integer)
      is new T_Abstract_Subscription (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Tn_Status
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Tn_Status, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Tn_Status, Instance, N_Id, Index);
      Name : SQL_Field_Text (Ta_Tn_Status, Instance, N_Name, Index);
   end record;

   type T_Tn_Status (Instance : Cst_String_Access)
      is new T_Abstract_Tn_Status (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Tn_Status (Index : Integer)
      is new T_Abstract_Tn_Status (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Tracking_Number
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Tracking_Number, Instance, Index) with
   record
      Assignee : SQL_Field_Integer (Ta_Tracking_Number, Instance, N_Assignee, Index);
      Created_By : SQL_Field_Integer (Ta_Tracking_Number, Instance, N_Created_By, Index);
      Tn : SQL_Field_Text (Ta_Tracking_Number, Instance, N_Tn, Index);
   end record;

   type T_Tracking_Number (Instance : Cst_String_Access)
      is new T_Abstract_Tracking_Number (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Tracking_Number (Index : Integer)
      is new T_Abstract_Tracking_Number (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Wavefront
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Wavefront, Instance, Index) with
   record
      Comment : SQL_Field_Text (Ta_Wavefront, Instance, N_Comment, Index);
      Delivered_By : SQL_Field_Integer (Ta_Wavefront, Instance, N_Delivered_By, Index);
      Delivery_Date : SQL_Field_Date (Ta_Wavefront, Instance, N_Delivery_Date, Index);
      Id : SQL_Field_Integer (Ta_Wavefront, Instance, N_Id, Index);
      Request_Date : SQL_Field_Date (Ta_Wavefront, Instance, N_Request_Date, Index);
      Requested_By : SQL_Field_Integer (Ta_Wavefront, Instance, N_Requested_By, Index);
      Se_Nb : SQL_Field_Integer (Ta_Wavefront, Instance, N_Se_Nb, Index);
      Status : SQL_Field_Integer (Ta_Wavefront, Instance, N_Status, Index);
   end record;

   type T_Wavefront (Instance : Cst_String_Access)
      is new T_Abstract_Wavefront (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Wavefront (Index : Integer)
      is new T_Abstract_Wavefront (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Wavefront_Status
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Wavefront_Status, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Wavefront_Status, Instance, N_Id, Index);
      Name : SQL_Field_Text (Ta_Wavefront_Status, Instance, N_Name, Index);
   end record;

   type T_Wavefront_Status (Instance : Cst_String_Access)
      is new T_Abstract_Wavefront_Status (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Wavefront_Status (Index : Integer)
      is new T_Abstract_Wavefront_Status (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   type T_Abstract_Wavefront_Tn
      (Instance : Cst_String_Access;
       Index    : Integer)
   is abstract new SQL_Table (Ta_Wavefront_Tn, Instance, Index) with
   record
      Id : SQL_Field_Integer (Ta_Wavefront_Tn, Instance, N_Id, Index);
      Tn : SQL_Field_Text (Ta_Wavefront_Tn, Instance, N_Tn, Index);
      Wave : SQL_Field_Integer (Ta_Wavefront_Tn, Instance, N_Wave, Index);
   end record;

   type T_Wavefront_Tn (Instance : Cst_String_Access)
      is new T_Abstract_Wavefront_Tn (Instance, -1) with null record;
   --  To use named aliases of the table in a query
   --  Use Instance=>null to use the default name.

   type T_Numbered_Wavefront_Tn (Index : Integer)
      is new T_Abstract_Wavefront_Tn (null, Index) with null record;
   --  To use aliases in the form name1, name2,...

   function FK (Self : T_Action_Item'Class; Foreign : T_Sales_Entity'Class) return SQL_Criteria;
   function FK (Self : T_Action_Item'Class; Foreign : T_Staff'Class) return SQL_Criteria;
   function FK (Self : T_Contract'Class; Foreign : T_Sales_Entity'Class) return SQL_Criteria;
   function FK (Self : T_Mailing_List'Class; Foreign : T_Tn_Status'Class) return SQL_Criteria;
   function FK (Self : T_Mailing_List_Recipients'Class; Foreign : T_Staff_Email'Class) return SQL_Criteria;
   function FK (Self : T_Mailing_List_Recipients'Class; Foreign : T_Mailing_List'Class) return SQL_Criteria;
   function FK (Self : T_Mailing_List_Recipients'Class; Foreign : T_Mailing_List_Subscription_Type'Class) return SQL_Criteria;
   function FK (Self : T_Sales_Entity'Class; Foreign : T_Region'Class) return SQL_Criteria;
   function FK (Self : T_Sales_Entity'Class; Foreign : T_Staff'Class) return SQL_Criteria;
   function FK (Self : T_Staff'Class; Foreign : T_Staff_Email'Class) return SQL_Criteria;
   function FK (Self : T_Staff'Class; Foreign : T_Region'Class) return SQL_Criteria;
   function FK (Self : T_Staff_Email'Class; Foreign : T_Staff'Class) return SQL_Criteria;
   function FK (Self : T_Subscription'Class; Foreign : T_Contract'Class) return SQL_Criteria;
   function FK (Self : T_Wavefront'Class; Foreign : T_Staff'Class) return SQL_Criteria;
   function FK (Self : T_Wavefront'Class; Foreign : T_Sales_Entity'Class) return SQL_Criteria;
   function FK (Self : T_Wavefront'Class; Foreign : T_Wavefront_Status'Class) return SQL_Criteria;
   function FK (Self : T_Wavefront_Tn'Class; Foreign : T_Tracking_Number'Class) return SQL_Criteria;
   function FK (Self : T_Wavefront_Tn'Class; Foreign : T_Wavefront'Class) return SQL_Criteria;
   Action_Item : T_Action_Item (null);
   Config : T_Config (null);
   Contract : T_Contract (null);
   Mailing_List : T_Mailing_List (null);
   Mailing_List_Recipients : T_Mailing_List_Recipients (null);
   Mailing_List_Subscription_Type : T_Mailing_List_Subscription_Type (null);
   Region : T_Region (null);
   Sales_Entity : T_Sales_Entity (null);
   Staff : T_Staff (null);
   Staff_Email : T_Staff_Email (null);
   Subscription : T_Subscription (null);
   Tn_Status : T_Tn_Status (null);
   Tracking_Number : T_Tracking_Number (null);
   Wavefront : T_Wavefront (null);
   Wavefront_Status : T_Wavefront_Status (null);
   Wavefront_Tn : T_Wavefront_Tn (null);
end Database;