module BaseXClient (
  module BaseXClient,
  module BaseXClient.Query,
  module BaseXClient.Session
) where

import BaseXClient.Query hiding (info, execute, close, sendCode, exec)
import qualified BaseXClient.Query as Query
import BaseXClient.Session hiding (sendInput)
import Control.Exception
import Network
import System.IO

executeQuery = Query.execute
closeQuery   = Query.close
queryInfo    = Query.info

withSession :: String -> PortNumber -> String -> String -> (Handle -> IO a) -> IO a
withSession host port user pass = bracket (connect host port user pass) close

withQuery :: Handle -> String -> (Query -> IO a) -> IO a
withQuery session q = bracket (query q session) closeQuery