module Database.PostgreSQL.PQTypes.XML (
XML(..)
) where
import Data.Text
import Data.Typeable
import Prelude
import qualified Data.ByteString.Char8 as BSC
import Database.PostgreSQL.PQTypes.Format
import Database.PostgreSQL.PQTypes.FromSQL
import Database.PostgreSQL.PQTypes.Internal.C.Types
import Database.PostgreSQL.PQTypes.ToSQL
newtype XML = XML { unXML :: Text }
deriving (Eq, Ord, Read, Show, Typeable)
instance PQFormat XML where
pqFormat = BSC.pack "%xml"
instance FromSQL XML where
type PQBase XML = PGbytea
fromSQL = fmap XML . fromSQL
instance ToSQL XML where
type PQDest XML = PGbytea
toSQL = toSQL . unXML