caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alex Baretta <alex@barettadeit.com>
To: Richard Jones <rich@annexia.org>, Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Idea for another type safe PostgreSQL interface
Date: Tue, 19 Jul 2005 08:26:30 +0200	[thread overview]
Message-ID: <42DC9D16.1080607@barettadeit.com> (raw)
In-Reply-To: <20050718210518.GA10051@furbychan.cocan.org>

Richard Jones wrote:
>   [I just throwing this idea out there to see if people find it
>   interesting, or want to shoot it down ...  There're only fragments of
>   working code at the moment]
> 
> I'm thinking about a type safe interface to PostgreSQL.  One such
> interface at the moment is in Xcaml, but it only supports a very small
> subset of SQL, and I like to use complex SQL.  It seems that there is
> a way to support the whole of PostgreSQL's language from within OCaml
> programs, in a type safe way.

Every once in a while we extend the Embedded SQL with a new feature, but
we never planned to support all of PostgreSQL. In fact, what we want to
have is abstraction over the actual DB implementation.

> The general plan would be to have a camlp4 extension which would use
> Postgres's new "PREPARE" feature to actually prepare the statements,
> and Postgres's other new feature, "Describe Statement", to pull out
> the parameter types and result types from the prepared statement.
> This allows the camlp4 extension to replace the statement string with
> a type safe expression, and allow type inference to find mismatches.
> How a typical program would look is shown at the end of this message.

I really think XDBS is the the way to go. You define the schema in a
high level language (OO-Entity-Relationship modeling), supporting lower
level refinements (logical, physical and virtual schema refinements) and
compiling to Ocaml and SQL-DDL. This way, the type safety can be
established at compile time without need for a database connection.
Also, the type safety does not depend on a specific implementation of
SQL, which is usually desireable.

Alex

-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


  reply	other threads:[~2005-07-19  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-18 21:05 Richard Jones
2005-07-19  6:26 ` Alex Baretta [this message]
2005-07-19 11:53   ` [Caml-list] " Richard Jones
2005-07-19 16:37     ` Alex Baretta
2005-07-19 11:55   ` jean-claude

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42DC9D16.1080607@barettadeit.com \
    --to=alex@barettadeit.com \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).