0 | module Oracle.Context
 1 |
 2 | import Oracle.Error
 3 | import Oracle.FFI.Context
 4 | import Oracle.Internal.Context
 5 | import Oracle.Types.Error
 6 |
 7 | import PrimIO
 8 |
 9 | ||| Initialize the ODPI-C runtime.
10 | |||
11 | export
12 | initialize : IO (Either OracleError OracleContext)
13 | initialize = do
14 |   ptr <- primIO prim__contextCreate
15 |   case prim__nullAnyPtr ptr == 1 of
16 |     True  => do
17 |       lasterr <- getLastError
18 |       pure (Left lasterr)
19 |     False =>
20 |       pure (Right (MkOracleContext ptr))
21 |