sqlite 0.5 → 0.5.1
raw patch · 3 files changed
+18/−4 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Database.SQL.Types: instance [incoherent] (PrettySQL a) => PrettySQL (SQLCreate a)
- Database.SQLite: instance [incoherent] (IsValue a) => IsValue (Maybe a)
- Database.SQLite: instance [incoherent] (IsValue r) => IsFunctionHandler (IO r)
- Database.SQLite: instance [incoherent] (IsValue r) => IsFunctionHandler (String -> IO r)
- Database.SQLite: instance [incoherent] (IsValue r) => IsFunctionHandler (String -> r)
- Database.SQLite: instance [incoherent] (IsValue r) => IsFunctionHandler r
+ Database.SQL.Types: instance [incoherent] PrettySQL a => PrettySQL (SQLCreate a)
+ Database.SQLite: instance [incoherent] IsValue a => IsValue (Maybe a)
+ Database.SQLite: instance [incoherent] IsValue r => IsFunctionHandler (IO r)
+ Database.SQLite: instance [incoherent] IsValue r => IsFunctionHandler (String -> IO r)
+ Database.SQLite: instance [incoherent] IsValue r => IsFunctionHandler (String -> r)
+ Database.SQLite: instance [incoherent] IsValue r => IsFunctionHandler r
+ Database.SQLite: openReadonlyConnection :: String -> IO SQLiteHandle
+ Database.SQLite.Base: sqlite3_open_v2 :: CString -> Ptr SQLite -> OpenFlags -> CString -> IO Status
- Database.SQL.Types: export_sql :: (PrettySQL t) => t -> String
+ Database.SQL.Types: export_sql :: PrettySQL t => t -> String
- Database.SQL.Types: pp_sql :: (PrettySQL t) => t -> Doc
+ Database.SQL.Types: pp_sql :: PrettySQL t => t -> Doc
- Database.SQLite: createFunction :: (IsFunctionHandler a) => SQLiteHandle -> FunctionName -> a -> IO ()
+ Database.SQLite: createFunction :: IsFunctionHandler a => SQLiteHandle -> FunctionName -> a -> IO ()
- Database.SQLite: execParamStatement :: (SQLiteResult a) => SQLiteHandle -> String -> [(String, Value)] -> IO (Either String [[Row a]])
+ Database.SQLite: execParamStatement :: SQLiteResult a => SQLiteHandle -> String -> [(String, Value)] -> IO (Either String [[Row a]])
- Database.SQLite: execStatement :: (SQLiteResult a) => SQLiteHandle -> String -> IO (Either String [[Row a]])
+ Database.SQLite: execStatement :: SQLiteResult a => SQLiteHandle -> String -> IO (Either String [[Row a]])
- Database.SQLite: fromSQLiteValue :: (IsValue a) => SQLiteValue -> IO a
+ Database.SQLite: fromSQLiteValue :: IsValue a => SQLiteValue -> IO a
- Database.SQLite: funcArity :: (IsFunctionHandler a) => a -> Arity
+ Database.SQLite: funcArity :: IsFunctionHandler a => a -> Arity
- Database.SQLite: funcHandler :: (IsFunctionHandler a) => a -> FunctionHandler
+ Database.SQLite: funcHandler :: IsFunctionHandler a => a -> FunctionHandler
- Database.SQLite: returnSQLiteValue :: (IsValue a) => SQLiteContext -> a -> IO ()
+ Database.SQLite: returnSQLiteValue :: IsValue a => SQLiteContext -> a -> IO ()
Files
- Database/SQLite.hs +16/−0
- Database/SQLite/Base.hs +1/−3
- sqlite.cabal +1/−1
Database/SQLite.hs view
@@ -26,6 +26,7 @@ -- * Opening and closing a database , openConnection+ , openReadonlyConnection , closeConnection -- * Executing SQL queries on the database@@ -100,6 +101,21 @@ newSQLiteHandle db _ -> fail ("openDatabase: failed to open " ++ show st) +-- | Open a new database connection read-only, whose name is given+-- by the 'dbName' argument. A sqlite3 handle is returned.+--+-- An exception is thrown if the database does not exist, +-- or could not be opened.+--+openReadonlyConnection :: String -> IO SQLiteHandle+openReadonlyConnection dbName =+ alloca $ \ptr -> do+ st <- withCString dbName $ \ c_dbName ->+ sqlite3_open_v2 c_dbName ptr sQLITE_OPEN_READONLY nullPtr+ case st of+ 0 -> do db <- peek ptr+ newSQLiteHandle db+ _ -> fail ("openDatabase: failed to open " ++ show st) -- | Close a database connection. -- Destroys the SQLite value associated with a database, closes
Database/SQLite/Base.hs view
@@ -45,7 +45,7 @@ , sqlite3_progress_handler , sqlite3_open , sqlite3_open16--- , sqlite3_open_v2+ , sqlite3_open_v2 , sqlite3_errcode , sqlite3_errmsg @@ -350,10 +350,8 @@ foreign import ccall "sqlite3.h sqlite3_open16" sqlite3_open16 :: SQLiteUTF16 -> Ptr SQLite -> IO Status -{- foreign import ccall "sqlite3.h sqlite3_open_v2" sqlite3_open_v2 :: CString -> Ptr SQLite -> OpenFlags -> CString -> IO Status--} foreign import ccall "sqlite3.h sqlite3_errcode" sqlite3_errcode :: SQLite -> IO Status
sqlite.cabal view
@@ -1,5 +1,5 @@ Name: sqlite-Version: 0.5+Version: 0.5.1 Synopsis: Haskell binding to sqlite3 Description: Haskell binding to sqlite3 <http://sqlite.org/>.