[Haskell-cafe] Announce: HDBI-1.3 and friends

Alexey Uimanov s9gf4ult at gmail.com
Wed Oct 16 04:11:40 UTC 2013

> Oracle support ?

There is no conflicts with my plans. It can be added throug ODBC or native

> NoSql databases

No. HDBI is planned to be a simple flexible common interface for RDBMS. It
is not yet another ORM it just execute queries and fetch the results. NoSQL
databases differ too much.

2013/10/16 Dan <dan_2kb at yahoo.com>

> Thanks Alexey,
> Any plans for :
> 1 - Oracle support ?
> 3 - NoSql databases (Mongo, Cassandra, etc) support ?
> Cheers,
> Dan
> Date: Tue, 15 Oct 2013 23:55:16 +0600
> From: Alexey Uimanov <s9gf4ult at gmail.com>
> To: Haskell Cafe <haskell-cafe at haskell.org>
> Subject: [Haskell-cafe] Announce: HDBI-1.3 and friends
> Message-ID:
>     <CANtkurc-6sQ87Bji=O0OhEteZJFh=tD2yz8ckTLgYc7J2u_SoA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> Hello haskellers!
> HDBI is the fork of HDBC but reworked. It supports SQlite3 and Postgresql
> for now. It also supports streaming with coduits.
> There is TH deriving mechanism to map database rows to Haskell structures
> and back. HDBI is trying to become simple
> but still powerfull and flexible database interface. It must be suitable to
> become the common RDBMS interface  for higher level interfaces
> like persistent or haskelldb.
> The documentation is not very good, while I have no enough time to make
> some.
> In this version changed typeclass signatures of Connection and Statement.
> Now methods `run` and `execute` get any instance of `ToRow` and method
> `fetch` return an instance of `FromRow`.
> Note that [SqlValue] is also an instance of `FromRow` and `ToRow`
> typeclasses so you do not loose the control.
> Methods `fromRow` and `toRow` for [SqlValue] are just `id`. SQlite and
> Postgresql drivers are fixed as well as hdbi-conduit.
> There is also new helper functions, like `onei :: Integer -> [SqlValue]`
> which helps you to execute queries with one parameter
> or execute many queries consistinf of one parameter.
> Prelude Database.HDBI Database.HDBI.SQlite> :set -XScopedTypeVariables
> Prelude Database.HDBI Database.HDBI.SQlite> :set -XOverloadedStrings
> Prelude Database.HDBI Database.HDBI.SQlite> c <- connectSqlite3 ":memory:"
> Prelude Database.HDBI Database.HDBI.SQlite> runRaw c "create table test(val
> integer)"
> Prelude Database.HDBI Database.HDBI.SQlite> withTransaction c $ runMany c
> "insert into test(val) values (?)" $ map one [1..1000]
> <interactive>:7:76: Warning:
>     Defaulting the following constraint(s) to type `Integer'
> .........
> Prelude Database.HDBI Database.HDBI.SQlite> r :: (Maybe Integer) <-
> runFetchOne c "select sum(val) from test" ()
> Prelude Database.HDBI Database.HDBI.SQlite> r
> Just 500500
> Note here that the empty set is used as a parameter of query in
> `runFetchOne`. Empty set is an instance of `FromRow` and `ToRow` and return
> an empty list of [SqlValue].
> Use empty list as a parameters is bad idea, because we could instantiate
> some another list of things, suppose the [Integer] as `FromRow` and
> `ToRow` instance. So it would lead to ambigous type because [SqlValue] is
> also a list instantiating `FromRow` and `ToRow`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131016/180fa7af/attachment.html>

More information about the Haskell-Cafe mailing list