Copyright | (c) Daniel YU |
---|---|
License | BSD3 |
Maintainer | leptonyu@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
FFI raw bindings to ODPI-C
- createContext :: IO PtrContext
- destroyContext :: PtrContext -> IO Bool
- withContext :: (PtrContext -> IO a) -> IO a
- getClientVersion :: PtrContext -> IO Data_VersionInfo
- getContextError :: PtrContext -> IO Data_ErrorInfo
- createConnection :: PtrContext -> ByteString -> ByteString -> ByteString -> (Data_CommonCreateParams -> Data_CommonCreateParams) -> IO PtrConn
- closeConnection :: ConnCloseMode -> PtrConn -> IO Bool
- pingConnection :: PtrConn -> IO Bool
- withConnection :: PtrContext -> ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> (PtrConn -> IO a) -> IO a
- beginTransaction :: PtrConn -> Int64 -> ByteString -> ByteString -> IO Bool
- prepareTransaction :: PtrConn -> IO Bool
- commitConnection :: PtrConn -> IO Bool
- releaseConnection :: PtrConn -> IO Bool
- rollbackConnection :: PtrConn -> IO Bool
- getCurrentSchema :: PtrConn -> IO ByteString
- getEdition :: PtrConn -> IO ByteString
- getExternalName :: PtrConn -> IO ByteString
- getInternalName :: PtrConn -> IO ByteString
- getLTXID :: PtrConn -> IO ByteString
- getServerVersion :: PtrConn -> IO (ByteString, Data_VersionInfo)
- getObjectType :: PtrConn -> ByteString -> IO PtrObjectType
- getEncodingInfo :: PtrConn -> IO Data_EncodingInfo
- getStmtCacheSize :: PtrConn -> IO Int
- createStatement :: PtrConn -> Bool -> ByteString -> IO PtrStmt
- closeStatement :: PtrStmt -> IO Bool
- releaseStatement :: PtrStmt -> IO Bool
- scrollStatement :: PtrStmt -> FetchMode -> Int -> IO Bool
- bindByName :: PtrStmt -> ByteString -> PtrVar -> IO Bool
- bindByPosition :: PtrStmt -> Int -> PtrVar -> IO Bool
- bindValueByName :: PtrStmt -> ByteString -> NativeTypeNum -> PtrData -> IO Bool
- bindValueByPosition :: PtrStmt -> Int -> NativeTypeNum -> PtrData -> IO Bool
- defineVarByPosition :: PtrStmt -> Int -> PtrVar -> IO Bool
- defineValue :: PtrStmt -> Int -> OracleTypeNum -> NativeTypeNum -> Int -> Bool -> PtrObjectType -> IO Bool
- getBindCount :: PtrStmt -> IO Int
- getBindNames :: PtrStmt -> IO [ByteString]
- getFetchArraySize :: PtrStmt -> IO Int
- setFetchArraySize :: PtrStmt -> Int -> IO Bool
- getImplicitResult :: PtrStmt -> IO (Maybe PtrStmt)
- getInfo :: PtrStmt -> IO Data_StmtInfo
- getNumberQueryColumns :: PtrStmt -> IO Int
- getQueryInfo :: PtrStmt -> Int -> IO Data_QueryInfo
- getQueryValue :: PtrStmt -> Int -> IO DataValue
- executeStatement :: PtrStmt -> ExecMode -> IO Int
- executeMany :: PtrStmt -> ExecMode -> Int -> IO Bool
- fetch :: PtrStmt -> IO (Maybe Int)
- type PageOffset = Int64
- type PageLimit = Int64
- type Page = (PageOffset, PageLimit)
- type FetchRows a = Page -> IO a
- fetchRows :: PtrStmt -> Int -> FetchRows a -> IO (Bool, a)
- getRowCount :: PtrStmt -> IO Word64
- getRowCounts :: PtrStmt -> IO [Word64]
- getSubscrQueryId :: PtrStmt -> IO Word64
- getBatchErrorCount :: PtrStmt -> IO Int
- getBatchErrors :: PtrStmt -> IO [Data_ErrorInfo]
- newTempLob :: PtrConn -> OracleTypeNum -> IO PtrLob
- closeLob :: PtrLob -> IO Bool
- closeLobResource :: PtrLob -> IO Bool
- copyLob :: PtrLob -> IO PtrLob
- flushLob :: PtrLob -> IO Bool
- getLobBufferSize :: PtrLob -> Word64 -> IO Word64
- getLobChunkSize :: PtrLob -> IO Int64
- getLobDirectoryAndFileName :: PtrLob -> IO (FilePath, String)
- setLobDirectoryAndFileName :: PtrLob -> (FilePath, String) -> IO Bool
- lobFileExists :: PtrLob -> IO Bool
- isLobResourceOpen :: PtrLob -> IO Bool
- getLobSize :: PtrLob -> IO Int64
- openLobResource :: PtrLob -> IO Bool
- releaseLob :: PtrLob -> IO Bool
- trimLob :: PtrLob -> Int64 -> IO Bool
- setLobFromBytes :: PtrLob -> ByteString -> IO Bool
- type BufferSize = Int64
- readLobBytes :: PtrLob -> Page -> BufferSize -> IO ByteString
- writeLobBytes :: PtrLob -> PageOffset -> ByteString -> IO Bool
- objectAppendElement :: PtrObject -> NativeTypeNum -> PtrData -> IO Bool
- copyObject :: PtrObject -> IO PtrObject
- releaseObject :: PtrObject -> IO Bool
- trimObject :: PtrObject -> Int -> IO Bool
- objectDeleteElementByIndex :: PtrObject -> Int -> IO Bool
- objectSetAttributeValue :: PtrObject -> PtrObjectAttr -> DataValue -> IO Bool
- objectGetAttributeValue :: PtrObject -> PtrObjectAttr -> NativeTypeNum -> IO DataValue
- objectGetElementExistsByIndex :: PtrObject -> Int -> IO Bool
- objectSetElementValueByIndex :: PtrObject -> Int -> DataValue -> IO Bool
- objectGetElementValueByIndex :: PtrObject -> Int -> NativeTypeNum -> IO DataValue
- objectGetFirstIndex :: PtrObject -> IO (Maybe Int)
- objectGetLastIndex :: PtrObject -> IO (Maybe Int)
- objectGetNextIndex :: Int -> PtrObject -> IO (Maybe Int)
- objectGetPrevIndex :: Int -> PtrObject -> IO (Maybe Int)
- getObjectSize :: PtrObject -> IO Int
- getObjectAttrInfo :: PtrObjectAttr -> IO Data_ObjectAttrInfo
- objectAttrAddRef :: PtrObjectAttr -> IO Bool
- releaseObjectAttr :: PtrObjectAttr -> IO Bool
- objectTypeAddRef :: PtrObjectType -> IO Bool
- createObjectByType :: PtrObjectType -> IO PtrObject
- objectTypeGetAttributes :: PtrObjectType -> Int -> IO PtrObjectAttr
- objectTypeGetInfo :: PtrObjectType -> IO Data_ObjectTypeInfo
- releaseObjectType :: PtrObjectType -> IO Bool
- rowidAddRef :: PtrRowid -> IO Bool
- releaseRowid :: PtrRowid -> IO Bool
- rowidGetStringValue :: PtrRowid -> IO ByteString
- newVar :: PtrConn -> OracleTypeNum -> NativeTypeNum -> Int -> Int -> Bool -> Bool -> PtrObjectType -> IO (PtrVar, [PtrData])
- varAddRef :: PtrVar -> IO Bool
- copyVar :: PtrVar -> Int -> PtrVar -> Int -> IO Bool
- varGetData :: PtrVar -> IO [Data]
- varGetNumberOfElements :: PtrVar -> IO Int
- varGetSizeInBytes :: PtrVar -> IO Int
- releaseVar :: PtrVar -> IO Bool
- setVarFromBytes :: PtrVar -> Int -> ByteString -> IO Bool
- setVarFromLob :: PtrVar -> Int -> PtrLob -> IO Bool
- setVarFromObject :: PtrVar -> Int -> PtrObject -> IO Bool
- setVarFromRowid :: PtrVar -> Int -> PtrRowid -> IO Bool
- setVarFromStatement :: PtrVar -> Int -> PtrStmt -> IO Bool
- setVarNumberOfElements :: PtrVar -> Int -> IO Bool
- data DpiException
- = ErrorInfoException Data_ErrorInfo
- | VersionInfoNotFound
- | ConnectionCreateFailed
- | StatementCreateFailed
- | ConnectionPropNotFound ByteString
- | StatementExecuteFailed
- | StatementFetchFailed
- | StatementFetchRowFailed
- | StatementGetBatchErrorFailed
- | StatementGetBindFailed
- | LobOperateFailed
- | ObjectOperateFailed
- | TransactionPrepareFailed
- data AuthMode
- data ConnCloseMode
- data CreateMode
- data DeqMode
- data DeqNavigation
- data EventType
- data ExecMode
- data FetchMode
- data MessageDeliveryMode
- data MessageState
- data NativeTypeNum
- data OpCode
- data OracleTypeNum
- = OracleTypeNone
- | OracleTypeVarchar
- | OracleTypeNvarchar
- | OracleTypeChar
- | OracleTypeNchar
- | OracleTypeRowid
- | OracleTypeRaw
- | OracleTypeNativeFloat
- | OracleTypeNativeDouble
- | OracleTypeNativeInt
- | OracleTypeNumber
- | OracleTypeDate
- | OracleTypeTimestamp
- | OracleTypeTimestampTz
- | OracleTypeTimestampLtz
- | OracleTypeIntervalDs
- | OracleTypeIntervalYm
- | OracleTypeClob
- | OracleTypeNclob
- | OracleTypeBlob
- | OracleTypeBfile
- | OracleTypeStmt
- | OracleTypeBoolean
- | OracleTypeObject
- | OracleTypeLongVarchar
- | OracleTypeLongRaw
- | OracleTypeNativeUint
- | OracleTypeMax
- data PoolCloseMode
- data PoolGetMode
- data Purity
- data ShutdownMode
- data StartupMode
- data StatementType
- data SubscrNamespace = SubscrNamespaceDbchange
- data SubscrProtocol
- data SubscrQOS
- data Visibility
- type PtrConn = Ptr DPI_Conn
- type PtrPool = Ptr DPI_Pool
- type PtrStmt = Ptr DPI_Stmt
- type PtrVar = Ptr DPI_Var
- type PtrLob = Ptr DPI_Lob
- type PtrObject = Ptr DPI_Object
- type PtrObjectAttr = Ptr DPI_ObjectAttr
- type PtrObjectType = Ptr DPI_ObjectType
- type PtrRowid = Ptr DPI_Rowid
- type PtrSubscr = Ptr DPI_Subscr
- type PtrDeqOptions = Ptr DPI_DeqOptions
- type PtrEnqOptions = Ptr DPI_EnqOptions
- type PtrMsgProps = Ptr DPI_MsgProps
- type PtrContext = Ptr DPI_Context
- data Data_AppContext = Data_AppContext {}
- data Data_CommonCreateParams = Data_CommonCreateParams {}
- data Data_ConnCreateParams = Data_ConnCreateParams {
- authMode :: AuthMode
- connectionClass :: ByteString
- purity :: Purity
- newPassword :: ByteString
- appContext :: PtrAppContext
- numAppContext :: CUInt
- externalAuth :: CInt
- externalHandle :: Ptr ()
- pool :: PtrPool
- tag :: ByteString
- matchAnyTag :: CInt
- outTag :: ByteString
- outTagFound :: CInt
- shardingKeyColumns :: PtrShardingKeyColumn
- numShardingKeyColumns :: CUChar
- superShardingKeyColumns :: PtrShardingKeyColumn
- numSuperShardingKeyColumns :: CUChar
- newtype Data = Data (NativeTypeNum -> IO DataValue)
- data Data_DataTypeInfo = Data_DataTypeInfo {}
- data Data_EncodingInfo = Data_EncodingInfo {}
- data Data_ErrorInfo = Data_ErrorInfo {
- code :: CInt
- offset :: CUShort
- message :: ByteString
- encoding :: ByteString
- fnName :: ByteString
- action :: ByteString
- sqlState :: ByteString
- isRecoverable :: Bool
- data Data_ObjectAttrInfo = Data_ObjectAttrInfo {}
- data Data_ObjectTypeInfo = Data_ObjectTypeInfo {}
- data Data_PoolCreateParams = Data_PoolCreateParams {}
- data Data_QueryInfo = Data_QueryInfo {}
- data Data_ShardingKeyColumn = Data_ShardingKeyColumn {
- oracleTypeNum :: OracleTypeNum
- nativeTypeNum :: NativeTypeNum
- value :: DataValue
- data Data_StmtInfo = Data_StmtInfo {
- isQuery :: Bool
- isPLSQL :: Bool
- isDDL :: Bool
- isDML :: Bool
- statementType :: StatementType
- isReturning :: Bool
- data Data_SubscrCreateParams = Data_SubscrCreateParams {
- subscrNamespace :: SubscrNamespace
- protocol :: SubscrProtocol
- qos :: SubscrQOS
- operations :: CInt
- portNumber :: CUInt
- timeout :: CUInt
- name :: ByteString
- callback :: FunPtr (Ptr () -> PtrSubscrMessage -> IO ())
- callbackContext :: Ptr ()
- recipientName :: ByteString
- data Data_SubscrMessage = Data_SubscrMessage {}
- data Data_SubscrMessageQuery = Data_SubscrMessageQuery {}
- data Data_SubscrMessageRow = Data_SubscrMessageRow {
- operation :: OpCode
- rowid :: ByteString
- data Data_SubscrMessageTable = Data_SubscrMessageTable {
- operation :: OpCode
- name :: ByteString
- rows :: PtrSubscrMessageRow
- numRows :: CUInt
- data Data_VersionInfo = Data_VersionInfo {
- versionNum :: CInt
- releaseNum :: CInt
- updateNum :: CInt
- portReleaseNum :: CInt
- portUpdateNum :: CInt
- fullVersionNum :: CUInt
- type PtrAppContext = Ptr Data_AppContext
- type PtrCommonCreateParams = Ptr Data_CommonCreateParams
- type PtrConnCreateParams = Ptr Data_ConnCreateParams
- type PtrData = Ptr Data
- type PtrDataTypeInfo = Ptr Data_DataTypeInfo
- type PtrEncodingInfo = Ptr Data_EncodingInfo
- type PtrErrorInfo = Ptr Data_ErrorInfo
- type PtrObjectAttrInfo = Ptr Data_ObjectAttrInfo
- type PtrObjectTypeInfo = Ptr Data_ObjectTypeInfo
- type PtrPoolCreateParams = Ptr Data_PoolCreateParams
- type PtrQueryInfo = Ptr Data_QueryInfo
- type PtrShardingKeyColumn = Ptr Data_ShardingKeyColumn
- type PtrStmtInfo = Ptr Data_StmtInfo
- type PtrSubscrCreateParams = Ptr Data_SubscrCreateParams
- type PtrSubscrMessage = Ptr Data_SubscrMessage
- type PtrSubscrMessageQuery = Ptr Data_SubscrMessageQuery
- type PtrSubscrMessageRow = Ptr Data_SubscrMessageRow
- type PtrSubscrMessageTable = Ptr Data_SubscrMessageTable
- type PtrVersionInfo = Ptr Data_VersionInfo
Context Interface
createContext :: IO PtrContext Source #
Create Context
destroyContext :: PtrContext -> IO Bool Source #
Destroy Context
withContext :: (PtrContext -> IO a) -> IO a Source #
With Context, PtrContext
will be destroyed after run
Information from Context
Connection Interface
:: PtrContext | Context |
-> ByteString | Username |
-> ByteString | Password |
-> ByteString | Connection String |
-> (Data_CommonCreateParams -> Data_CommonCreateParams) | custom |
-> IO PtrConn |
Create Connection
closeConnection :: ConnCloseMode -> PtrConn -> IO Bool Source #
close connection, but not release resource, plese use releaseConnection
to release and close connection
:: PtrContext | Context |
-> ByteString | Username |
-> ByteString | Password |
-> ByteString | Connection String |
-> ByteString | NLS_LANG encoding |
-> ByteString | NLS_NCHAR encoding |
-> (PtrConn -> IO a) | action use connection |
-> IO a |
with connection
Transaction Interface
:: PtrConn | Connection |
-> Int64 | formatId |
-> ByteString | transactionId |
-> ByteString | branchId |
-> IO Bool |
Information from Connection
getCurrentSchema :: PtrConn -> IO ByteString Source #
getEdition :: PtrConn -> IO ByteString Source #
getExternalName :: PtrConn -> IO ByteString Source #
getInternalName :: PtrConn -> IO ByteString Source #
getServerVersion :: PtrConn -> IO (ByteString, Data_VersionInfo) Source #
getObjectType :: PtrConn -> ByteString -> IO PtrObjectType Source #
Statement Interface
:: PtrConn | Connection |
-> Bool | scrollable |
-> ByteString | SQL String |
-> IO PtrStmt |
Create Statement
Statement Bind Vars
bindByName :: PtrStmt -> ByteString -> PtrVar -> IO Bool Source #
bindValueByName :: PtrStmt -> ByteString -> NativeTypeNum -> PtrData -> IO Bool Source #
bindValueByPosition :: PtrStmt -> Int -> NativeTypeNum -> PtrData -> IO Bool Source #
defineValue :: PtrStmt -> Int -> OracleTypeNum -> NativeTypeNum -> Int -> Bool -> PtrObjectType -> IO Bool Source #
getBindNames :: PtrStmt -> IO [ByteString] Source #
getQueryInfo :: PtrStmt -> Int -> IO Data_QueryInfo Source #
Execute Statement
type PageOffset = Int64 Source #
type Page = (PageOffset, PageLimit) Source #
getBatchErrors :: PtrStmt -> IO [Data_ErrorInfo] Source #
Lob Interface
newTempLob :: PtrConn -> OracleTypeNum -> IO PtrLob Source #
setLobFromBytes :: PtrLob -> ByteString -> IO Bool Source #
type BufferSize = Int64 Source #
readLobBytes :: PtrLob -> Page -> BufferSize -> IO ByteString Source #
writeLobBytes :: PtrLob -> PageOffset -> ByteString -> IO Bool Source #
Object Interface
objectAppendElement :: PtrObject -> NativeTypeNum -> PtrData -> IO Bool Source #
objectSetAttributeValue :: PtrObject -> PtrObjectAttr -> DataValue -> IO Bool Source #
objectGetAttributeValue :: PtrObject -> PtrObjectAttr -> NativeTypeNum -> IO DataValue Source #
objectGetElementValueByIndex :: PtrObject -> Int -> NativeTypeNum -> IO DataValue Source #
objectAttrAddRef :: PtrObjectAttr -> IO Bool Source #
releaseObjectAttr :: PtrObjectAttr -> IO Bool Source #
objectTypeAddRef :: PtrObjectType -> IO Bool Source #
releaseObjectType :: PtrObjectType -> IO Bool Source #
Rowid Interface
Var Interface
:: PtrConn | Connection |
-> OracleTypeNum | Oracle type enum |
-> NativeTypeNum | Native type enum |
-> Int | maxArraySize |
-> Int | size |
-> Bool | sizeIsBytes |
-> Bool | isArray |
-> PtrObjectType | Object type |
-> IO (PtrVar, [PtrData]) |
setVarFromBytes :: PtrVar -> Int -> ByteString -> IO Bool Source #
data DpiException Source #
data ConnCloseMode Source #
data CreateMode Source #
data MessageDeliveryMode Source #
data MessageState Source #
data NativeTypeNum Source #
data OracleTypeNum Source #
data PoolCloseMode Source #
data PoolGetMode Source #
data ShutdownMode Source #
data StartupMode Source #
data StatementType Source #
data SubscrNamespace Source #
data SubscrProtocol Source #
data Visibility Source #
type PtrObjectAttr = Ptr DPI_ObjectAttr Source #
type PtrObjectType = Ptr DPI_ObjectType Source #
type PtrDeqOptions = Ptr DPI_DeqOptions Source #
type PtrEnqOptions = Ptr DPI_EnqOptions Source #
type PtrMsgProps = Ptr DPI_MsgProps Source #
type PtrContext = Ptr DPI_Context Source #
data Data_AppContext Source #
data Data_ConnCreateParams Source #
data Data_ErrorInfo Source #
Data_ErrorInfo | |
|
data Data_ObjectAttrInfo Source #
data Data_PoolCreateParams Source #
Data_PoolCreateParams | |
|
data Data_QueryInfo Source #
data Data_ShardingKeyColumn Source #
Data_ShardingKeyColumn | |
|
data Data_StmtInfo Source #
Data_StmtInfo | |
|
data Data_SubscrCreateParams Source #
Data_SubscrCreateParams | |
|
data Data_SubscrMessage Source #
Data_SubscrMessage | |
|
data Data_SubscrMessageRow Source #
data Data_VersionInfo Source #
Data_VersionInfo | |
|
type PtrAppContext = Ptr Data_AppContext Source #
type PtrDataTypeInfo = Ptr Data_DataTypeInfo Source #
type PtrEncodingInfo = Ptr Data_EncodingInfo Source #
type PtrErrorInfo = Ptr Data_ErrorInfo Source #
type PtrQueryInfo = Ptr Data_QueryInfo Source #
type PtrStmtInfo = Ptr Data_StmtInfo Source #
type PtrSubscrMessage = Ptr Data_SubscrMessage Source #
type PtrVersionInfo = Ptr Data_VersionInfo Source #