hpaste

recent | annotate | new

Name:           Takusen
Version:        0.8
License:        BSD3
License-file:   LICENSE
Author:         Alistair Bayley, Oleg Kiselyov
Copyright:      2003-2007, Alistair Bayley, Oleg Kiselyov
Maintainer:     alistair@abayley.org, oleg@pobox.com
Stability:      experimental
Homepage:       http://darcs.haskell.org/takusen
Package-url:    http://darcs.haskell.org/takusen
Category:       Database
Build-type:     Custom
Cabal-Version:  >= 1.2
Synopsis:       Database library with left-fold interface, for PostgreSQL, Oracle, SQLite, ODBC.
Description:   
    Takusen is a DBMS access library. Like HSQL, we support
    arbitrary SQL statements (currently strings, extensible to anything
    that can be converted to a string).
    .
    Takusen's unique selling point is safety and efficiency.
    We statically ensure all acquired database resources - such
    as cursors, connections, and statement handles - are released, exactly
    once, at predictable times. Takusen can avoid loading the whole result
    set in memory, and so can handle queries returning millions of rows in
    constant space. Takusen also supports automatic marshalling and
    unmarshalling of results and query parameters. These benefits come
    from the design of query result processing around a left-fold
    enumerator.
    .
    Currently we fully support ODBC, Oracle, Sqlite, and PostgreSQL.

flag odbc
flag oracle
flag postgres
flag sqlite

Library

  Exposed-modules:
        Database.Enumerator
      , Database.InternalEnumerator
      , Database.Util
      , Database.Stub.Enumerator

  If flag(odbc)
    Exposed-modules:
        Database.ODBC.Enumerator
      , Database.ODBC.OdbcFunctions
    If os(windows)
      extra-libraries: odbc32
    Else
      extra-libraries: odbc

  If flag(oracle)
    Exposed-modules:
        Database.Oracle.Enumerator
      , Database.Oracle.OCIConstants
      , Database.Oracle.OCIFunctions
    Build-Tools: sqlplus

  If flag(postgres)
    Exposed-modules:
        Database.PostgreSQL.Enumerator
      , Database.PostgreSQL.PGFunctions
    Build-Tools: "pgconfig"
    Extra-Libraries: pq

  If flag(sqlite)
    Exposed-modules:
        Database.Sqlite.Enumerator
      , Database.Sqlite.SqliteFunctions
    If os(windows)
      Build-Tools: sqlite3
    else
      PkgConfig-Depends: sqlite3
      Build-Tools: sqlite3

  Build-Depends:  base, mtl, time, old-time

  Other-modules: 
        Control.Exception.MonadIO
      , Foreign.C.UTF8
      -- We don't expose the Test modules; the only reason to do so would be so Haddock
      -- can use them (to stop the warnings "could not find link destination for:"),
      -- and for that they'd have to be in Exposed-modules.
      -- Modules in Other-modules are passed to Haddock with --hide=<module-name>.
  Ghc-Prof-Options: -prof -auto-all
          --Ghc-Options: -O2
          --Ghc-Options: -optl-Wl--enable-stdcall-fixup
  Extensions: CPP

odbcConfigProgram = simpleProgram "odbc_config"
sqlplusProgram    = simpleProgram "sqlplus"
pgConfigProgram   = (simpleProgram "pgconfig") {
                      programFindLocation = findProgramOnPath "pg_config"
                    }
sqlite3Program    = simpleProgram "sqlite3"

main :: IO ()
main = defaultMainWithHooks defaultUserHooks {
         hookedPrograms = [pgConfigProgram
                          ,sqlite3Program
                          ,sqlplusProgram],
         preConf=preConf,
         postConf=postConf
       }
  where
  ...