HDBC-sqlite3 2.3.3.0 → 2.3.3.1
raw patch · 5 files changed
+100/−17 lines, 5 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- Database/HDBC/Sqlite3/Connection.hs +17/−13
- Database/HDBC/Sqlite3/Statement.hsc +6/−1
- HDBC-sqlite3.cabal +4/−3
- README.txt +67/−0
+ CHANGELOG.md view
@@ -0,0 +1,6 @@++# Changelog++#### 2.3.3.1++* Compatibility with GHC 7.10.
Database/HDBC/Sqlite3/Connection.hs view
@@ -1,9 +1,10 @@+{-# LANGUAGE FlexibleContexts #-} {-# CFILES hdbc-sqlite3-helper.c #-} -- above line for hugs -module Database.HDBC.Sqlite3.Connection - (connectSqlite3, connectSqlite3Raw, Impl.Connection())- where+module Database.HDBC.Sqlite3.Connection+ (connectSqlite3, connectSqlite3Raw, Impl.Connection())+ where import Database.HDBC.Types import Database.HDBC@@ -28,7 +29,7 @@ All database accessor functions are provided in the main HDBC module. -} connectSqlite3 :: FilePath -> IO Impl.Connection-connectSqlite3 = +connectSqlite3 = genericConnect (B.useAsCString . BUTF8.fromString) {- | Connects to a Sqlite v3 database as with 'connectSqlite3', but@@ -39,12 +40,12 @@ connectSqlite3Raw :: FilePath -> IO Impl.Connection connectSqlite3Raw = genericConnect withCString -genericConnect :: (String -> (CString -> IO Impl.Connection) -> IO Impl.Connection) +genericConnect :: (String -> (CString -> IO Impl.Connection) -> IO Impl.Connection) -> FilePath -> IO Impl.Connection genericConnect strAsCStrFunc fp = strAsCStrFunc fp- (\cs -> alloca + (\cs -> alloca (\(p::Ptr (Ptr CSqlite3)) -> do res <- sqlite3_open cs p o <- peek p@@ -84,8 +85,8 @@ res1 <- fetchAllRows' sth let res = map fromSql $ concat res1 return $ seq (length res) res- -fdescribeTable o mchildren name = do ++fdescribeTable o mchildren name = do sth <- newSth o mchildren True $ "PRAGMA table_info(" ++ name ++ ")" execute sth [] res1 <- fetchAllRows' sth@@ -93,20 +94,23 @@ where describeCol (_:name:typ:notnull:df:pk:_) = (fromSql name, describeType typ notnull df pk)- + describeType name notnull df pk = SqlColDesc (typeId name) Nothing Nothing Nothing (nullable notnull)- + nullable SqlNull = Nothing nullable (SqlString "0") = Just True nullable (SqlString "1") = Just False+ nullable (SqlByteString x)+ | BUTF8.toString x == "0" = Just True+ | BUTF8.toString x == "1" = Just False nullable _ = Nothing- + typeId SqlNull = SqlUnknownT "Any" typeId (SqlString t) = typeId' t typeId (SqlByteString t) = typeId' $ BUTF8.toString t typeId _ = SqlUnknownT "Unknown"- + typeId' t = case map Data.Char.toLower t of ('i':'n':'t':_) -> SqlIntegerT "text" -> SqlVarCharT@@ -144,7 +148,7 @@ begin_transaction o children fdisconnect :: Sqlite3 -> ChildList -> IO ()-fdisconnect o mchildren = withRawSqlite3 o $ \p -> +fdisconnect o mchildren = withRawSqlite3 o $ \p -> do closeAllChildren mchildren r <- sqlite3_close p checkError "disconnect" o r
Database/HDBC/Sqlite3/Statement.hsc view
@@ -122,7 +122,12 @@ else do text <- sqlite3_column_text p icol len <- sqlite3_column_bytes p icol s <- B.packCStringLen (text, fromIntegral len)- return (SqlByteString s)+ case t of+ #{const SQLITE_INTEGER} -> return $ SqlInt64 (read $ BUTF8.toString s)+ #{const SQLITE_FLOAT} -> return $ SqlDouble (read $ BUTF8.toString s)+ #{const SQLITE_BLOB} -> return $ SqlByteString s+ #{const SQLITE_TEXT} -> return $ SqlByteString s+ _ -> return $ SqlByteString s fstep :: Sqlite3 -> Ptr CStmt -> IO Bool fstep dbo p =
HDBC-sqlite3.cabal view
@@ -1,12 +1,12 @@ Name: HDBC-sqlite3-Version: 2.3.3.0+Version: 2.3.3.1 License: BSD3-Maintainer: Nicolas Wu <nick@well-typed.com>+Maintainer: Erik Hesselink <hesselink@gmail.com> Author: John Goerzen Copyright: Copyright (c) 2005-2011 John Goerzen license-file: LICENSE extra-source-files: LICENSE, hdbc-sqlite3-helper.h, Makefile-homepage: http://software.complete.org/hdbc-sqlite3+homepage: https://github.com/hdbc/hdbc-sqlite3 Category: Database synopsis: Sqlite v3 driver for HDBC Description: This is the Sqlite v3 driver for HDBC, the generic@@ -14,6 +14,7 @@ Stability: Stable Build-Type: Simple Cabal-Version: >=1.2.3+extra-source-files: LICENSE, Makefile, README.txt, CHANGELOG.md Flag splitBase description: Choose the new smaller, split-up package.
+ README.txt view
@@ -0,0 +1,67 @@+Welcome to HDBC, Haskell Database Connectivity.++This package provides a database backend driver for Sqlite version 3.++Please see HDBC itself for documentation on use. If you don't already+have it, you can browse this documentation at+http://software.complete.org/hdbc++This package provides one function in module Database.HDBC.Sqlite3:++{- | Connect to an Sqlite version 3 database. The only parameter needed is+the filename of the database to connect to.++All database accessor functions are provided in the main HDBC module. -}+connectSqlite3 :: FilePath -> IO Connection++DIFFERENCES FROM HDBC STANDARD+------------------------------++SQLite is unable to return the number of modified rows from a table+when you run a "DELETE FROM" command with no WHERE clause.++On the topic of thread safety, SQLite has some limitations, and thus+HDBC programs that use SQLite will share those limitations. Please+see http://www.sqlite.org/faq.html#q8 for more details.++describeTable and describeResult are not supported by this module.++PREREQUISITES+-------------++Before installing this package, you'll need to have HDBC 0.99.0 or+above installed. You can download HDBC from http://quux.org/devel/hdbc.++You'll need either GHC 6.8.x or above, or Hugs 2006xx or above. ++INSTALLATION+------------++The steps to install are:++1) ghc --make -o setup Setup.lhs++2) ./setup configure++3) ./setup build++4) ./setup install (as root)++If you're on Windows, you can omit the leading "./".++USAGE+-----++To use with hugs, you'll want to use hugs -98.++To use with GHC, you'll want to use:++ -package HDBC -package HDBC-sqlite3++Or, with Cabal, use:++ Build-Depends: HDBC>=2.0.0, HDBC-sqlite3++-- John Goerzen+ January 2009+ December 2005