From 3f0fe438cd37bd9f9ece835b6f3bc90ed5566110 Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 29 Apr 2016 14:06:24 +0000 Subject: a prototype for complex queries over expressions in libsg --- src/runtime/haskell-bind/SG/FFI.hs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/runtime/haskell-bind/SG') 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 -- cgit v1.2.3