summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind/SG
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2016-04-29 14:06:24 +0000
committerkrasimir <krasimir@chalmers.se>2016-04-29 14:06:24 +0000
commit3f0fe438cd37bd9f9ece835b6f3bc90ed5566110 (patch)
tree0a8cbe2fbfe5d5391a8c6359c8b0d7aadc3b3b57 /src/runtime/haskell-bind/SG
parenta6b421226420e740b1b3d45817b9fc12cab13344 (diff)
a prototype for complex queries over expressions in libsg
Diffstat (limited to 'src/runtime/haskell-bind/SG')
-rw-r--r--src/runtime/haskell-bind/SG/FFI.hs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/SG/FFI.hs b/src/runtime/haskell-bind/SG/FFI.hs
index 69e3efe3f..a6dce9494 100644
--- a/src/runtime/haskell-bind/SG/FFI.hs
+++ b/src/runtime/haskell-bind/SG/FFI.hs
@@ -8,7 +8,10 @@ import GHC.Ptr
import Data.Int
data SgSG
+data SgQueryExprResult
data SgTripleResult
+data SgQuery
+data SgQueryResult
type SgId = Int64
foreign import ccall "sg/sg.h sg_open"
@@ -27,11 +30,20 @@ foreign import ccall "sg/sg.h sg_rollback"
sg_rollback :: Ptr SgSG -> Ptr GuExn -> IO ()
foreign import ccall "sg/sg.h sg_insert_expr"
- sg_insert_expr :: Ptr SgSG -> PgfExpr -> Ptr GuExn -> IO SgId
+ sg_insert_expr :: Ptr SgSG -> PgfExpr -> CInt -> Ptr GuExn -> IO SgId
foreign import ccall "sg/sg.h sg_get_expr"
sg_get_expr :: Ptr SgSG -> SgId -> Ptr GuPool -> Ptr GuExn -> IO PgfExpr
+foreign import ccall "sg/sg.h sg_query_expr"
+ sg_query_expr :: Ptr SgSG -> PgfExpr -> Ptr GuPool -> Ptr GuExn -> IO (Ptr SgQueryExprResult)
+
+foreign import ccall "sg/sg.h sg_query_next"
+ sg_query_next :: Ptr SgSG -> Ptr SgQueryExprResult -> Ptr SgId -> Ptr GuPool -> Ptr GuExn -> IO PgfExpr
+
+foreign import ccall "sg/sg.h sg_query_close"
+ sg_query_close :: Ptr SgSG -> Ptr SgQueryExprResult -> Ptr GuExn -> IO ()
+
foreign import ccall "sg/sg.h sg_update_fts_index"
sg_update_fts_index :: Ptr SgSG -> Ptr PgfPGF -> Ptr GuExn -> IO ()
@@ -53,6 +65,13 @@ foreign import ccall "sg/sg.h sg_triple_result_fetch"
foreign import ccall "sg/sg.h sg_triple_result_close"
sg_triple_result_close :: Ptr SgTripleResult -> Ptr GuExn -> IO ()
+foreign import ccall "sg/sg.h sg_prepare_query"
+ sg_prepare_query :: Ptr SgSG -> CInt -> Ptr PgfExpr -> Ptr GuPool -> Ptr GuExn -> IO (Ptr SgQuery)
+
+foreign import ccall "sg/sg.h sg_query"
+ sg_query :: Ptr SgSG -> Ptr SgQuery -> Ptr GuExn -> IO (Ptr SgQueryResult)
+
+
type SgTriple = Ptr PgfExpr