From e184e5a1d87a5453d11108dd29131ac4bbe4c3f1 Mon Sep 17 00:00:00 2001 From: Kei Hibino Date: Thu, 15 Aug 2013 17:53:29 +0900 Subject: [PATCH] Update haddocks. --- relational-join/src/Database/Relational/Query/Monad/Restrict.hs | 1 + relational-join/src/Database/Relational/Query/Restriction.hs | 1 + relational-join/src/Database/Relational/Query/SQL.hs | 2 ++ relational-join/src/Database/Relational/Query/Type.hs | 2 ++ relational-query-HDBC/relational-query-HDBC.cabal | 1 + 5 files changed, 7 insertions(+) diff --git a/relational-join/src/Database/Relational/Query/Monad/Restrict.hs b/relational-join/src/Database/Relational/Query/Monad/Restrict.hs index 3f9059ad..587d449b 100644 --- a/relational-join/src/Database/Relational/Query/Monad/Restrict.hs +++ b/relational-join/src/Database/Relational/Query/Monad/Restrict.hs @@ -30,5 +30,6 @@ type Restrict = Trans.Restrict Identity -- restricted :: a -> Restrict a -- restricted = restrict . Identity +-- | Run 'Restrict' to get SQL WHERE clause. expandPrepend :: Restrict a -> (a, WherePrepend) expandPrepend = runIdentity . extractWheres diff --git a/relational-join/src/Database/Relational/Query/Restriction.hs b/relational-join/src/Database/Relational/Query/Restriction.hs index 49402df2..fbced14b 100644 --- a/relational-join/src/Database/Relational/Query/Restriction.hs +++ b/relational-join/src/Database/Relational/Query/Restriction.hs @@ -25,6 +25,7 @@ import Database.Relational.Query.Projectable (PlaceHolders) import Database.Relational.Query.Monad.Trans.Restrict (prependWhere) import Database.Relational.Query.Monad.Restrict (Restrict, expandPrepend) +-- | Restriction type with place-holder parameter 'p' and projection record type 'r'. newtype Restriction p r = Restriction (Projection r -> Restrict ()) -- | Finalize 'Restrict' monad and generate 'Restriction'. diff --git a/relational-join/src/Database/Relational/Query/SQL.hs b/relational-join/src/Database/Relational/Query/SQL.hs index 8f555bf6..8a5db9d9 100644 --- a/relational-join/src/Database/Relational/Query/SQL.hs +++ b/relational-join/src/Database/Relational/Query/SQL.hs @@ -97,9 +97,11 @@ insertSQL :: Table r -- ^ Table metadata -> String -- ^ Result SQL insertSQL tbl = insertSQL' (name tbl) (columns tbl) +-- | Generate all column delete SQL by specified table. Untyped table version. deleteSQL' :: String -> ShowS deleteSQL' table = (SQL.unwordsSQL [DELETE, FROM, SQL.word table] ++) +-- | Generate all column delete SQL by specified table. deleteSQL :: Table r -- ^ Table metadata -> ShowS -- ^ Result SQL deleteSQL = deleteSQL' . name diff --git a/relational-join/src/Database/Relational/Query/Type.hs b/relational-join/src/Database/Relational/Query/Type.hs index 7b15683f..a9b4dc58 100644 --- a/relational-join/src/Database/Relational/Query/Type.hs +++ b/relational-join/src/Database/Relational/Query/Type.hs @@ -72,6 +72,7 @@ typedUpdate tbl = unsafeTypedUpdate . updateSQL tbl instance Show (Update p a) where show = untypeUpdate +-- | Make typed 'Update' from 'Table' and 'Restriction'. restrictedUpdate :: Table r -> Restriction p r -> Update p r restrictedUpdate tbl r = unsafeTypedUpdate . updateAllColumnsSQL tbl . sqlWhereFromRestriction tbl r $ "" @@ -104,6 +105,7 @@ unsafeTypedDelete = Delete instance Show (Delete p a) where show = untypeDelete +-- | Make typed 'Delete' from 'Table' and 'Restriction'. restrictedDelete :: Table r -> Restriction p r -> Delete p a restrictedDelete tbl r = unsafeTypedDelete . deleteSQL tbl . sqlWhereFromRestriction tbl r $ "" diff --git a/relational-query-HDBC/relational-query-HDBC.cabal b/relational-query-HDBC/relational-query-HDBC.cabal index b7605a78..86d3e093 100644 --- a/relational-query-HDBC/relational-query-HDBC.cabal +++ b/relational-query-HDBC/relational-query-HDBC.cabal @@ -24,6 +24,7 @@ library Database.HDBC.Record.Persistable Database.HDBC.Record.Singleton Database.HDBC.Record.TH + Database.HDBC.Record.Statement Database.HDBC.Record.Query Database.HDBC.Query.TH Database.HDBC.SqlValueExtra