From: Dirk Heinrichs <dirk.heinrichs@altum.de>
Subject: Re: Ada and PL/pgSQL ?
Date: Sat, 10 May 2014 11:37:17 +0200
Date: 2014-05-10T11:37:17+02:00 [thread overview]
Message-ID: <lkks0e$50n$1@online.de> (raw)
In-Reply-To: 304f2721-64bc-4959-a7e8-0cc29cf5204f@googlegroups.com
sdalemorrey@gmail.com wrote:
> While researching the PL/pgSQL language I noticed that it bears a shocking
> similarity to Ada. Almost like it's Ada but tailored for SQL.
>
> Still I would like to maintain the safety and provability of Ada.
> It appears that Postgres has the ability to import various languages such
> as C and execute those about as easily as it's own native language.
>
> So the question I have here is, does anyone know of a path to get Ada
> functions operational in Postgres. Or (assuming there is a pathway) is
> Postgres's PL/pgSQL going to give the same benefits of Ada?
While I mostly agree with what Björn has already written, I would
nevertheless like to tell you how it could be done.
In PostgreSQL, you can not only write Stored Procedures in
PL/yourFavoriteLanguage (I prefer Perl, btw.), but you can also import
procedures written in a compiled language such as C[1]. The documentation
also states "or a language that can be made compatible with C, such as C++",
which could as well include Ada.
And then, there's also the SPI[2] (Server Programming Interface). With an
Ada binding to the SPI (which to my knowlegde does not exist, yet), you
would be able to write PostgreSQL functions in Ada.
However, as Björn wrote, that would make your project depend on PostgreSQL
in a way you might not want. If you want to stay independent of a specific
RDBMS, you should look into something like APQ[3], SOCI[4] or GnatColl's
database interface[5]
[1]: http://www.postgresql.org/docs/9.3/static/xfunc-c.html
[2]: http://www.postgresql.org/docs/9.3/static/spi.html
[3]: http://sourceforge.net/projects/apq/
[4]: http://soci.sourceforge.net/doc/3.2/languages/ada/index.html
[5]: http://docs.adacore.com/gnatcoll-docs/sql.html
Bye...
Dirk
--
Dirk Heinrichs <dirk.heinrichs@altum.de>
Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913
GPG Public Key CB614542 | Jabber: dirk.heinrichs@altum.de
Sichere Internetkommunikation: http://www.retroshare.org
next prev parent reply other threads:[~2014-05-10 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 16:26 Ada and PL/pgSQL ? sdalemorrey
2014-05-09 18:02 ` björn lundin
2014-05-09 19:59 ` sdalemorrey
2014-05-09 21:14 ` björn lundin
2014-05-10 9:37 ` Dirk Heinrichs [this message]
2014-05-10 10:40 ` Mike H
2014-05-10 11:04 ` björn lundin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox