29 Commits

Author SHA1 Message Date
Fabien Chouteau
6308e597eb Avoid shared gpr files
In the Alire index we have one crate for each of the GNATColl DB
libraries (xref, sql, sqlite, postgres). They all come from the same
repository but use different checkouts. The result is that the
"gnatcoll_db_shared.gpr" is found multiple times in the closure of a
project, e.g. for gnatcoll_xref that depends on gnatcoll_sqlite and
gnatcoll_sql. This result in an error from gprbuild.

To circumvent the issue, this patch duplicates gnatcoll_db_shared.gpr in
each of the sql, sqlite, xref and postgres folders with a different name
for each.

Part of V826-023.

Change-Id: I9058e5f88fa307806c483c02d3c0de7298018821
2022-08-26 15:41:02 +02:00
Nicolas Boulenguez
031bdcc731 projects: style improvements
Remove the Name variable, which duplicates an attribute.

Replace hardcoded Mains with Name.

Remove transitional Library_Type variable from library projects.

Make explicit that Library_Version is only useful during relocatable
builds.

Compute Library_Version from Library_Name, in case it ever differs
from Name.

Make the list of possible Library_Type values explicit (the
documentation mentions "dynamic").
2022-08-09 12:44:51 +02:00
Nicolas Boulenguez
040e1cc35e projects: explictly qualify as standard or library 2022-08-09 12:44:51 +02:00
Nicolas Boulenguez
6c87fb7476 library projects: independent selection of each shared object version 2022-08-09 12:35:10 +02:00
Nicolas Boulenguez
f96aad04cd projects: share settings, inherit build flags, drop unused variables 2022-08-09 12:34:55 +02:00
anisimko
acc686a58b Remove wrong Unreferenced pragma
New GNAT detect it.

TN: U122-031
Change-Id: I994d98ab9ace012c64d4409c9fb1f8579db3dcd5
2022-01-17 14:31:55 +00:00
anisimko
084f41bb8f Avoid new GNAT warning "unnecessary with of ancestor"
no-tn-check

Change-Id: I95664515215590ea5f13bb9d6cf2828dc6a020b6
2021-12-20 15:14:40 +06:00
anisimko
c75234037f Remove GNAT bug OB03-009 workaround
GNAT Community 2021 does not have this defect already.

TN: U430-004
Change-Id: Ib10b9d209a866daae7eb684f08a79b26d774dc83
2021-06-20 10:00:20 +06:00
Philippe Gil
447297292c minor refactoring to workaround accessibility checks bug.
TN:U430-004
Change-Id: Ib12c81f1c0e555c71d33c05fba3b023e3c514153
2021-05-01 18:36:20 +02:00
Fedor Rybin
33b963c5e4 Make GNATCOLL.SQL Ada 2020 compatible
Qualify the aggregate to fix compilation error in 2020 mode.

for U121-029

Change-Id: I57c0696eb01ca2ab32106c6760099a402e41910d
2021-01-22 11:22:55 +03:00
anisimko
0819d68de5 Remove unused package references
no-tn-check

GNAT style check became more strict.

Change-Id: I24b59f7b3ffdfa58d8a54b3ede6bfa56fbdcc46d
2020-09-14 11:12:41 +06:00
Fabien Chouteau
5bdd20ae4d gnatcoll_*.gpr: rename external GNATCOLL_BUILD into GNATCOLL_BUILD_MODE
To avoid conflict with installed gnatcoll.gpr where GNATCOLL_BUILD means
library type.

Part of S709-037.

Change-Id: I372b3fc7b35faf14a223465069968ff1e5550250
2020-09-10 18:42:36 +02:00
Fabien Chouteau
d9a2231ff0 gnatcoll_*.gpr: rename all external GNATCOLL_*_BUILD into GNATCOLL_BUILD
To have a unified external for all GNATCOLL project, as discussed for
gnatcoll-db.

Part of S709-037.

Change-Id: I5b6c843df6926288b8906a8c285a6d682394d7bf
2020-08-26 18:38:05 +02:00
Fabien Chouteau
b3a055d835 gnatcoll_*.gpr: introduce the GNATCOLL_*_BUILD external
Like for gnatcoll_core, these externals allow gnatcoll_*.gpr to be used
from a project that defines the BUILD external in an incompatible way.

Part of S709-037.

Change-Id: Ib69453688c4c3ea112aa8b00d3a610bdc2f5426f
2020-07-27 16:56:56 +02:00
Fabien Chouteau
afd3bbfb2f gnatcoll.gpr_{postgres|sql|sqlite|xref}: set default LIBRARY_TYPE
Part of T717-016.

Change-Id: Idd60944d984b2cf9c05759a87cd4b4bb8cc8e8b4
2020-07-17 16:46:32 +02:00
anisimko
767216d0e0 Fix sqlite2db issues
* sql/gnatcoll-sql-inspect.adb (Type_From_SQL):
For Field_Mapping_Integer does not interpret 'numeric' without precision and
scale as Integer. Add decimal type processing.
For Field_Mapping_Float interpret 'decimal' and 'numeric' without precision
and scale as Float.

* sqlite/gnatcoll-sql-sqlite-builder.adb (Foreach_Field):
Ignore square brackets in field names. Fix parsing numeric with position and
scale.

* testsuite/tests/db2ada/chinook/*
Testsuite with public database example.

TN: T627-001
Change-Id: I38843e0c1b6be144d19b9f2e7ed118c2bf44e070
2020-06-30 08:02:57 +06:00
anisimko
37cda9383c Fixes in database schema processing
* gnatcoll-sql-inspect.ads (Type_From_SQL):
Considers datetime as Field_Mapping_Timestamp.

* gnatcoll-sql-inspect.adb (Type_From_SQL):
Considers nvarchar as Field_Mapping_Text.
Parsing max length moved into separated routine Process Max_Length.

* sqlite/gnatcoll-sql-sqlite-builder.adb
(Foreach_Table): Fix SQL request over database tables. Takes only
tables and views from the sqlite_master and does not take service
SQLite tables.
(Foreach_Field): Do not interpret as field the FOREIGN/UNIQUE KEY
element in CREATE TABLE statement.

TN: T627-001
Change-Id: Ibb6ca6c6a67489bbe569c0c0b1aed2e5a9cd4b34
2020-06-27 15:54:18 +02:00
anisimko
7a8d0cf9eb Nanosecond timestamp precision for SQLite
T610-033

SQLite support nanosecond precision for timestamp.
Testsuite for SQLite subseconds.

Change-Id: Ifcf5c3d2dceb6c17153860d8d3c9a95975b837c5
2020-06-12 23:29:37 +06:00
Vasiliy Fofanov
c067251840 Fix various typos and headers, bump copyright.
Motivated by github PR #14. no-tn-check

Change-Id: I866431c55fe0937f348d08cd8a188eb40fc8f061
2020-06-12 19:29:25 +02:00
anisimko
1c9f4b7f94 Support subseconds in timestamp
T610-033

Use GNAT.Calendar.Time_IO.Image instead of Ada.Calendar.Formatting.Image
because it has better precision on subseconds.

Change-Id: I56236d55a76d208cbd611f2eb93036a98dfec830
Depend-On: I08b4190cd89284c1fc5626b80742aafc26a01175
2020-06-11 19:16:57 +06:00
anisimko
93ff96567b Fix data loading for postgres database
T315-007

SQL insert statement to load data uses select statement to take PK value by
another field value. The value in condition in generated "WHERE" part was
with wrong type specifier. The type specifier was taken from the type of FK
field instead of "another" field type.

Change-Id: I820d4c2265d831627770554a0d0226791e4dbc72
2020-03-24 19:36:14 +06:00
Dmitriy Anisimkov
b9ea5f28f9 Fix default name to prepare statement
T315-007

Generate Cached_Result field before check Name parameter to do not use
No_Cache_Id for all automatically assigned parepared statement names.

Change-Id: I91c2928cc803da1beae11a26ce3f1e92dc99b875
2020-03-20 23:46:20 +06:00
Dmitriy Anisimkov
de57885c91 Support prepare on server control
T315-007

(Is_Prepared_On_Server): New routine to know if the statement was prepared
on server side.

Change-Id: Ibb26c0d2b737d942bab7eef4dd7b073b44c76796
2020-03-20 18:40:40 +01:00
Dmitriy Anisimkov
1eb83958a0 Add Length routine for SQL_Field_List
Comment Is_Empty routine

Change-Id: I61b8e764d815f773334c3e162b58a2c06a853149
2018-06-04 16:01:10 +06:00
Dmitriy Anisimkov
98263a4fd6 Get_Tables new routine
R510-007

Convert SQL_Table_List to tables vector. Can be used to extend set of Joined
tables.

Change-Id: I15f8a668b1475c1bf385c30ffc9d6d3e4c32e4eb
2018-05-16 16:14:03 +06:00