hsql-sqlite3 1.7 → 1.7.1
raw patch · 5 files changed
+104/−49 lines, 5 filesdep ~basedep ~hsqlsetup-changednew-uploader
Dependency ranges changed: base, hsql
Files
- ChangeLog +2/−0
- Database/HSQL/SQLite3.hsc +9/−9
- LICENSE +29/−0
- Setup.lhs +49/−31
- hsql-sqlite3.cabal +15/−9
+ ChangeLog view
@@ -0,0 +1,2 @@+2009-9-6+ 1.7.1: Fix to make it run on GHC 6.10.
Database/HSQL/SQLite3.hsc view
@@ -1,4 +1,4 @@------------------------------------------------------------------------------------------+------------------------------------------------------------------------------ {-| Module : Database.HSQL.SQLite3 Copyright : (c) Krasimir Angelov 2005 License : BSD-style@@ -9,9 +9,9 @@ The module provides interface to SQLite3 -}--------------------------------------------------------------------------------------------module Database.HSQL.SQLite3(connect, module Database.HSQL) where+------------------------------------------------------------------------------+module Database.HSQL.SQLite3(connect+ ,module Database.HSQL) where import Database.HSQL import Database.HSQL.Types@@ -19,7 +19,7 @@ import Foreign.C import System.IO import Control.Monad(when)-import Control.Exception(throwDyn)+import Control.OldException(throwDyn) import Control.Concurrent.MVar #include <fcntl.h>@@ -37,9 +37,9 @@ foreign import ccall "strlen" strlen :: CString -> IO CInt ------------------------------------------------------------------------------------------+------------------------------------------------------------------------------ -- routines for handling exceptions------------------------------------------------------------------------------------------+------------------------------------------------------------------------------ handleSqlResult :: CInt -> Ptr CString -> IO () handleSqlResult res ppMsg@@ -50,9 +50,9 @@ sqlite3_free pMsg throwDyn (SqlError "E" (fromIntegral res) msg) ------------------------------------------------------------------------------------------+------------------------------------------------------------------------------ -- Connect------------------------------------------------------------------------------------------+------------------------------------------------------------------------------ connect :: FilePath -> IOMode -> IO Connection connect fpath mode =
+ LICENSE view
@@ -0,0 +1,29 @@+Copyright (c) 2009, Krasimir Angelov <kr.angelov@gmail.com>+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++* Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++* Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++* Neither the name of the author nor the names of its contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.lhs view
@@ -1,41 +1,47 @@ #!/usr/bin/runghc \begin{code}-import Distribution.PackageDescription-import Distribution.Setup-import Distribution.Simple-import Distribution.Simple.LocalBuildInfo-import Distribution.Simple.Utils(rawSystemVerbose)-import System.Info-import System.Exit-import System.Directory-import System.Process(runInteractiveProcess, waitForProcess)-import System.IO(hClose, hGetContents, hPutStr, stderr) import Control.Monad(when)-import Control.Exception(try)+import Control.OldException(try)+import System.Directory(removeFile,findExecutable)+import System.Exit(ExitCode(ExitSuccess) ,exitWith)+import System.IO(hClose, hGetContents, hPutStr, stderr)+import System.Process(runInteractiveProcess, waitForProcess)+import Distribution.PackageDescription+ (PackageDescription ,HookedBuildInfo ,emptyHookedBuildInfo+ ,BuildInfo(extraLibs ,extraLibDirs ,ldOptions ,includeDirs ,ccOptions) + ,emptyBuildInfo)+import Distribution.PackageDescription.Parse(writeHookedBuildInfo)+import Distribution.Simple(UserHooks(preConf,postConf) ,simpleUserHooks + ,defaultMainWithHooks)+import Distribution.Simple.LocalBuildInfo(LocalBuildInfo)+import Distribution.Simple.Setup(ConfigFlags(configVerbosity),Flag)+import Distribution.Verbosity(Verbosity) -main = defaultMainWithHooks defaultUserHooks{preConf=preConf, postConf=postConf}+main:: IO ()+main = defaultMainWithHooks simpleUserHooks{ preConf=preConf+ , postConf=postConf} where- preConf :: [String] -> ConfigFlags -> IO HookedBuildInfo+ preConf:: [String] -> ConfigFlags -> IO HookedBuildInfo preConf args flags = do try (removeFile "SQLite3.buildinfo") return emptyHookedBuildInfo- postConf :: [String] -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ExitCode+ postConf:: [String] -> ConfigFlags -> PackageDescription -> LocalBuildInfo + -> IO () postConf args flags _ localbuildinfo = do- mb_bi <- pkgConfigBuildInfo (configVerbose flags) "sqlite3"+ mb_bi <- pkgConfigBuildInfo (configVerbosity flags) "sqlite3" let bi = case mb_bi of Just bi -> bi- Nothing -> emptyBuildInfo{extraLibs=["sqlite3"]}+ Nothing -> emptyBuildInfo{ extraLibs=["sqlite3"] } writeHookedBuildInfo "SQLite3.buildinfo" (Just bi,[])- return ExitSuccess+ \end{code} The following code is derived from Distribution.Simple.Configure \begin{code}-findProgram- :: String -- ^ program name- -> Maybe FilePath -- ^ optional explicit path- -> IO (Maybe FilePath)+findProgram:: String -- ^ program name+ -> Maybe FilePath -- ^ optional explicit path+ -> IO (Maybe FilePath) findProgram name Nothing = do mb_path <- findExecutable name case mb_path of@@ -46,7 +52,8 @@ message ("Using " ++ name ++ ": " ++ path) return (Just path) -rawSystemGrabOutput :: Int -> FilePath -> [String] -> IO String+-- |+rawSystemGrabOutput:: Int -> FilePath -> [String] -> IO String rawSystemGrabOutput verbose path args = do when (verbose > 0) $ putStrLn (path ++ concatMap (' ':) args)@@ -61,29 +68,40 @@ hClose err hGetContents out -message :: String -> IO ()+-- |+message:: String -> IO () message s = putStrLn $ "configure: " ++ s \end{code} Populate BuildInfo using pkg-config tool. \begin{code}-pkgConfigBuildInfo :: Int -> String -> IO (Maybe BuildInfo)-pkgConfigBuildInfo verbose pkgName = do+pkgConfigBuildInfo:: Flag Verbosity -> String -> IO (Maybe BuildInfo)+pkgConfigBuildInfo verbosity pkgName = do+ let verbose= -1 mb_pkg_config_path <- findProgram "pkg-config" Nothing case mb_pkg_config_path of Just pkg_config_path -> do message ("configuring "++pkgName++" package using pkg-config") - res <- rawSystemGrabOutput verbose pkg_config_path [pkgName, "--libs-only-l"]+ res <- rawSystemGrabOutput verbose pkg_config_path + [pkgName, "--libs-only-l"] let libs = map (tail.tail) (words res)- res <- rawSystemGrabOutput verbose pkg_config_path [pkgName, "--libs-only-L"]+ res <- rawSystemGrabOutput verbose pkg_config_path + [pkgName, "--libs-only-L"] let lib_dirs = map (tail.tail) (words res)- res <- rawSystemGrabOutput verbose pkg_config_path [pkgName, "--libs-only-other"]+ res <- rawSystemGrabOutput verbose pkg_config_path + [pkgName, "--libs-only-other"] let ld_opts = words res- res <- rawSystemGrabOutput verbose pkg_config_path [pkgName, "--cflags-only-I"]+ res <- rawSystemGrabOutput verbose pkg_config_path + [pkgName, "--cflags-only-I"] let inc_dirs = map (tail.tail) (words res)- res <- rawSystemGrabOutput verbose pkg_config_path [pkgName, "--cflags-only-other"]+ res <- rawSystemGrabOutput verbose pkg_config_path + [pkgName, "--cflags-only-other"] let cc_opts = words res- let bi = emptyBuildInfo{extraLibs=libs, extraLibDirs=lib_dirs, ldOptions=ld_opts, includeDirs=inc_dirs, ccOptions=cc_opts}+ let bi = emptyBuildInfo{ extraLibs=libs+ , extraLibDirs=lib_dirs+ , ldOptions=ld_opts+ , includeDirs=inc_dirs+ , ccOptions=cc_opts} return (Just bi) Nothing -> do message ("The package will be built using default settings for "++pkgName)
hsql-sqlite3.cabal view
@@ -1,9 +1,15 @@-name: hsql-sqlite3-version: 1.7-license: BSD3-author: Krasimir Angelov <kr.angelov@gmail.com>-category: Database-description: SQLite3 driver for HSQL.-exposed-modules: Database.HSQL.SQLite3-build-depends: base, hsql-extensions: ForeignFunctionInterface, CPP+Name: hsql-sqlite3+Version: 1.7.1+Synopsis: SQLite3 driver for HSQL.+License: BSD3+License-File: LICENSE+Author: Krasimir Angelov <kr.angelov@gmail.com>+Maintainer: nick.rudnick@googlemail.com+Category: Database+Description: A Haskell Interface to SQLite 3 via libsqlite3+ in the standard library path.+Exposed-modules: Database.HSQL.SQLite3+build-depends: base >= 4 && < 5, hsql >= 1.7+Extensions: ForeignFunctionInterface, CPP+Build-type: Simple+Extra-libraries: sqlite3