Giter Site home page Giter Site logo

hdbi's Introduction

HDBI

Welcome to HDBI, Haskell Database Independent interface.

HDBI is the fork of HDBC. This is just improved HDBC with new features.

Installation

Tested on GHC-7.4 but must work on older and newer versions, HUGS is not supported for now.

The steps to install are:

cabal install hdbi

hdbi's People

Contributors

jgoerzen avatar s9gf4ult avatar zenzike avatar sol avatar bos avatar hesselink avatar lpsmith avatar marcweber avatar snoyberg avatar evmar avatar gracjan avatar hiteshjasani avatar carlssonia avatar tanimoto avatar toby-allsopp avatar bringert avatar

Stargazers

David Johnson avatar Kaiko Kaur avatar Slava Krauchanka avatar timothy avatar Anton Guryanov avatar

Watchers

 avatar Kaiko Kaur avatar James Cloos avatar  avatar

hdbi's Issues

Make the statements tagged

Make the statements tagged

prepare :: Connection -> Query -> Tagged New Statement
execute :: Tagged New Statement -> Tagged Executed Statement
finish :: Tagged a Statement -> Tagged Finished Statement
reset :: Tagged a Statement -> Tagged New Statement

This brings the lifecycle of the statements to typelevel.

Add support of nested transactions

Many databases support nested transactions through "savepoints". We could add this feature to withTransaction function, but this one must be a method of Connection because savepoints are implemented differently in databases. There is also some another differences in databases, so this is more logical to do withTransaction as Connection method and remove begin rollback and commit methods to unleash a driver developer's hands.

Make named parameters posible

Add named request parameter placeholders like select * from tbl where fld1 = :param1: and fld2 in :param1: to :param2:

We will need also some method like

executeNamed :: Statement -> [(ParamName, SqlValue)] -> IO ()

to execute such a queries. This will also need a special query parser

`FromRow` and `ToRow` typeclasses

Add typeclasses FromRow and ToRow to simplify data convertion between database and Haskell.

class FromRow a where
  fromRow :: [SqlValue] -> a

class ToRow a where
  toRow :: a -> [SqlValue]

Note, that typeclass Statement should not change, this is logical to add separate functions for statement execution and row fetching like this

executeRow :: (Statement stmt, ToRow r) => stmt -> r -> IO ()
fetchFromRow :: (Statement stmt, FromRow r) => stmt -> IO (Maybe r)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.