<div dir="ltr">Hello haskellers!<div><br></div><div>HDBI is the fork of HDBC but reworked. It supports SQlite3 and Postgresql for now. It also supports streaming with coduits.</div><div>There is TH deriving mechanism to map database rows to Haskell structures and back. HDBI is trying to become simple</div>
<div>but still powerfull and flexible database interface. It must be suitable to become the common RDBMS interface  for higher level interfaces</div><div>like persistent or haskelldb.</div>

<div><br></div><div>The documentation is not very good, while I have no enough time to make some.</div><div><br></div><div>In this version changed typeclass signatures of Connection and Statement. </div><div>Now methods `run` and `execute` get any instance of `ToRow` and method `fetch` return an instance of `FromRow`.</div>
<div>Note that [SqlValue] is also an instance of `FromRow` and `ToRow` typeclasses so you do not loose the control.</div><div>Methods `fromRow` and `toRow` for [SqlValue] are just `id`. SQlite and Postgresql drivers are fixed as well as hdbi-conduit.</div>
<div><br></div><div>There is also new helper functions, like `onei :: Integer -> [SqlValue]` which helps you to execute queries with one parameter </div><div>or execute many queries consistinf of one parameter. </div><div>
<br></div><div><div>Prelude Database.HDBI Database.HDBI.SQlite> :set -XScopedTypeVariables</div><div>Prelude Database.HDBI Database.HDBI.SQlite> :set -XOverloadedStrings</div><div>Prelude Database.HDBI Database.HDBI.SQlite> c <- connectSqlite3 ":memory:"</div>
<div>Prelude Database.HDBI Database.HDBI.SQlite> runRaw c "create table test(val integer)"</div><div>Prelude Database.HDBI Database.HDBI.SQlite> withTransaction c $ runMany c "insert into test(val) values (?)" $ map one [1..1000]</div>
<div><br></div><div><interactive>:7:76: Warning:</div><div>    Defaulting the following constraint(s) to type `Integer'</div><div>.........</div><div><br></div><div>Prelude Database.HDBI Database.HDBI.SQlite> r :: (Maybe Integer) <- runFetchOne c "select sum(val) from test" ()</div>
<div>Prelude Database.HDBI Database.HDBI.SQlite> r</div><div>Just 500500</div></div><div><br></div><div>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].</div>
<div>Use empty list as a parameters is bad idea, because we could instantiate some another list of things, suppose the [Integer] as `FromRow` and </div><div>`ToRow` instance. So it would lead to ambigous type because [SqlValue] is also a list instantiating `FromRow` and `ToRow`.</div>

</div>