mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-12 12:09:08 +03:00
Fix values list for update statement.
This commit is contained in:
parent
c803dc97b8
commit
17cfd474b4
@ -60,12 +60,14 @@ instance ToSql q () where
|
||||
fromRecord :: ToSql q a => a -> [q]
|
||||
fromRecord = runFromRecord recordToSql
|
||||
|
||||
-- | Expect update form like
|
||||
-- "UPDATE <table> SET c0 = ?, c1 = ?, ..., cn = ? WHERE key = ? "
|
||||
updateValuesByUnique' :: RecordToSql q ra
|
||||
-> KeyConstraint Unique ra
|
||||
-> ra
|
||||
-> [q]
|
||||
updateValuesByUnique' pr uk a = hd ++ tl where
|
||||
(hd, _uk:tl) = splitAt (index uk) (runFromRecord pr a)
|
||||
updateValuesByUnique' pr uk a = hd ++ tl ++ [key] where
|
||||
(hd, key:tl) = splitAt (index uk) (runFromRecord pr a)
|
||||
|
||||
updateValuesByUnique :: ToSql q ra
|
||||
=> KeyConstraint Unique ra
|
||||
|
Loading…
Reference in New Issue
Block a user