[Pkg-haskell-commits] r1208 - in /packages/haskelldb-hsql-sqlite3: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/Database/ branches/upstream/current/Database/HaskellDB/ branches/upstream/current/Database/HaskellDB/HSQL/

arjan at users.alioth.debian.org arjan at users.alioth.debian.org
Wed Apr 30 23:15:38 UTC 2008


Author: arjan
Date: Wed Apr 30 23:15:38 2008
New Revision: 1208

URL: http://svn.debian.org/wsvn/pkg-haskell/?sc=1&rev=1208
Log:
[svn-inject] Installing original source of haskelldb-hsql-sqlite3

Added:
    packages/haskelldb-hsql-sqlite3/
    packages/haskelldb-hsql-sqlite3/branches/
    packages/haskelldb-hsql-sqlite3/branches/upstream/
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/SQLite3.hs
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/Setup.hs
    packages/haskelldb-hsql-sqlite3/branches/upstream/current/haskelldb-hsql-sqlite3.cabal

Added: packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/SQLite3.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/SQLite3.hs?rev=1208&op=file
==============================================================================
--- packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/SQLite3.hs (added)
+++ packages/haskelldb-hsql-sqlite3/branches/upstream/current/Database/HaskellDB/HSQL/SQLite3.hs Wed Apr 30 23:15:38 2008
@@ -1,0 +1,60 @@
+-----------------------------------------------------------
+-- |
+-- Module      :  Database.HaskellDB.HSQL.SQLite3
+-- Copyright   :  HWT Group 2003,
+--                Bjorn Bringert 2006
+-- License     :  BSD-style
+-- 
+-- Maintainer  :  haskelldb-users at lists.sourceforge.net
+-- Stability   :  experimental
+-- Portability :  non-portable
+--
+-- Interface to SQLite 3 <http://www.hwaci.com/sw/sqlite/>
+-- databases.
+--
+-----------------------------------------------------------
+module Database.HaskellDB.HSQL.SQLite3 (
+		   SQLiteOptions(..), sqliteConnect,
+		   DriverInterface(..), driver
+		  ) where
+
+import Database.HaskellDB.Database
+import Database.HaskellDB.HSQL
+import Database.HaskellDB.DriverAPI
+import Database.HaskellDB.Sql.SQLite as SQLite
+import qualified Database.HSQL.SQLite3 as SQLite3 (connect) 
+import System.IO
+
+data SQLiteOptions = SQLiteOptions { 
+				    filepath :: FilePath, -- ^ database file
+				    mode :: IOMode        -- ^ access mode
+                  		   }
+
+sqliteConnect :: MonadIO m => SQLiteOptions -> (Database -> m a) -> m a
+sqliteConnect opts = 
+    hsqlConnect SQLite.generator (SQLite3.connect (filepath opts) (mode opts))
+
+sqliteConnectOpts :: MonadIO m => [(String,String)] -> (Database -> m a) -> m a
+sqliteConnectOpts opts f = 
+    do
+    [a,b] <- getOptions ["filepath","mode"] opts
+    m <- readIOMode b
+    sqliteConnect (SQLiteOptions {filepath = a,
+				  mode = m}) f
+
+readIOMode :: Monad m => String -> m IOMode
+readIOMode s = 
+    case s of
+           "r" -> return ReadMode
+           "w" -> return WriteMode
+           "a" -> return AppendMode
+           "rw" -> return ReadWriteMode
+           _ -> case reads s of
+                             [(x,"")] -> return x
+                             _ -> fail $ "Bad IO mode: " ++ s
+
+-- | This driver requires the following options: 
+--   "filepath", "mode"
+-- The possible values of the "mode" option are "r", "w", "rw"
+driver :: DriverInterface
+driver = defaultdriver {connect = sqliteConnectOpts}

Added: packages/haskelldb-hsql-sqlite3/branches/upstream/current/Setup.hs
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskelldb-hsql-sqlite3/branches/upstream/current/Setup.hs?rev=1208&op=file
==============================================================================
--- packages/haskelldb-hsql-sqlite3/branches/upstream/current/Setup.hs (added)
+++ packages/haskelldb-hsql-sqlite3/branches/upstream/current/Setup.hs Wed Apr 30 23:15:38 2008
@@ -1,0 +1,4 @@
+#!/usr/bin/env runghc
+
+import Distribution.Simple
+main = defaultMain

Added: packages/haskelldb-hsql-sqlite3/branches/upstream/current/haskelldb-hsql-sqlite3.cabal
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskelldb-hsql-sqlite3/branches/upstream/current/haskelldb-hsql-sqlite3.cabal?rev=1208&op=file
==============================================================================
--- packages/haskelldb-hsql-sqlite3/branches/upstream/current/haskelldb-hsql-sqlite3.cabal (added)
+++ packages/haskelldb-hsql-sqlite3/branches/upstream/current/haskelldb-hsql-sqlite3.cabal Wed Apr 30 23:15:38 2008
@@ -1,0 +1,15 @@
+Name: haskelldb-hsql-sqlite3
+Version: 0.10
+Copyright: The authors
+Maintainer: haskelldb-users at lists.sourceforge.net
+Author: Daan Leijen, Conny Andersson, Martin Andersson, Mary Bergman, Victor Blomqvist, Bjorn Bringert, Anders Hockersten, Torbjorn Martin, Jeremy Shaw
+License: BSD3
+build-depends: haskell98, base, mtl, haskelldb, haskelldb-hsql, hsql, hsql-sqlite3
+Extensions: ExistentialQuantification,
+            OverlappingInstances,
+            UndecidableInstances,
+            MultiParamTypeClasses
+Synopsis: HaskellDB support for the HSQL SQLite driver.
+Exposed-Modules:
+        Database.HaskellDB.HSQL.SQLite3
+ghc-options: -O2




More information about the Pkg-haskell-commits mailing list