File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
src/Database/PostgreSQL/PQTypes Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,15 @@ instance PQFormat Float where
8585instance PQFormat Double where
8686 pqFormat = BS. pack " %float8"
8787
88+ instance PQFormat Word16 where
89+ pqFormat = BS. pack " %word2"
90+
91+ instance PQFormat Word32 where
92+ pqFormat = BS. pack " %word4"
93+
94+ instance PQFormat Word64 where
95+ pqFormat = BS. pack " %word8"
96+
8897-- CHAR
8998
9099instance PQFormat Char where
Original file line number Diff line number Diff line change @@ -68,6 +68,21 @@ instance FromSQL Double where
6868 fromSQL Nothing = unexpectedNULL
6969 fromSQL (Just n) = pure . realToFrac $ n
7070
71+ instance FromSQL Word16 where
72+ type PQBase Word16 = CUShort
73+ fromSQL Nothing = unexpectedNULL
74+ fromSQL (Just n) = pure . fromIntegral $ n
75+
76+ instance FromSQL Word32 where
77+ type PQBase Word32 = CUInt
78+ fromSQL Nothing = unexpectedNULL
79+ fromSQL (Just n) = pure . fromIntegral $ n
80+
81+ instance FromSQL Word64 where
82+ type PQBase Word64 = CULLong
83+ fromSQL Nothing = unexpectedNULL
84+ fromSQL (Just n) = pure . fromIntegral $ n
85+
7186-- CHAR
7287
7388instance FromSQL Char where
Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ instance ToSQL Double where
8484 type PQDest Double = CDouble
8585 toSQL n _ = putAsPtr (realToFrac n)
8686
87+ instance ToSQL Word16 where
88+ type PQDest Word16 = CUShort
89+ toSQL n _ = putAsPtr (fromIntegral n)
90+
91+ instance ToSQL Word32 where
92+ type PQDest Word32 = CUInt
93+ toSQL n _ = putAsPtr (fromIntegral n)
94+
95+ instance ToSQL Word64 where
96+ type PQDest Word64 = CULLong
97+ toSQL n _ = putAsPtr (fromIntegral n)
98+
8799-- CHAR
88100
89101instance ToSQL Char where
You can’t perform that action at this time.
0 commit comments