mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-29 14:45:51 +03:00
relational-query-HDBC: apply updated constraint.
(grafted from 33b398d8852c6938ee7b309ae3a1467b62ca3dc9)
This commit is contained in:
parent
287d37c298
commit
496fde6079
@ -25,6 +25,7 @@ import Control.Exception (bracket)
|
||||
import Database.HDBC (IConnection, SqlValue, Statement)
|
||||
import qualified Database.HDBC as HDBC
|
||||
|
||||
import Database.Record (PersistableWidth)
|
||||
import Database.Relational.Query
|
||||
(KeyUpdate, untypeKeyUpdate, updateValuesWithKey, Pi)
|
||||
import qualified Database.Relational.Query as Query
|
||||
@ -74,7 +75,7 @@ withPrepareKeyUpdate conn ku body =
|
||||
key = Query.updateKey ku
|
||||
|
||||
-- | Typed operation to bind parameters for 'PreparedKeyUpdate' type.
|
||||
bindKeyUpdate :: ToSql SqlValue a
|
||||
bindKeyUpdate :: (PersistableWidth a, ToSql SqlValue a)
|
||||
=> PreparedKeyUpdate p a
|
||||
-> a
|
||||
-> BoundStatement ()
|
||||
@ -83,7 +84,7 @@ bindKeyUpdate pre a =
|
||||
where key = updateKey pre
|
||||
|
||||
-- | Bind parameters, execute statement and get execution result.
|
||||
runPreparedKeyUpdate :: ToSql SqlValue a
|
||||
runPreparedKeyUpdate :: (PersistableWidth a, ToSql SqlValue a)
|
||||
=> PreparedKeyUpdate p a
|
||||
-> a
|
||||
-> IO Integer
|
||||
@ -91,7 +92,7 @@ runPreparedKeyUpdate pre = executeNoFetch . bindKeyUpdate pre
|
||||
|
||||
-- | Prepare insert statement, bind parameters,
|
||||
-- execute statement and get execution result.
|
||||
runKeyUpdate :: (IConnection conn, ToSql SqlValue a)
|
||||
runKeyUpdate :: (IConnection conn, PersistableWidth a, ToSql SqlValue a)
|
||||
=> conn
|
||||
-> KeyUpdate p a
|
||||
-> a
|
||||
|
Loading…
Reference in New Issue
Block a user