caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Erkki Seppala <flux-caml@inside.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] looking for "real world" sqlite3 examples
Date: Sun, 05 Jul 2015 16:45:14 +0300	[thread overview]
Message-ID: <m49io9yen11.fsf@coffee.modeemi.fi> (raw)
In-Reply-To: <CAFrFfuEY8f1i5K7wiiRMD5A_WFokeh15y3_BMiAf2HR=vgqPiw@mail.gmail.com> (Martin DeMello's message of "Sat, 4 Jul 2015 17:03:17 -0700")

Hello,

Martin DeMello <martindemello@gmail.com> writes:

> 2. type conversions - in the absence of an orm, do i have to write my
> own by hand per resultset. or is there some intermediate-level library
> that i haven't found that would automate some of it?
>
> 3. is there a maintained library for generating sql queries in a typed manner?

You should look into SqlExpr:

  https://github.com/mfp/ocaml-sqlexpr/

I used it recently for a very small project, and it seemed to work
great, even if it doesn't ensure compile-time type safety like PGOCaml.

What I would really like would be a database interface that would work
with both PostgreSQL and SQLite. Apparently ODBC bindings for OCaml
exists, so it would work, but I haven't really tried it out yet.. In
particular I would miss SqlExpr :).

> But mostly, I want to look at someone else's code and get an idea of
> how this is done in ocaml; pretty much all my database code to date
> has been written in dynamically typed languages and relied on code
> generation.

I just write the queries in this small case. It doesn't really allow
dynamically composing new queries out from old ones. For that there is
macaque:

  https://github.com/ocsigen/macaque

I haven't tried it for a long time, apparently it has matured quite
a bit.

-- 
  _____________________________________________________________________
     / __// /__ ____  __               http://www.modeemi.fi/~flux/\   \
    / /_ / // // /\ \/ /                                            \  /
   /_/  /_/ \___/ /_/\_\@modeemi.fi                                  \/

  reply	other threads:[~2015-07-05 13:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-05  0:03 Martin DeMello
2015-07-05 13:45 ` Erkki Seppala [this message]
2015-07-05 15:37   ` Mauricio Fernández
2015-07-15 13:32 ` Oleg
2015-07-17  7:10 ` Petter Urkedal

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=m49io9yen11.fsf@coffee.modeemi.fi \
    --to=flux-caml@inside.org \
    --cc=caml-list@yquem.inria.fr \
    /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).