From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.82.115 with SMTP id n79mr3393698yhe.35.1385049008506; Thu, 21 Nov 2013 07:50:08 -0800 (PST) X-Received: by 10.49.35.65 with SMTP id f1mr23127qej.38.1385049008483; Thu, 21 Nov 2013 07:50:08 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!i2no731547qav.0!news-out.google.com!9ni895qaf.0!nntp.google.com!i2no731541qav.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 21 Nov 2013 07:50:08 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=136.163.203.9; posting-account=l8k8IwoAAADeDydswOzwNzmn10qOk9gt NNTP-Posting-Host: 136.163.203.9 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <536649c2-ff71-4e01-b8a8-20871501afbc@googlegroups.com> Subject: Re: AWS Entry into the TechEmpower Framework Benchmark Project From: ake.ragnar.dahlgren@gmail.com Injection-Date: Thu, 21 Nov 2013 15:50:08 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:17753 Date: 2013-11-21T07:50:08-08:00 List-Id: On Tuesday, November 19, 2013 3:59:04 AM UTC+1, Shark8 wrote: > TechEmpower is Benchmarking different frameworks for web-development ( ht= tp://www.techempower.com/benchmarks/#section=3Dmotivation&hw=3Di7&test=3Djs= on ). There was no entry for AWS, or any other Ada showing (I know there's = matreshka, and IIRC several Ada/CGI bindings), so I coded one up. Unfortuna= tely there is no DB-functionality in it right now, as I couldn't get the OD= BC to work, nor could I find a working InterBase (or FireBird) binding for = Ada. Using GNATCOLL it's possible to "talk" to a SQLite or PostgreSQL database. = To use it you use a text file to describe the tables of your database (the = schema). Then you use the executable gnatcoll_db2ada to generate the tables= in the database (I've only used it for PostgreSQL), and then you use the s= ame tool to generate the Ada code to be used by your application. Example u= sage: To create the tables in the PostgreSQL database: gnatcoll_db2ada -dbmodel=3Ddatabase_description.txt -dbhost=3Dlocalhost -db= port=3D5432 -dbname=3Ddatabase_name -dbuser=3Duser_name -dbpasswd=3Dsome_pa= ssword -createdb To generate the Ada files: gnatcoll_db2ada -dbmodel=3Ddatabase_description.txt -api=3DAuto_Generated_D= atabase_API When using the SQL database in the Ada code you need the Connection instanc= e. Description : GNATCOLL.SQL.Exec.Database_Description; Connection : GNATCOLL.SQL.Exec.Database_Connection; Description :=3D GNATCOLL.SQL.Postgres.Setup(Database =3D> Datab= ase_Name, User =3D> User_Name, Host =3D> Host_URL, Password =3D> User_Password, SSL =3D> Postgres.Allow, Cache_Support =3D> True); Connection :=3D GNATCOLL.SQL.GNATCOLL.SQL.Exec.Get_Task_Connection(De= scription =3D> Description); When you are finished talking to the database (i.e. when it's time to shutd= own the application) you need to: GNATCOLL.SQL.Exec.Free (Connection); GNATCOLL.SQL.Exec.Free (Description); You can for example construct an SQL statements by: Query_Insert : constant GNATCOLL.SQL.SQL_Query :=3D GNATCOLL.SQL.SQL_Insert(Values =3D> ...); Before using it you always need to reset the connection to the database by: Connection.Reset_Connection; Then you can execute the SQL statement using the connection instance: ... :=3D Connection.Insert_And_Get_PK(Query =3D> Query_Insert, PK =3D> Auto_Generated_Database_A= PI...); For further details please read the GNATCOLL documentation. Best regards, =C5ke Ragnar Dahlgren