hsql-1.7.1: Simple library for database access from Haskell.Source codeContentsIndex
Database.HSQL.Types
Synopsis
type FieldDef = (String, SqlType, Bool)
data SqlType
= SqlChar Int
| SqlVarChar Int
| SqlLongVarChar Int
| SqlText
| SqlWChar Int
| SqlWVarChar Int
| SqlWLongVarChar Int
| SqlDecimal Int Int
| SqlNumeric Int Int
| SqlSmallInt
| SqlMedInt
| SqlInteger
| SqlReal
| SqlFloat
| SqlDouble
| SqlBit
| SqlTinyInt
| SqlBigInt
| SqlBinary Int
| SqlVarBinary Int
| SqlLongVarBinary Int
| SqlDate
| SqlTime
| SqlTimeTZ
| SqlAbsTime
| SqlRelTime
| SqlTimeInterval
| SqlAbsTimeInterval
| SqlTimeStamp
| SqlDateTime
| SqlDateTimeTZ
| SqlYear
| SqlSET
| SqlENUM
| SqlBLOB
| SqlMoney
| SqlINetAddr
| SqlCIDRAddr
| SqlMacAddr
| SqlPoint
| SqlLSeg
| SqlPath
| SqlBox
| SqlPolygon
| SqlLine
| SqlCircle
| SqlUnknown Int
data SqlError
= SqlError {
seState :: String
seNativeError :: Int
seErrorMsg :: String
}
| SqlNoData
| SqlInvalidHandle
| SqlStillExecuting
| SqlNeedData
| SqlBadTypeCast {
seFieldName :: String
seFieldType :: SqlType
}
| SqlFetchNull {
seFieldName :: String
}
| SqlUnknownField {
seFieldName :: String
}
| SqlUnsupportedOperation
| SqlClosedHandle
sqlErrorTc :: TyCon
data Connection = Connection {
connDisconnect :: IO ()
connExecute :: String -> IO ()
connQuery :: String -> IO Statement
connTables :: IO [String]
connDescribe :: String -> IO [FieldDef]
connBeginTransaction :: IO ()
connCommitTransaction :: IO ()
connRollbackTransaction :: IO ()
connClosed :: MVar Bool
}
data Statement = Statement {
stmtConn :: Connection
stmtClose :: IO ()
stmtFetch :: IO Bool
stmtGetCol :: forall a. Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a
stmtFields :: [FieldDef]
stmtClosed :: MVar Bool
}
class SqlBind a where
fromSqlCStringLen :: FieldDef -> CString -> Int -> IO a
fromSqlValue :: SqlType -> String -> Maybe a
toSqlValue :: a -> String
Documentation
type FieldDef = (String, SqlType, Bool)Source
data SqlType Source
Constructors
SqlChar Int
SqlVarChar Int
SqlLongVarChar Int
SqlText
SqlWChar Int
SqlWVarChar Int
SqlWLongVarChar Int
SqlDecimal Int Int
SqlNumeric Int Int
SqlSmallInt
SqlMedInt
SqlInteger
SqlReal
SqlFloat
SqlDouble
SqlBit
SqlTinyInt
SqlBigInt
SqlBinary Int
SqlVarBinary Int
SqlLongVarBinary Int
SqlDate
SqlTime
SqlTimeTZ
SqlAbsTime
SqlRelTime
SqlTimeInterval
SqlAbsTimeInterval
SqlTimeStamp
SqlDateTime
SqlDateTimeTZ
SqlYear
SqlSET
SqlENUM
SqlBLOB
SqlMoney
SqlINetAddr
SqlCIDRAddr
SqlMacAddr
SqlPoint
SqlLSeg
SqlPath
SqlBox
SqlPolygon
SqlLine
SqlCircle
SqlUnknown IntHSQL returns SqlUnknown tp for all columns for which it cannot determine the right type. The tp here is the internal type code returned from the backend library
show/hide Instances
data SqlError Source
Constructors
SqlError
seState :: String
seNativeError :: Int
seErrorMsg :: String
SqlNoData
SqlInvalidHandle
SqlStillExecuting
SqlNeedData
SqlBadTypeCast
seFieldName :: String
seFieldType :: SqlType
SqlFetchNull
seFieldName :: String
SqlUnknownField
seFieldName :: String
SqlUnsupportedOperation
SqlClosedHandle
show/hide Instances
sqlErrorTc :: TyConSource
data Connection Source
A Connection type represents a connection to a database, through which you can operate on the it. In order to create the connection you need to use the connect function from the module for your prefered backend.
Constructors
Connection
connDisconnect :: IO ()
connExecute :: String -> IO ()
connQuery :: String -> IO Statement
connTables :: IO [String]
connDescribe :: String -> IO [FieldDef]
connBeginTransaction :: IO ()
connCommitTransaction :: IO ()
connRollbackTransaction :: IO ()
connClosed :: MVar Bool
data Statement Source
The Statement type represents a result from the execution of given SQL query.
Constructors
Statement
stmtConn :: Connection
stmtClose :: IO ()
stmtFetch :: IO Bool
stmtGetCol :: forall a. Int -> FieldDef -> (FieldDef -> CString -> Int -> IO a) -> IO a
stmtFields :: [FieldDef]
stmtClosed :: MVar Bool
class SqlBind a whereSource
Methods
fromSqlCStringLen :: FieldDef -> CString -> Int -> IO aSource
fromSqlValue :: SqlType -> String -> Maybe aSource
toSqlValue :: a -> StringSource
show/hide Instances
Produced by Haddock version 2.4.2