42 Commits

Author SHA1 Message Date
Nicolas Boulenguez
e48685cf13 Remove unneeded execution rights 2022-08-08 10:21:08 +02:00
Vasiliy Fofanov
8ef0ef9687 Add example for GNATCOLL.Projects.
TN: SB20-043

Change-Id: Iac5a99ab74ed895143b0c31b69a0d4fe91451e65
2019-11-21 15:28:20 +01:00
Vasiliy Fofanov
4debbaadb6 Clean up examples directory and relocate coders example.
Change-Id: Icbe23591d0364681549b8594ec456c0148be24e1
2019-11-21 00:11:59 +01:00
Nicolas Boulenguez
8396e83b0e Add shebang for an executable script
The executable shell script examples/library/build.sh is run by
testsuite/sql/__init__.py, but may be run manually as an example.
2019-09-03 00:43:43 +02:00
Dmitriy Anisimkov
9045449637 Use Coders.Base64 in Email.Utils
S129-038

Change-Id: Ic21edcd4fc8b0d80080f19e11486abb13110ef06
2019-02-01 15:12:14 +06:00
Dmitriy Anisimkov
a5528caa39 Fix base64 decoder at the end on decoding
S129-038

Fix some unitialized fields by the way and add one demo.

Change-Id: I5010cf1938127562ea0b8a241f1308b4c8ce59be
2019-01-31 11:53:37 +01:00
Dmitriy Anisimkov
69170caa1c Universal interface to transcode data and base64 encoder/decoder
P517-049

Change-Id: Ibd4d35afadb5d913c14b3ecb07c2a39b89b9bb31
2019-01-24 13:38:49 +06:00
Vasiliy Fofanov
595777b2b7 Some cleanup and adjustments.
Define So_Ext and use it to compute Library_Version.
Use explicit sources subdir at installation to ensure that the same
source directory is used for all library variants.

TN: P909-033 no-precommit-check

Change-Id: I717c40f0f55001e3fa63c519b35820eaf6dc9f2d
2017-10-30 11:32:59 +01:00
Vasiliy Fofanov
6fe0fbee46 Initial version of gnatcoll-core module.
Part of major reorganization of gnatcoll for better modularity and
maintainability.

Change-Id: I0070dd85b9ee37db00dfda96039b2390bf303fad
TN: P909-033
2017-10-24 18:04:29 +02:00
Dmitriy Anisimkov
db06065c5f Revert "Merge feature Deepbluecapital contribs sql"
This reverts commit ddc7448693566d8433a8ff04e4b3cb5beac3451f, reversing
changes made to e9a7649d7abe47f6bdaa88a97871842692152ec1.

Change-Id: I2fb1cd4e5f67eeef6e7402b4f61af0a0cdf1ebf5
2017-09-14 16:19:55 +02:00
Emmanuel Briot
5d652da7c0 Improvements to GNATCOLL.SQL
This commit aggregates multiple smaller commits, and provides the
 following major reorganization to GNATCOLL.SQL*

(gnatcoll_db2ada):
 report an error when the user used a wrong keyword
 In a database schema description, tables should start with TABLE,
 ABSTRACT TABLE or VIEW. Report an error in other cases

(database description files):
 Add support for different type name in schema description and SQL.
 In some cases, users might want to use a different name in the schema
 description files than actually used by SQL.

Custom field types
 A single generic package instantiation is needed to create custom field
 types. This is also used for all predefined field types.
 This avoids duplication of information between the three or four
 instantiations we had to do before, and ensures better consistency. For
 instance, a SQL_Field_Float was sometimes mapped to "float" and
 sometimes to "real". Likewise, a time field was sometimes a "timestamp"
 and sometimes a "timestamp with time zone".
 This also ensures that users do not forget to register their custom
 types, or to make them available to database description files and
 gnatcoll_db2ada.

fix mapping of "numeric"
 "numeric" should be mapped to a float, but "numeric(precision)" should
 be an integer (It has a scale of 0), as well as "numeric(precision,0)".
 And "numeric(position,scale)" with a scale other than 0 should be a
 float.
 Map a sql "numeric(precision,scale)" to Ada Long_Long_Float.
 A Float is not enough to represent the full precision.
 Fix duplicate type definition in GNATCOLL (SQL_Field_Long_Float).
 In particular, one of the definitions was mapping a "float" in a
 database description file to an Ada "Float", though the documentation
 in gnatcoll-sql.ads says these were mapped to Long_Long_Float.

(Long_Float_Value): renamed to Long_Long_Float_Value for consistency.
 In fact, long float fields are implemented as Long_Long_Float, so we
 had an inconsistency which is now easier to detect with the new
 organization of generic packages.

(Cast): function moved to the generic Field_Types
 It is now easier for people writing custom sql types to have access to
 "CAST (field AS type)" functions

Simplify handling of parameter types
 (Field_Mapping): no longer needs to know about parameter types, just the
  SQL name is enough. This simplifies instantions of
  Simple_Field_Mapping, makes things more efficient, and will make it
  possible to move this type directly in the Field_Types package, to ease
  creating new custom types.
 (SQL_Parameter_Type): remove the Type_String primitive operation, not
  needed since we never override it anyway. Minor efficiency gain.
  Use XString is more place, instead of String_Access, also for efficiency
  since most of the time the strings are small. So we are saving on
  mallocs.

Ranges
 We need to retrieve a type with static bounds which can be manipulated
 from Ada. Previously we were retrieving a SQL type, whose bounds could
 be defined as SQL functions.
 (Ada_Range): is now a pure Ada type (unrelated to SQL) which can be
  used to perform interval operations. At some point, it might make
  sense to make it into a top-level GNATCOLL package.

Dates
 When we create a date with Ada.Calendar.Time_Of (with no seconds),
 then depending on the timezone it is possible that the resulting
 string was set to the day before.
 For instance, the sql/ranges test was using an Ada Time 2017-12-31,
 but the string '2017-12-30' was passed to postgres when run from
 Paris timezone in the morning.

Change how we override default getters for cursors. A DBMS_Cursor used
 to have primitives to convert the return value (usually a string) to
 a more specific Ada type. But in fact, we need those functions at the
 level of the formatter (postgresql or sqlite) so that we can parse a
 range value's bounds.

Testsuite
 Skip tests that require running postgresql, when the current
 environment does not provide this.
2017-08-29 12:51:57 +02:00
Nicolas Setton
ed9ec4fdf7 Remove support for GtkAda, Pygtk, PyGObject
This cleans up the dependency tree. The corresponding code
still exists and has been moved to the GPS repository, which
is probably the only place where this is needed.

For Q727-014

Change-Id: I2c9df154694fb3f1dcdc62c50be68d332a967f59
2017-07-31 11:35:39 -04:00
Emmanuel Briot
19a6e762ae Update copyright notices
Q102-020

Change-Id: Ib1e3678311d32aa120fc36f2557654e5cab2f370
2017-01-03 10:05:49 +01:00
Emmanuel Briot
f6b19081d6 Fix build error in examples
From P120-046

Change-Id: I4392d6161517c21ed875da02adde2db9adc834b4
2016-01-21 16:38:49 +01:00
Emmanuel Briot
aa84b70853 Update copyright year
Change-Id: Ibc7640eaef7ae555da7e11b179d5b153ec98e4ea
2016-01-04 12:03:03 +01:00
Emmanuel Briot
e20b1cde34 Remove -gnat05 from test and examples project files
GNATCOLL has been compiled with the default compiler mode (Ada2012)
for a while now, so we should do the same for the testsuite.

Rename some "pragma Ada_12" to "pragma Ada_2012" for consistency

OC08-006

Change-Id: Ia63d2cfcde2caa7c85fb67e346fbc3177e74724b
2015-12-08 12:49:41 +01:00
Dmitriy Anisimkov
c6971da946 Fix task unsafe types SQL_Table_List and SQL_Left_Join_Table.
OC08-003

Remove -gnat05 from testsuite gpr files to avoid compilation errors.

Change-Id: I908efdcda12c93a4ad170bbbdef29be4ed2ebc67
2015-12-08 13:40:02 +06:00
Pascal Obry
cbb6fd0c7d Rework installation step using gprinstall.
This made it possible to clean-up lot of code.

For L626-014.

Change-Id: I0fea4a395a815858e4ebf2ec15a4af57864c9615
2015-06-08 11:01:14 +02:00
Emmanuel Briot
c4292f179e Update copyright notices to 2015 2015-01-05 11:16:11 +01:00
Emmanuel Briot
72bd9ed678 Make sure the example compiles with recent versions of GtkAda.
N618-047

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@229232 936e1b1b-40f2-da11-902a-00137254ae57
2014-06-19 07:16:32 +00:00
Emmanuel Briot
bf26694133 Update copyright notices to 2014
N103-019

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@221487 936e1b1b-40f2-da11-902a-00137254ae57
2014-01-06 10:29:22 +00:00
Emmanuel Briot
9a5485d479 Update copyright notice to 2013
M103-015

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@200402 936e1b1b-40f2-da11-902a-00137254ae57
2013-01-08 10:50:34 +00:00
Emmanuel Briot
acc050b564 Make sure the examples can be compiled with a simple "make"
git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@193912 936e1b1b-40f2-da11-902a-00137254ae57
2012-09-03 09:29:26 +00:00
Emmanuel Briot
d24c7d6e54 Fix compilation error in the examples
L725-041

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@192707 936e1b1b-40f2-da11-902a-00137254ae57
2012-07-26 07:29:13 +00:00
Emmanuel Briot
aa09c2449f (Run_Command): cleanup handling of Hide_Output.
We now longer create and call our custom _gnatcoll class to redirect
 sys.stdout, sys.stderr and sys.displayhook. This method was fragile
 in the face of multi-tasking (L607-001). It was also hiding too
 much in fact, since it was often confusing for users that their
 "print" statements did not generate any output (L620-027).
Instead, we now compile with special flags with Py_CompileString,
 so that python does not generate the call to displayhook.
 Because of this, we cannot use __builtins__._ to look at the result
 of the previous command, but we get this output directly from
 PyEval_EvalCode when the code is an expression.
 One of the changes for users is that we can no longer execute a
 string containing a class or function definition or import statement,
 and expect to get its output (but in fact there is none, so the code
 was suspicious in the first place).
A few other optimizations in Run_Command (logging directly using the
 traces module, rather than through the console class), and avoid
 string manipulation when possible.
Provide support for logging exception messages in the log file, to
 help debug scripts.
Finally, this code is in preparation for support of python3 (L619-031)

git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gps@191180 936e1b1b-40f2-da11-902a-00137254ae57
2012-06-20 19:23:03 +00:00