-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple library for database access from Haskell. -- -- Simple library for database access from Haskell. @package hsql @version 1.8.1 module DB.HSQL.Type -- | Differentiation of data types used in DBs. data SqlType SqlInteger :: SqlType SqlBigInt :: SqlType SqlSmallInt :: SqlType SqlTinyInt :: SqlType SqlMedInt :: SqlType SqlDecimal :: Int -> Int -> SqlType SqlNumeric :: Int -> Int -> SqlType SqlReal :: SqlType SqlDouble :: SqlType SqlFloat :: SqlType SqlMoney :: SqlType SqlChar :: Int -> SqlType SqlVarChar :: Int -> SqlType SqlLongVarChar :: Int -> SqlType SqlText :: SqlType SqlWChar :: Int -> SqlType SqlWVarChar :: Int -> SqlType SqlWLongVarChar :: Int -> SqlType SqlDate :: SqlType SqlTime :: SqlType SqlTimeTZ :: SqlType SqlAbsTime :: SqlType SqlRelTime :: SqlType SqlTimeInterval :: SqlType SqlAbsTimeInterval :: SqlType SqlTimeStamp :: SqlType SqlDateTime :: SqlType SqlDateTimeTZ :: SqlType SqlYear :: SqlType SqlBit :: SqlType SqlENUM :: SqlType SqlPoint :: SqlType SqlLSeg :: SqlType SqlPath :: SqlType SqlBox :: SqlType SqlPolygon :: SqlType SqlLine :: SqlType SqlCircle :: SqlType SqlINetAddr :: SqlType SqlCIDRAddr :: SqlType SqlMacAddr :: SqlType SqlBinary :: Int -> SqlType SqlVarBinary :: Int -> SqlType SqlLongVarBinary :: Int -> SqlType SqlSET :: SqlType SqlBLOB :: SqlType -- | HSQL 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 SqlUnknown :: Int -> SqlType instance Eq SqlType instance Show SqlType -- | Differentiation of DB specific error conditions. module DB.HSQL.Error data SqlError SqlError :: String -> Int -> String -> SqlError seState :: SqlError -> String seNativeError :: SqlError -> Int seErrorMsg :: SqlError -> String SqlNoData :: SqlError SqlInvalidHandle :: SqlError SqlStillExecuting :: SqlError SqlNeedData :: SqlError SqlBadTypeCast :: String -> SqlType -> SqlError seFieldName :: SqlError -> String seFieldType :: SqlError -> SqlType SqlFetchNull :: String -> SqlError seFieldName :: SqlError -> String SqlUnknownField :: String -> SqlError seFieldName :: SqlError -> String SqlUnsupportedOperation :: SqlError SqlClosedHandle :: SqlError sqlErrorTc :: TyCon instance Typeable SqlError instance Exception SqlError instance Show SqlError module DB.HSQL.Type.Diverse instance SqlBind a => SqlBind (Maybe a) instance SqlBind Bool instance SqlBind String module DB.HSQL.Type.Geometric data Point Point :: Double -> Double -> Point data Line Line :: Point -> Point -> Line data Path OpenPath :: [Point] -> Path ClosedPath :: [Point] -> Path data Box Box :: Double -> Double -> Double -> Double -> Box data Polygon Polygon :: [Point] -> Polygon data Circle Circle :: Point -> Double -> Circle instance Eq Circle instance Show Circle instance Eq Polygon instance Show Polygon instance Eq Box instance Show Box instance Eq Path instance Show Path instance Eq Line instance Show Line instance Eq Point instance Show Point instance SqlBind Circle instance SqlBind Polygon instance SqlBind Box instance SqlBind Path instance SqlBind Line instance SqlBind Point module DB.HSQL.Type.Time mkClockTime :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> ClockTime mktime :: Ptr () -> IO CTime currTZ :: Int parseTZ :: ReadP Int f_read :: ReadP a -> String -> Maybe a readHMS :: ReadP (Int, Int, Int) readYMD :: ReadP (Int, Int, Int) readDateTime :: ReadP (Int, Int, Int, Int, Int, Int) instance SqlBind ClockTime module DB.HSQL.Type.NetAddress data INetAddr INetAddr :: Int -> Int -> Int -> Int -> Int -> INetAddr data MacAddr MacAddr :: Int -> Int -> Int -> Int -> Int -> Int -> MacAddr instance Eq MacAddr instance Show MacAddr instance Eq INetAddr instance Show INetAddr instance SqlBind MacAddr instance SqlBind INetAddr module DB.HSQL.Type.Numeric c_atoi :: CString -> IO Int c_strtoll :: CString -> Ptr CString -> Int -> IO Int64 instance SqlBind Float instance SqlBind Double instance SqlBind Integer instance SqlBind Int64 instance SqlBind Int module DB.HSQL.Core -- | if closed, nothing to do: closeHandle :: MVar Bool -> IO () -> IO () -- | if closed, exception: checkHandle :: MVar Bool -> IO a -> IO a -- | Casts, if possible, an Exception to an SqlError: sqlExceptions :: Exception x => x -> Maybe SqlError -- | DEPRECATED: catchSql: Use Control.Exception.catch instead. catchSql :: IO a -> (SqlError -> IO a) -> IO a -- | DEPRECATED: handleSql: Use Control.Exception.handle instead. handleSql :: (SqlError -> IO a) -> IO a -> IO a module Database.HSQL -- | 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. data Connection -- | Closes the connection. Performing disconnect on a connection -- that has already been closed has no effect. All other operations on a -- closed connection will fail. disconnect :: Connection -> IO () -- | Submits a command to the database. execute :: Connection -> String -> IO () -- | The Statement type represents a result from the execution of -- given SQL query. data Statement -- | Executes a query and returns a result set query :: Connection -> String -> IO Statement -- | closeStatement stops processing associated with a specific -- statement, closes any open cursors associated with the statement, -- discards pending results, and frees all resources associated with the -- statement. Performing closeStatement on a statement that has -- already been closed has no effect. All other operations on a closed -- statement will fail. closeStatement :: Statement -> IO () -- | fetch fetches the next rowset of data from the result set. The -- values from columns can be retrieved with getFieldValue -- function. fetch :: Statement -> IO Bool type FieldDef = (String, SqlType, Bool) class SqlBind a fromSqlCStringLen :: SqlBind a => FieldDef -> CString -> Int -> IO a -- | Retrieves the value of field with the specified name. getFieldValue :: SqlBind a => Statement -> String -> IO a getFieldValueMB :: SqlBind a => Statement -> String -> IO (Maybe a) -- | Retrieves the value of field with the specified name. If the field -- value is null then the function will return the default -- value. getFieldValue' :: SqlBind a => Statement -> String -> a -> IO a -- | Returns the type and the nullable flag for field with -- specified name getFieldValueType :: Statement -> String -> (SqlType, Bool) -- | Returns the list of fields with their types and nullable -- flags getFieldsTypes :: Statement -> [(String, SqlType, Bool)] -- | The inTransaction function executes the specified action in -- transaction mode. If the action completes successfully then the -- transaction will be commited. If the action completes with an -- exception then the transaction will be rolled back and the exception -- will be throw again. A transaction is to catch ANY exception, so -- SomeException is adequate. inTransaction :: Connection -> (Connection -> IO a) -> IO a -- | The forEachRow function iterates through the result set in -- Statement and executes the given action for each row in the -- set. The function closes the Statement after the last row -- processing or if the given action raises an exception. forEachRow :: (Statement -> s -> IO s) -> Statement -> s -> IO s -- | The 'forEachRow\'' function is analogous to forEachRow but -- doesn't provide state. The function closes the Statement after -- the last row processing or if the given action raises an exception. forEachRow' :: (Statement -> IO ()) -> Statement -> IO () -- | The collectRows function iterates through the result set in -- Statement and executes the given action for each row in the -- set. The values returned from action are collected and returned as -- list. The function closes the Statement after the last row -- processing or if the given action raises an exception. collectRows :: (Statement -> IO a) -> Statement -> IO [a] data SqlError SqlError :: String -> Int -> String -> SqlError seState :: SqlError -> String seNativeError :: SqlError -> Int seErrorMsg :: SqlError -> String SqlNoData :: SqlError SqlInvalidHandle :: SqlError SqlStillExecuting :: SqlError SqlNeedData :: SqlError SqlBadTypeCast :: String -> SqlType -> SqlError seFieldName :: SqlError -> String seFieldType :: SqlError -> SqlType SqlFetchNull :: String -> SqlError seFieldName :: SqlError -> String SqlUnknownField :: String -> SqlError seFieldName :: SqlError -> String SqlUnsupportedOperation :: SqlError SqlClosedHandle :: SqlError -- | DEPRECATED: catchSql: Use Control.Exception.catch instead. catchSql :: IO a -> (SqlError -> IO a) -> IO a -- | DEPRECATED: handleSql: Use Control.Exception.handle instead. handleSql :: (SqlError -> IO a) -> IO a -> IO a -- | Casts, if possible, an Exception to an SqlError: sqlExceptions :: Exception x => x -> Maybe SqlError -- | List all tables in the database. tables :: Connection -> IO [String] -- | List all columns in a table along with their types and -- nullable flags describe :: Connection -> String -> IO [FieldDef] data Point Point :: Double -> Double -> Point data Line Line :: Point -> Point -> Line data Path OpenPath :: [Point] -> Path ClosedPath :: [Point] -> Path data Box Box :: Double -> Double -> Double -> Double -> Box data Circle Circle :: Point -> Double -> Circle data Polygon Polygon :: [Point] -> Polygon data INetAddr INetAddr :: Int -> Int -> Int -> Int -> Int -> INetAddr data MacAddr MacAddr :: Int -> Int -> Int -> Int -> Int -> Int -> MacAddr -- | Differentiation of data types used in DBs. data SqlType SqlInteger :: SqlType SqlBigInt :: SqlType SqlSmallInt :: SqlType SqlTinyInt :: SqlType SqlMedInt :: SqlType SqlDecimal :: Int -> Int -> SqlType SqlNumeric :: Int -> Int -> SqlType SqlReal :: SqlType SqlDouble :: SqlType SqlFloat :: SqlType SqlMoney :: SqlType SqlChar :: Int -> SqlType SqlVarChar :: Int -> SqlType SqlLongVarChar :: Int -> SqlType SqlText :: SqlType SqlWChar :: Int -> SqlType SqlWVarChar :: Int -> SqlType SqlWLongVarChar :: Int -> SqlType SqlDate :: SqlType SqlTime :: SqlType SqlTimeTZ :: SqlType SqlAbsTime :: SqlType SqlRelTime :: SqlType SqlTimeInterval :: SqlType SqlAbsTimeInterval :: SqlType SqlTimeStamp :: SqlType SqlDateTime :: SqlType SqlDateTimeTZ :: SqlType SqlYear :: SqlType SqlBit :: SqlType SqlENUM :: SqlType SqlPoint :: SqlType SqlLSeg :: SqlType SqlPath :: SqlType SqlBox :: SqlType SqlPolygon :: SqlType SqlLine :: SqlType SqlCircle :: SqlType SqlINetAddr :: SqlType SqlCIDRAddr :: SqlType SqlMacAddr :: SqlType SqlBinary :: Int -> SqlType SqlVarBinary :: Int -> SqlType SqlLongVarBinary :: Int -> SqlType SqlSET :: SqlType SqlBLOB :: SqlType -- | HSQL 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 SqlUnknown :: Int -> SqlType