Takusen-0.8: Database library with left-fold interface, for PostgreSQL, Oracle, SQLite, ODBC.

Portabilitynon-portable
Stabilityexperimental
Maintaineroleg@pobox.com, alistair@abayley.org

Database.ODBC.OdbcFunctions

Description

Wrappers for ODBC FFI functions, plus buffer marshaling.

Synopsis

Documentation

data HandleObj Source

Constructors

HandleObj 

data EnvObj Source

Constructors

EnvObj 

data ConnObj Source

Constructors

ConnObj 

data StmtObj Source

Constructors

StmtObj 

data Buffer Source

Constructors

Buffer 

catchOdbc :: IO a -> (OdbcException -> IO a) -> IO aSource

fetch :: StmtHandle -> IO BoolSource

Return True if there are more rows, False if end-of-data.

getMaybeFromBuffer :: Storable a => Ptr SqlLen -> Ptr a -> (Ptr a -> SqlLen -> IO b) -> IO (Maybe b)Source

getDataStorable :: Storable a => StmtHandle -> Int -> SqlDataType -> Int -> (a -> b) -> IO (Maybe b)Source

sizeOfMaybe :: forall a. Storable a => Maybe a -> IntSource

newtype OutParam a Source

Constructors

OutParam a 

newtype InOutParam a Source

Constructors

InOutParam a 

class OdbcBindBuffer a whereSource

Methods

bindColBufferSource

Arguments

:: StmtHandle

stmt handle

-> Int

column position (1-indexed)

-> Int

size of result buffer (ignored when it can be inferred from type of a)

-> a

dummy value of the appropriate type (just to ensure we get the right class instance)

-> IO BindBuffer

returns a BindBuffer object

getFromBuffer :: BindBuffer -> IO aSource

getData :: StmtHandle -> Int -> IO aSource

class OdbcBindParam a whereSource

Methods

bindParamBufferSource

Arguments

:: StmtHandle

stmt handle

-> Int

parameter position (1-indexed)

-> a

value to write to buffer

-> IO BindBuffer

returns a BindBuffer object

sqlGetDiagRecSource

Arguments

:: SqlHandleType

enum: which handle type is the next parameter?

-> Handle

generic handle ptr

-> SqlSmallInt

row (or message) number

-> MyCString

OUT: state

-> Ptr SqlInteger

OUT: error number

-> MyCString

OUT: error message

-> SqlSmallInt

IN: message buffer size

-> Ptr SqlSmallInt

OUT: message length

-> IO SqlReturn 

sqlDriverConnectSource

Arguments

:: ConnHandle 
-> WindowHandle

just pass nullPtr

-> MyCString

connection string

-> SqlSmallInt

connection string size

-> MyCString

OUT: buffer for normalised connection string

-> SqlSmallInt

buffer size

-> Ptr SqlSmallInt

OUT: length of returned string

-> SqlUSmallInt

enum: should driver prompt user for missing info?

-> IO SqlReturn 

sqlSetEnvAttrSource

Arguments

:: EnvHandle

Env Handle

-> SqlInteger

Attribute (enumeration)

-> Ptr ()

value (cast to void*)

-> SqlInteger

? - set to 0

-> IO SqlReturn 

sqlSetConnectAttrSource

Arguments

:: ConnHandle

Connection Handle

-> SqlInteger

Attribute (enumeration)

-> Ptr ()

value (cast to void*)

-> SqlInteger

? - set to 0

-> IO SqlReturn 

sqlGetDataSource

Arguments

:: StmtHandle 
-> SqlUSmallInt

column position, 1-indexed

-> SqlDataType

SQL data type: string, int, long, date, etc

-> Ptr Buffer

output buffer

-> SqlLen

output buffer size

-> Ptr SqlLen

output data size, or -1 (SQL_NULL_DATA) for null

-> IO SqlReturn 

sqlBindColSource

Arguments

:: StmtHandle 
-> SqlUSmallInt

column position, 1-indexed

-> SqlDataType

SQL data type: string, int, long, date, etc

-> Ptr Buffer

output buffer

-> SqlLen

output buffer size

-> Ptr SqlLen

output data size, or -1 (SQL_NULL_DATA) for null

-> IO SqlReturn 

sqlBindParameterSource

Arguments

:: StmtHandle 
-> SqlUSmallInt

position, 1-indexed

-> SqlParamDirection

direction: IN, OUT

-> SqlCDataType

C data type: char, int, long, float, etc

-> SqlDataType

SQL data type: string, int, long, date, etc

-> SqlULen

col size (precision)

-> SqlSmallInt

decimal digits (scale)

-> Ptr Buffer

input+output buffer

-> SqlLen

buffer size

-> Ptr SqlLen

input+output data size, or -1 (SQL_NULL_DATA) for null

-> IO SqlReturn