• Stars
    star
    25
  • Rank 957,573 (Top 19 %)
  • Language
    Ada
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ada Database Objects

Ada Database Objects

Alire Alire Alire Alire Build Status Test Status Coverage Documentation Status Download License GitLab Commits

Ada Database Objects is an Ada05 library that provides object relational mapping to access a database in Ada05. The library supports Postgresql, MySQL, SQLite as databases. Most of the concepts developped for ADO come from the Java Hibernate ORM.

The ORM uses an YAML, XML mapping file or an UML model, a code generator and a runtime library for the implementation. It provides a database driver for Postgresql, MySQL and SQLite. The ORM helps your application by providing a mapping of your database tables directly in the target programming language: Ada05 in our case. The development process is the following:

  • You design your database model either using a UML tool or by writing a YAML or XML description,
  • You generate the Ada05 mapping files by using the Dynamo code generator,
  • You generate the SQL database tables by using the same tool,
  • You write your application on top of the generated code that gives you direct and simplified access to your database.

ADO Development model

You need at least one of these databases (or all of then). The configure script will now fail if no supported database was found. Check the Database Drivers section to install them and run the configure again after the installation.

Version 2.4.0 - Aug 2023

  • Feature #11: Support to audit creation of new objects in the database
  • Feature #12: Support for database migration
  • Fix #14: Problems with SQLite transactions
  • Fix #15: Use ADO_BUILD instead of BUILD in the Alire crate configuration
  • Fix #16: Status SQLITE_ROW is treated as an error
  • Fix #18: Has_Table does not work for PostgreSQL

List all versions

Build with Alire

alr with ado
alr with ado_sqlite
alr with ado_mysql
alr with ado_postgresql

Build with configure

To build ADO, you will need:

You should have installed either Postgresql, MySQL or SQLite before running the configure script. For Windows, please read the file win32/README that gives some installation hints.

Build with the following commands:

./configure
make

Samples

The samples can be built using:

gnatmake -Psamples

Before launching the samples, the database must have been created. For SQLite, use:

make samples.db

Documentation

The Ada Database Objects sources as well as a wiki documentation is provided on:

Presentations

Database Drivers

The Postgresql, MySQL and SQLite development headers and runtime are necessary for building the ADO driver. The configure script will use them to enable the ADO drivers.

Postgresql Development installation

sudo apt-get install postgresql-client libpq-dev

MySQL Development installation

sudo apt-get install mariadb-client libmariadb-client-lgpl-dev

SQLite Development installation

sudo apt-get install sqlite3 libsqlite3-dev

For Windows, check win32/README to install the libraries.

Database Creation

Create the tests database by using the Dynamo command. (Dynamo is available at: https://gitlab.com/stcarrez/dynamo) Note: change 'root' and 'password' to a MySQL user that has admin access rights ('create database' and 'grant option' privileges).

dynamo create-database db/regtests root password

The default database connection string is defined in dynamo.xml. You can also specify the connection string and create the schema by using:

dynamo create-database db/regtests 'mysql://localhost:3306/ado_test?user=ado' root password

MySQL setup

To create manually the database, you can proceed to the following steps:

  1. Create the 'ado_test' database in MySQL
sudo mysql
mysql> CREATE DATABASE ado_test;
  1. Create the 'ado' user and give the access rights:
mysql> CREATE USER 'ado' IDENTIFIED BY '';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE,
       CREATE, DROP, CREATE TEMPORARY TABLES, EXECUTE,
       SHOW VIEW ON `ado_test`.* TO ado@'%';
mysql> FLUSH PRIVILEGES;
  1. Create the tables
mysql> USE ado_test
mysql> SOURCE db/regtests/mysql/create-ado-mysql.sql

Postgresql setup

To create manually the database, you can proceed to the following steps:

  1. Create the 'ado' user and configure the password (enter 'ado' for the password or update the Makefile as well as the test-postgresql.properties file):
sudo -u postgres createuser ado --pwprompt
  1. Create the 'ado_test' database in Postgresql
sudo -u postgres createdb -O ado ado_test
  1. Create the tables
psql "postgresql://localhost:5432/ado_test?user=ado&password=ado" \
  --file=db/regtests/postgresql/create-ado-postgresql.sql

Testing

Before running the unit tests for MySQL or Postgresql, you must create the test database as described in Database Creation.

The unit tests are built and executed using:

make test

To run manually the unit tests, use the following commands:

bin/ado_harness -config test-mysql.properties

or

bin/ado_harness -config test-sqlite.properties

or

bin/ado_harness -config test-postgresql.properties

Building documentation

The ADO Programmer's Guide is generated by using Dynamo and Pandoc. You may need the following Debian packages:

sudo apt-get install pandoc xsltproc texlive-latex-base texlive-latex-extra texlive-fonts-extra

The documentation is created by the following command:

make doc

and the book is generated in the ado-book.pdf file.

More Repositories

1

ada-awa

Ada Web Application - Framework to build high performance secure web applications
Ada
93
star
2

ada-util

Ada Utility Library - Composing streams, processes, logs, serialization, encoders and more
Ada
69
star
3

sql-benchmark

Tool to make SQL benchmark on different drivers, languages and databases
Ada
31
star
4

ada-keystore

Ada Keystore - protect your sensitive data with secure storage
Ada
31
star
5

swagger-ada

Ada support for OpenAPI code generator
Ada
27
star
6

ada-security

Ada Security - OAuth 2.0 client and server framework to secure web applications
Ada
22
star
7

ada-enet

Ada Embedded Network Stack
Ada
21
star
8

ada-wiki

Ada Wiki Engine - Wiki parser and renderer with several Wiki syntaxes
Ada
19
star
9

etherscope

Ethernet traffic monitor on a STM32F746 board
Ada
17
star
10

dynamo

Dynamo Ada Application Code Generator
Ada
17
star
11

ada-asf

Ada Server Faces - Web Server Faces JSR 252, JSR 314 and JSR 344
Ada
12
star
12

resource-embedder

ARE - Advanced Resource Embedder include files, scripts, images in Ada, C, Go binaries
Ada
10
star
13

ada-search

Ada
9
star
14

ada-bfd

Ada BFD is an Ada binding for the GNU Binutils BFD library. It allows to read binary ELF, COFF files by using the GNU BFD.
Ada
8
star
15

swagger-ada-todo

Simple todo list server with OpenAPI
Ada
8
star
16

ada-el

Ada EL - Expression Language Library (JSR245)
Ada
7
star
17

ada-servlet

Ada Servlet - Web Servlet Library following JSR 154, JSR 315
Ada
7
star
18

atlas

AWA Demonstrator
TSQL
7
star
19

ada-css

Ada parser for CSS files with CSS Object Model API
Ada
6
star
20

ada-lzma

Ada binding for liblzma compression library
Ada
6
star
21

mat

Memory Analysis Tool
Ada
6
star
22

ada-stemmer

Multi natural language stemmer with Snowball generator
Ada
4
star
23

stm32-ui

STM32 UI library and tools
Ada
4
star
24

ada-rest-api-server-benchmark

Benchmark for REST api on Ada servers
Ada
3
star
25

jason

Project and ticket management
Ada
3
star
26

bbox-ada-api

Ada Binding for the Bbox API
Ada
3
star
27

wi2wic

Wiki 2 Wiki Converter
Ada
2
star
28

hestia

Heat Controller
Ada
2
star
29

ada-mail

Mail tools
Ada
2
star
30

ada-libsecret

Ada Binding for the libsecret library
Ada
2
star
31

babel

Babel Backup
Ada
1
star
32

ada-awe

Automatically exported from code.google.com/p/ada-awe
Ada
1
star
33

helios

Helios Fast Reliable Monitoring Agent
Ada
1
star
34

awa-alire-index

1
star
35

xcra

Automatically exported from code.google.com/p/xcra
C++
1
star