Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix build issue.

  • Loading branch information...
commit f6068b4c2d9f819fbd1720d6f5b12fdb931a6a61 1 parent 23c201e
External Reality authored
Showing with 26 additions and 16 deletions.
  1. +10 −5 snaplet-sedna.cabal
  2. +16 −11 src/Snap/Snaplet/Sedna.hs
View
15 snaplet-sedna.cabal
@@ -1,5 +1,5 @@
Name: snaplet-sedna
-Version: 0.0.1
+Version: 0.0.1.0
License: GPL-3
Cabal-Version: >= 1.10.0
License-File: LICENSE
@@ -7,12 +7,12 @@ Author: Eric C. Jones
Build-Type: Simple
Maintainer: Eric Jones (ericclaudejones at gmail.com)
Stability: alpha
-Synopsis: Sedna C API XML Binding
+Synopsis: Snaplet for Sedna Bindings. Essentailly a rip of snaplet-hdbc.
-Description: Sedna native XML database bindings.
+Description: Snaplet for Sedna native XML database bindings.
http://www.sedna.org/
-Category: Database, FFI
+Category: Database
Library
Hs-Source-Dirs: src
@@ -22,8 +22,13 @@ Library
bytestring >= 0.9.1 && < 0.10,
containers >= 0.3 && < 0.5,
mtl > 2.0 && < 2.1,
+ monad-control,
+ resource-pool,
+ sednaDBXML == 0.1.2.4,
+ snap
- Exposed-Modules:
+ Exposed-Modules: Snap.Snaplet.Sedna,
+ Snap.Snaplet.Sedna.Types
Ghc-Options: -Wall
View
27 src/Snap/Snaplet/Sedna.hs
@@ -9,8 +9,9 @@ module Snap.Snaplet.Sedna where
-------------------------------------------------------------------------------
import Control.Monad.IO.Control
import Control.Monad.State
-import Database.SednaDB.SednaTypes
-import qualified Database.SednaDB.SednaBindings as Sedna
+import Database.SednaTypes
+import Database.SednaBindings
+import Database.Sedna as Sedna
import Snap.Snaplet
import Snap.Snaplet.Sedna.Types
@@ -52,29 +53,33 @@ withSedna' f = do
-------------------------------------------------------------------------------
query :: HasSedna m s => Query -> m QueryResult
-query xQuery = do
- withSedna (`Sedna.sednaExecute` xQuery)
- withSedna Sedna.sednaGetResultString
+query xQuery = do
+ withSedna $ (\conn -> withTransaction conn (\conn' -> do
+ sednaExecute conn' xQuery
+ sednaGetResultString conn'))
-------------------------------------------------------------------------------
disconnect :: HasSedna m s => m ()
-disconnect = withSedna Sedna.sednaCloseConnection
+disconnect = withSedna sednaCloseConnection
-------------------------------------------------------------------------------
commit :: HasSedna m s => m ()
-commit = withSedna Sedna.sednaCommit
+commit = withSedna sednaCommit
-------------------------------------------------------------------------------
rollback :: HasSedna m s => m ()
-rollback = withSedna Sedna.sednaRollBack
+rollback = withSedna sednaRollBack
--------------------------------------------------------------------------------
---loadXMLFile :: HasSedna m s => Document -> Collection -> m ()
---loadXMLFile filepath doc coll = withSedna (`Sedna.sednaLoadFile` filepath doc coll)
+loadXMLFile :: HasSedna m s => FilePath -> Document -> Collection -> m ()
+loadXMLFile filepath doc coll = withSedna
+ (\conn' -> Sedna.loadXMLFile conn'
+ filepath
+ doc
+ coll)
---------------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.