Copyright | (c) 2011 MailRank Inc. |
---|---|
License | BSD3 |
Maintainer | José Lorenzo Rodríguez |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Database.MySQL.Nem.Result
Description
The Result
typeclass, for converting a single value in a row
returned by a SQL query into a more useful Haskell representation.
A Haskell numeric type is considered to be compatible with all
MySQL numeric types that are less accurate than it. For instance,
the Haskell Double
type is compatible with the MySQL Long
type
because it can represent a Long
exactly. On the other hand, since
a Double
might lose precision if representing a LongLong
, the
two are not considered compatible.
Synopsis
- data ResultError
- = Incompatible { }
- | ConversionFailed { }
- class Result a where
- convert :: ColumnDef -> MySQLValue -> a
Documentation
data ResultError Source #
Exception thrown if conversion from a SQL value to a Haskell value fails.
Constructors
Incompatible | |
Fields
| |
ConversionFailed | |
Fields
|
Instances
Exception ResultError Source # | |
Defined in Database.MySQL.Nem.Result Methods toException :: ResultError -> SomeException # fromException :: SomeException -> Maybe ResultError # displayException :: ResultError -> String # | |
Show ResultError Source # | |
Defined in Database.MySQL.Nem.Result Methods showsPrec :: Int -> ResultError -> ShowS # show :: ResultError -> String # showList :: [ResultError] -> ShowS # | |
Eq ResultError Source # | |
Defined in Database.MySQL.Nem.Result |
A type that may be converted from a SQL type.
Methods
convert :: ColumnDef -> MySQLValue -> a Source #
Instances
Result Int16 Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Int32 Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Int64 Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Int8 Source # | |
Defined in Database.MySQL.Nem.Result | |
Result ByteString Source # | |
Defined in Database.MySQL.Nem.Result Methods convert :: ColumnDef -> MySQLValue -> ByteString Source # | |
Result Scientific Source # | |
Defined in Database.MySQL.Nem.Result Methods convert :: ColumnDef -> MySQLValue -> Scientific Source # | |
Result Text Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Day Source # | |
Defined in Database.MySQL.Nem.Result | |
Result LocalTime Source # | |
Defined in Database.MySQL.Nem.Result | |
Result String Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Double Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Float Source # | |
Defined in Database.MySQL.Nem.Result | |
Result Int Source # | |
Defined in Database.MySQL.Nem.Result | |
Result a => Result (Maybe a) Source # | |
Defined in Database.MySQL.Nem.Result |