comp.lang.ada
 help / color / mirror / Atom feed
* gnatcoll_db2ada problem "Database not supported:"
@ 2019-12-27 10:48 George J
  2019-12-27 11:26 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: George J @ 2019-12-27 10:48 UTC (permalink / raw)


Hi all!
I'm trying to create an Ada app to work with database, so i've installed gnatcoll-db, gnatcoll_db2ada. I have simple database created with sqlite3. I've read tutorials on the adacore (https://docs.adacore.com/gnatcoll-docs/sql.html) but sorry, i can't understand one simple moment. I've got that we can create the representation of the database with the Ada package view. It's cool. But how can we get this? I can make this only using file as in exapmle:

| TABLE | customers     | customer        || The customer for the library |
| id    | AUTOINCREMENT | PK              || Auto-generated id            |
| first | TEXT          | NOT NULL        || Customers' first name        |
| last  | TEXT          | NOT NULL, INDEX || Customers' last name         |

but when i'm tring to do with simple created database: 
gnatcoll_db2ada -dbname test.db
i'm getting : 
Database not supported:

And my question is. What if i already have some big database and want to create an Ada app to work with. Can i work with it in the same way? May be i don't know something. Or i can work with db file with connecting to him and send direct SQL queries? I've never worked with databases with Ada so this theme is very difficult for me now. But interesting)
Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatcoll_db2ada problem "Database not supported:"
  2019-12-27 10:48 gnatcoll_db2ada problem "Database not supported:" George J
@ 2019-12-27 11:26 ` Dmitry A. Kazakov
  2019-12-27 15:39   ` George J
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry A. Kazakov @ 2019-12-27 11:26 UTC (permalink / raw)


On 2019-12-27 11:48, George J wrote:

> And my question is. What if i already have some big database and want to create an Ada app to work with.

That is 80% of the cases.

> Can i work with it in the same way?

You can work in a normal way, i.e. create environment (if required), 
open connection, prepare statement, bind parameters, execute statement, 
fetch results. It is no rocket science.

> May be i don't know something. Or i can work with db file with connecting to him and send direct SQL queries?

That is the way to do it.

> I've never worked with databases with Ada so this theme is very difficult for me now. But interesting)

Ada does not differ in working with DB to any other language.

I understand that you are stuck with some higher-level DB client 
abstraction. I would tentatively suggest to use a more direct method.

In my view if abstraction is needed, then it must be higher, e.g. a 
persistency layer abstracting all DB and whole SQL mess away. Otherwise, 
it only complicates the ugly stuff, IMO.

P.S. Talking about big databases, SQLite3 is absolutely unsuitable for 
dealing with a big database. It is not an intended use case of.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnatcoll_db2ada problem "Database not supported:"
  2019-12-27 11:26 ` Dmitry A. Kazakov
@ 2019-12-27 15:39   ` George J
  0 siblings, 0 replies; 3+ messages in thread
From: George J @ 2019-12-27 15:39 UTC (permalink / raw)


пятница, 27 декабря 2019 г., 14:26:55 UTC+3 пользователь Dmitry A. Kazakov написал:
> On 2019-12-27 11:48, George J wrote:
> 
> > And my question is. What if i already have some big database and want to create an Ada app to work with.
> 
> That is 80% of the cases.
> 
> > Can i work with it in the same way?
> 
> You can work in a normal way, i.e. create environment (if required), 
> open connection, prepare statement, bind parameters, execute statement, 
> fetch results. It is no rocket science.
> 
> > May be i don't know something. Or i can work with db file with connecting to him and send direct SQL queries?
> 
> That is the way to do it.
> 
> > I've never worked with databases with Ada so this theme is very difficult for me now. But interesting)
> 
> Ada does not differ in working with DB to any other language.
> 
> I understand that you are stuck with some higher-level DB client 
> abstraction. I would tentatively suggest to use a more direct method.
> 
> In my view if abstraction is needed, then it must be higher, e.g. a 
> persistency layer abstracting all DB and whole SQL mess away. Otherwise, 
> it only complicates the ugly stuff, IMO.
> 
> P.S. Talking about big databases, SQLite3 is absolutely unsuitable for 
> dealing with a big database. It is not an intended use case of.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

Thanks, Dmitry!
Yes, you're right, i've lost in abstractions and couldn't understand how to work with .db file with gnatcoll_db2ada.
I wanted also to try this example - https://www.adacore.com/gems/gem-129-type-safe-database-api-part-1/, but i have the error described below.
And database not so big, it's about 8-10 tables contains not much data. So i've decided to use sqlite.
And i couldn't find any simple example of using gnatcoll-db or any other module with database, like
1. open db - "Some_Open_Proc ("test.db");"
2. get some values - "SQL_Query_Proc ( "GET * FROM .....", ... );"
3. close conneсtion - "Some_Close_Proc ( ... );"
Now i've found some examples using ADO and AdaBase modules, so i will study them.
Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-27 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-27 10:48 gnatcoll_db2ada problem "Database not supported:" George J
2019-12-27 11:26 ` Dmitry A. Kazakov
2019-12-27 15:39   ` George J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox