mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-25 21:04:03 +03:00
Merge branch 'typos'
This commit is contained in:
commit
999adf5318
@ -114,7 +114,7 @@ withConnectionIO' = withConnectionIO
|
||||
|
||||
-- | Run a transaction on a HDBC 'IConnection' and commit at last, and then close the connection.
|
||||
-- In other words, the transaction with no exception is committed.
|
||||
-- Handy defintion for simple transactions.
|
||||
-- Handy definition for simple transactions.
|
||||
transaction :: IConnection conn
|
||||
=> IO conn -- ^ Connect action
|
||||
-> (conn -> IO a) -- ^ Transaction body
|
||||
|
@ -29,7 +29,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Binding between SQL database values and haskell records.
|
||||
This package contiains types to represent table constraints and
|
||||
This package contains types to represent table constraints and
|
||||
interfaces to bind between SQL database values and Haskell records.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
@ -49,7 +49,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Binding between SQL database values and haskell records.
|
||||
This package contiains types to represent table constraints and
|
||||
This package contains types to represent table constraints and
|
||||
interfaces to bind between SQL database values and Haskell records.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
@ -70,7 +70,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Binding between SQL database values and haskell records.
|
||||
This package contiains types to represent table constraints and
|
||||
This package contains types to represent table constraints and
|
||||
interfaces to bind between SQL database values and Haskell records.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
|
@ -41,7 +41,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Typeful, Modular, Relational, algebraic query engine
|
||||
This package contiains typeful relation structure and
|
||||
This package contains typeful relation structure and
|
||||
relational-algebraic query building DSL which can
|
||||
translate into SQL query.
|
||||
Supported query features are below:
|
||||
@ -67,7 +67,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Typeful, Modular, Relational, algebraic query engine
|
||||
This package contiains typeful relation structure and
|
||||
This package contains typeful relation structure and
|
||||
relational-algebraic query building DSL which can
|
||||
translate into SQL query.
|
||||
Supported query features are below:
|
||||
@ -94,7 +94,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Typeful, Modular, Relational, algebraic query engine
|
||||
This package contiains typeful relation structure and
|
||||
This package contains typeful relation structure and
|
||||
relational-algebraic query building DSL which can
|
||||
translate into SQL query.
|
||||
Supported query features are below:
|
||||
|
@ -20,7 +20,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Simple idea SQL keywords data constructor into OverloadedString
|
||||
This package contiains SQL keywords constructors defined as
|
||||
This package contains SQL keywords constructors defined as
|
||||
OverloadedString literals and helper functions to concate these.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
@ -40,7 +40,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Simple idea SQL keywords data constructor into OverloadedString
|
||||
This package contiains SQL keywords constructors defined as
|
||||
This package contains SQL keywords constructors defined as
|
||||
OverloadedString literals and helper functions to concate these.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
@ -61,7 +61,7 @@ Conflicts: ${haskell:Conflicts}
|
||||
Provides: ${haskell:Provides}
|
||||
Replaces: ${haskell:Replaces}
|
||||
Description: Simple idea SQL keywords data constructor into OverloadedString
|
||||
This package contiains SQL keywords constructors defined as
|
||||
This package contains SQL keywords constructors defined as
|
||||
OverloadedString literals and helper functions to concate these.
|
||||
.
|
||||
Author: Kei Hibino
|
||||
|
@ -459,7 +459,7 @@ div#style-menu-holder {
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group Auxillary Pages */
|
||||
/* @group Auxiliary Pages */
|
||||
|
||||
#mini {
|
||||
margin: 0 auto;
|
||||
|
@ -85,7 +85,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||
<ul>
|
||||
<li>Want to find errors of SQL at compile time</li>
|
||||
</ul></li>
|
||||
<li>Compile time schema loading and generating type informations</li>
|
||||
<li>Compile time schema loading and generating type information</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="intro" class="titleslide slide section level1"><h1>Intro</h1></div><div id="intro-join---set" class="slide section level2">
|
||||
|
@ -10,7 +10,7 @@ Concepts
|
||||
* http://khibino.github.io/haskell-relational-record/
|
||||
* Composability and Type-Safety
|
||||
* Want to find errors of SQL at compile time
|
||||
* Compile time schema loading and generating type informations
|
||||
* Compile time schema loading and generating type information
|
||||
|
||||
Intro
|
||||
=====
|
||||
|
@ -88,7 +88,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
|
||||
* SQL building DSL using Haskell
|
||||
* http://khibino.github.io/haskell-relational-record/
|
||||
* The appeal point of this DSL is composability and type-safety
|
||||
* Compile time schema loading and generating type informations
|
||||
* Compile time schema loading and generating type information
|
||||
-->
|
||||
</div>
|
||||
<div id="結合式の例joined-query-building" class="slide section level2">
|
||||
|
@ -17,7 +17,7 @@
|
||||
* SQL building DSL using Haskell
|
||||
* http://khibino.github.io/haskell-relational-record/
|
||||
* The appeal point of this DSL is composability and type-safety
|
||||
* Compile time schema loading and generating type informations
|
||||
* Compile time schema loading and generating type information
|
||||
-->
|
||||
|
||||
結合式の例/Joined Query building
|
||||
|
@ -130,7 +130,7 @@ agesOfFamiliesO <span class="fu">=</span> aggregateRelation <span class="fu">$<
|
||||
my <span class="ot"><-</span> query myTable
|
||||
gFam <span class="ot"><-</span> groupBy <span class="fu">$</span> my <span class="fu">!</span> family'
|
||||
<span class="kw">let</span> s <span class="fu">=</span> sum' (my <span class="fu">!</span> age')
|
||||
orderBy s <span class="dt">Desc</span> <span class="co">-- Only aggregated value is allowd to pass</span>
|
||||
orderBy s <span class="dt">Desc</span> <span class="co">-- Only aggregated value is allowed to pass</span>
|
||||
orderBy gFam <span class="dt">Asc</span>
|
||||
return <span class="fu">$</span> gFam <span class="fu">><</span> s</code></pre></div>
|
||||
</div>
|
||||
|
@ -77,7 +77,7 @@ agesOfFamiliesO = aggregateRelation $ do
|
||||
my <- query myTable
|
||||
gFam <- groupBy $ my ! family'
|
||||
let s = sum' (my ! age')
|
||||
orderBy s Desc -- Only aggregated value is allowd to pass
|
||||
orderBy s Desc -- Only aggregated value is allowed to pass
|
||||
orderBy gFam Asc
|
||||
return $ gFam >< s
|
||||
~~~~~
|
||||
|
@ -26,7 +26,7 @@ agesOfFamiliesO = aggregateRelation $ do
|
||||
my <- query myTable
|
||||
gFam <- groupBy $ my ! family'
|
||||
let s = sum' (my ! age')
|
||||
orderBy s Desc -- Only aggregated value is allowd to pass
|
||||
orderBy s Desc -- Only aggregated value is allowed to pass
|
||||
orderBy gFam Asc
|
||||
return $ gFam >< s
|
||||
|
||||
|
@ -26,7 +26,7 @@ agesOfFamiliesO = aggregateRelation $ do
|
||||
my <- query myTable
|
||||
gFam <- groupBy $ my ! family'
|
||||
let s = sum' (my ! age')
|
||||
orderBy s Desc -- Only aggregated value is allowd to pass
|
||||
orderBy s Desc -- Only aggregated value is allowed to pass
|
||||
orderBy gFam Asc
|
||||
return $ gFam >< s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Setup
|
||||
=====
|
||||
|
||||
Don't forget to load enviroment setup script like oraenv.
|
||||
Don't forget to load environment setup script like oraenv.
|
||||
|
@ -166,7 +166,7 @@ userGroupAggregate2 =
|
||||
asc -< c
|
||||
returnA -< g >< c >< every (uid .<. just (value 3))
|
||||
|
||||
-- Concatinate operator
|
||||
-- Concatenate operator
|
||||
userGroupStr :: Relation () (Maybe String)
|
||||
userGroupStr =
|
||||
relation $ proc () -> do
|
||||
@ -237,7 +237,7 @@ userGroupU =
|
||||
g = umg ! snd'
|
||||
returnA -< (ph, u >< g)
|
||||
|
||||
-- Window funcions
|
||||
-- Window functions
|
||||
windowRankByGroup :: Relation () ((Int64, Maybe Int32), (Maybe String, Maybe String))
|
||||
windowRankByGroup = relation $ proc () -> do
|
||||
u <- query user -< ()
|
||||
|
@ -171,7 +171,7 @@ userGroupAggregate2 =
|
||||
, () <- asc c
|
||||
]
|
||||
|
||||
-- Concatinate operator
|
||||
-- Concatenate operator
|
||||
userGroupStr :: Relation () (Maybe String)
|
||||
userGroupStr =
|
||||
relation
|
||||
@ -182,7 +182,7 @@ userGroupStr =
|
||||
g = ug ! snd'
|
||||
]
|
||||
|
||||
-- Type check is imcomplete when nested case
|
||||
-- Type check is incomplete when nested case
|
||||
userGroup2Fail :: Relation () (Maybe User, Maybe Group)
|
||||
userGroup2Fail =
|
||||
relation
|
||||
@ -242,7 +242,7 @@ userGroupU =
|
||||
g = umg ! snd'
|
||||
]
|
||||
|
||||
-- Window funcions
|
||||
-- Window functions
|
||||
windowRankByGroup :: Relation () ((Int64, Maybe Int32), (Maybe String, Maybe String))
|
||||
windowRankByGroup = relation $ do
|
||||
u <- query user
|
||||
|
@ -173,7 +173,7 @@ userGroupAggregate2 =
|
||||
, () <- asc c
|
||||
]
|
||||
|
||||
-- Concatinate operator
|
||||
-- Concatenate operator
|
||||
userGroupStr :: Relation () (Maybe String)
|
||||
userGroupStr =
|
||||
relation
|
||||
@ -184,7 +184,7 @@ userGroupStr =
|
||||
g = #snd ug
|
||||
]
|
||||
|
||||
-- Type check is imcomplete when nested case
|
||||
-- Type check is incomplete when nested case
|
||||
userGroup2Fail :: Relation () (Maybe User, Maybe Group)
|
||||
userGroup2Fail =
|
||||
relation
|
||||
@ -244,7 +244,7 @@ userGroupU =
|
||||
g = #snd umg
|
||||
]
|
||||
|
||||
-- Window funcions
|
||||
-- Window functions
|
||||
windowRankByGroup :: Relation () ((Int64, Maybe Int32), (Maybe String, Maybe String))
|
||||
windowRankByGroup = relation $ do
|
||||
u <- query user
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
## 0.6.0.2
|
||||
|
||||
- bugfix: pass correct table name to macro for field label defintion.
|
||||
- bugfix: pass correct table name to macro for field label definition.
|
||||
|
||||
## 0.6.0.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: persistable-record
|
||||
version: 0.6.0.5
|
||||
synopsis: Binding between SQL database values and haskell records.
|
||||
description: This package contiains types to represent table constraints and
|
||||
description: This package contains types to represent table constraints and
|
||||
interfaces to bind between SQL database values and Haskell records.
|
||||
homepage: http://khibino.github.io/haskell-relational-record/
|
||||
license: BSD3
|
||||
|
@ -241,7 +241,7 @@ unsafeUpdateValuesWithIndexes key a =
|
||||
-- UPDATE /table/ SET /c0/ = ?, /c1/ = ?, /c2/ = ? ... WHERE /key0/ = ? AND /key1/ = ? AND /key2/ = ? ...
|
||||
-- @
|
||||
--
|
||||
-- using printer function object infered by ToSql ra q.
|
||||
-- using printer function object inferred by ToSql ra q.
|
||||
updateValuesByUnique :: ToSql q ra
|
||||
=> KeyConstraint Unique ra -- ^ Unique key table constraint printer function object.
|
||||
-> ra
|
||||
|
@ -149,7 +149,7 @@ tableAlongWithSchema connect drv scm tbl cmap derives = do
|
||||
cols1 = [ (,) cn . maybe ty (liftMaybe ty) . Map.lookup cn $ Map.fromList cmap | (cn, ty) <- cols ]
|
||||
defineTableDefault config scm tbl cols1 derives primaryIxs (listToMaybe notNullIdxs)
|
||||
|
||||
-- | Generate all HDBC templates using system catalog informations with specified config.
|
||||
-- | Generate all HDBC templates using system catalog information with specified config.
|
||||
defineTableFromDB' :: IConnection conn
|
||||
=> IO conn -- ^ Connect action to system catalog database
|
||||
-> Driver conn -- ^ Driver definition
|
||||
@ -160,7 +160,7 @@ defineTableFromDB' :: IConnection conn
|
||||
-> Q [Dec] -- ^ Result declaration
|
||||
defineTableFromDB' = tableAlongWithSchema
|
||||
|
||||
-- | Generate all HDBC templates using system catalog informations.
|
||||
-- | Generate all HDBC templates using system catalog information.
|
||||
defineTableFromDB :: IConnection conn
|
||||
=> IO conn -- ^ Connect action to system catalog database
|
||||
-> Driver conn -- ^ Driver definition
|
||||
|
@ -229,7 +229,7 @@
|
||||
|
||||
## 0.6.1.0
|
||||
|
||||
- Add a configuration flag to pring verbose compile-time messages.
|
||||
- Add a configuration flag to print verbose compile-time messages.
|
||||
|
||||
## 0.6.0.0
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: relational-query
|
||||
version: 0.12.3.0
|
||||
synopsis: Typeful, Modular, Relational, algebraic query engine
|
||||
description: This package contiains typeful relation structure and
|
||||
description: This package contains typeful relation structure and
|
||||
relational-algebraic query building DSL which can
|
||||
translate into SQL query.
|
||||
.
|
||||
|
@ -11,7 +11,7 @@
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- This module defines arrow version combinators which
|
||||
-- improves type-safty on building queries.
|
||||
-- improves type-safety on building queries.
|
||||
-- Referencing the local projected records may cause to break
|
||||
-- the result query.
|
||||
-- It is possible to controls injection of previous local projected records
|
||||
|
@ -103,11 +103,11 @@ class PersistableWidth ct => HasConstraintKey c r ct where
|
||||
constraintKey :: Key c r ct
|
||||
|
||||
-- | Inferred 'Unique' constraint 'Key'.
|
||||
-- Record type 'r' has unique key which type is 'ct' derived from primay key.
|
||||
-- Record type 'r' has unique key which type is 'ct' derived from primary key.
|
||||
derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct
|
||||
derivedUniqueKey = uniqueKey constraintKey
|
||||
|
||||
-- -- | Inferred 'NotNull' constraint 'Key'.
|
||||
-- -- Record type 'r' has not-null key which type is 'ct' derived from primay key.
|
||||
-- -- Record type 'r' has not-null key which type is 'ct' derived from primary key.
|
||||
-- derivedNotNullKey :: HasConstraintKey Primary r ct => Key NotNull r ct
|
||||
-- derivedNotNullKey = notNullKey constraintKey
|
||||
|
@ -9,7 +9,7 @@
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- This module defines typed SQLs derived from type informations.
|
||||
-- This module defines typed SQLs derived from type information.
|
||||
module Database.Relational.Derives (
|
||||
-- * Query derivation
|
||||
specifiedKey,
|
||||
|
@ -73,7 +73,7 @@ assignTo vp target = Assignings . tell
|
||||
leftsR = recordColumns . targetRecord target
|
||||
rights = recordColumns vp
|
||||
|
||||
-- | Add and assginment.
|
||||
-- | Add and assignment.
|
||||
(<-#) :: Monad m => AssignTarget r v -> Record Flat v -> Assignings r m ()
|
||||
(<-#) = flip assignTo
|
||||
|
||||
|
@ -62,7 +62,7 @@ instance MonadQuery q => MonadQuery (Restrictings c q) where
|
||||
query' = restrictings . query'
|
||||
queryMaybe' = restrictings . queryMaybe'
|
||||
|
||||
-- | Resticted 'MonadAggregate' instance.
|
||||
-- | Restricted 'MonadAggregate' instance.
|
||||
instance MonadAggregate m => MonadAggregate (Restrictings c m) where
|
||||
groupBy = restrictings . groupBy
|
||||
groupBy' = restrictings . groupBy'
|
||||
|
@ -82,7 +82,7 @@ unsafeExpandIndexes' :: PersistableRecordWidth a -> Pi a b -> [Int]
|
||||
unsafeExpandIndexes' = expandIndexes'
|
||||
{-# DEPRECATED unsafeExpandIndexes' "Use expandIndexes' instead of this." #-}
|
||||
|
||||
-- | Expand indexes from key. Infered width version.
|
||||
-- | Expand indexes from key. Inferred width version.
|
||||
expandIndexes :: PersistableWidth a => Pi a b -> [Int]
|
||||
expandIndexes = expandIndexes' persistableWidth
|
||||
|
||||
|
@ -247,12 +247,12 @@ exists :: OperatorContext c
|
||||
exists = unsafeProjectSql' . SQL.paren . SQL.defineUniOp SQL.EXISTS
|
||||
. Record.unsafeStringSqlList (rowStringSQL . recordColumns)
|
||||
|
||||
-- | Concatinate operator corresponding SQL /||/ .
|
||||
-- | Concatenate operator corresponding SQL /||/ .
|
||||
(.||.) :: OperatorContext c
|
||||
=> Record c a -> Record c a -> Record c a
|
||||
(.||.) = unsafeBinOp (SQL..||.)
|
||||
|
||||
-- | Concatinate operator corresponding SQL /||/ . Maybe type version.
|
||||
-- | Concatenate operator corresponding SQL /||/ . Maybe type version.
|
||||
(?||?) :: (OperatorContext c, IsString a)
|
||||
=> Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
|
||||
(?||?) = unsafeBinOp (SQL..||.)
|
||||
|
@ -38,9 +38,9 @@ instance SqlContext Aggregated where
|
||||
instance SqlContext OverWindow where
|
||||
unsafeProjectSqlTerms = unsafeRecordFromColumns
|
||||
|
||||
-- | full SQL expression is availabe in Flat context
|
||||
-- | full SQL expression is available in Flat context
|
||||
instance OperatorContext Flat
|
||||
-- | full SQL expression is availabe in Aggregated context
|
||||
-- | full SQL expression is available in Aggregated context
|
||||
instance OperatorContext Aggregated
|
||||
|
||||
-- | 'Aggregated' context is aggregated context
|
||||
|
@ -31,5 +31,5 @@ class SqlContext c => OperatorContext c
|
||||
class AggregatedContext ac
|
||||
|
||||
|
||||
-- | Placeholder parameter type which has real parameter type arguemnt 'p'.
|
||||
-- | Placeholder parameter type which has real parameter type argument 'p'.
|
||||
data PlaceHolders p = PlaceHolders
|
||||
|
@ -155,7 +155,7 @@ just = Typed.just
|
||||
|
||||
{-# DEPRECATED
|
||||
unsafeToAggregated, unsafeToFlat, unsafeChangeContext
|
||||
"use unsafeProejctSql . recordColumns instead of this." #-}
|
||||
"use unsafeProjectSql . recordColumns instead of this." #-}
|
||||
unsafeToAggregated :: Record Flat r -> Record Aggregated r
|
||||
unsafeToAggregated = Typed.unsafeToAggregated
|
||||
|
||||
|
@ -136,11 +136,11 @@ relation' = unsafeTypeRelation . Simple.toSubQuery
|
||||
relation :: QuerySimple (Record Flat r) -> Relation () r
|
||||
relation = relation' . addUnitPH
|
||||
|
||||
-- | Finalize 'QueryAggregate' monad and geneate 'Relation' with place-holder parameter 'p'.
|
||||
-- | Finalize 'QueryAggregate' monad and generate 'Relation' with place-holder parameter 'p'.
|
||||
aggregateRelation' :: AggregatedQuery p r -> Relation p r
|
||||
aggregateRelation' = unsafeTypeRelation . Aggregate.toSubQuery
|
||||
|
||||
-- | Finalize 'QueryAggregate' monad and geneate 'Relation'.
|
||||
-- | Finalize 'QueryAggregate' monad and generate 'Relation'.
|
||||
aggregateRelation :: QueryAggregate (Record Aggregated r) -> Relation () r
|
||||
aggregateRelation = aggregateRelation' . addUnitPH
|
||||
|
||||
|
@ -309,7 +309,7 @@ insert = typedInsert' defaultConfig derivedTable
|
||||
derivedInsert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r'
|
||||
derivedInsert = insert
|
||||
|
||||
-- | Make typed 'Insert' from 'Config', 'Table' and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'Config', 'Table' and monadic built 'Register' object.
|
||||
typedInsertValue' :: Config -> Table r -> Register r (PlaceHolders p) -> Insert p
|
||||
typedInsertValue' config tbl it =
|
||||
unsafeTypedInsert'
|
||||
@ -319,11 +319,11 @@ typedInsertValue' config tbl it =
|
||||
(ci, n) = chunkInsertFromRegister config tbl it
|
||||
|
||||
{-# DEPRECATED typedInsertValue "use `typedInsertValue' defaultConfig` instead of this." #-}
|
||||
-- | Make typed 'Insert' from 'Table' and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'Table' and monadic built 'Register' object.
|
||||
typedInsertValue :: Table r -> Register r (PlaceHolders p) -> Insert p
|
||||
typedInsertValue = typedInsertValue' defaultConfig
|
||||
|
||||
-- | Make typed 'Insert' from 'Config', derived table and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'Config', derived table and monadic built 'Register' object.
|
||||
insertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
|
||||
insertValue' config rs = typedInsertValue' config (rt rs) rs
|
||||
where
|
||||
@ -331,20 +331,20 @@ insertValue' config rs = typedInsertValue' config (rt rs) rs
|
||||
rt = const derivedTable
|
||||
|
||||
{-# DEPRECATED derivedInsertValue' "use `insertValue'` instead of this." #-}
|
||||
-- | Make typed 'Insert' from 'Config', derived table and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'Config', derived table and monadic built 'Register' object.
|
||||
derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
|
||||
derivedInsertValue' = insertValue'
|
||||
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
|
||||
insertValue = insertValue' defaultConfig
|
||||
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r => Register r () -> Insert ()
|
||||
insertValueNoPH = insertValue . (>> return unitPH)
|
||||
|
||||
{-# DEPRECATED derivedInsertValue "use `insertValue` instead of this." #-}
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic builded 'Register' object.
|
||||
-- | Make typed 'Insert' from 'defaultConfig', derived table and monadic built 'Register' object.
|
||||
derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
|
||||
derivedInsertValue = insertValue
|
||||
|
||||
@ -457,7 +457,7 @@ instance Show (Delete p) where
|
||||
show = untypeDelete
|
||||
|
||||
|
||||
-- | Untype interface for typed no-result type statments
|
||||
-- | Untype interface for typed no-result type statements
|
||||
-- with single type parameter which represents place-holder parameter 'p'.
|
||||
class UntypeableNoFetch s where
|
||||
untypeNoFetch :: s p -> String
|
||||
|
@ -169,7 +169,7 @@ list = List
|
||||
unsafeListFromSubQuery :: SubQuery -> RecordList p t
|
||||
unsafeListFromSubQuery = Sub
|
||||
|
||||
-- | Map record show operatoions and concatinate to single SQL expression.
|
||||
-- | Map record show operatoions and concatenate to single SQL expression.
|
||||
unsafeStringSqlList :: (p t -> StringSQL) -> RecordList p t -> StringSQL
|
||||
unsafeStringSqlList sf = d where
|
||||
d (List ps) = listStringSQL $ map sf ps
|
||||
|
@ -33,7 +33,7 @@ $(defineTable defaultConfig "TEST" "set_c"
|
||||
, ("may_str_c3" , [t| Maybe String |]) ]
|
||||
[''Generic] [0] $ Just 0)
|
||||
|
||||
-- column name conflict with Confict.conflictB
|
||||
-- column name conflict with Conflict.conflictB
|
||||
$(defineTable defaultConfig "TEST" "conflict_a"
|
||||
[ ("foo" , [t| String |])
|
||||
, ("bar" , [t| Int32 |])
|
||||
|
@ -671,7 +671,7 @@ selfJoin_5_3aT = relation $ do
|
||||
-- | sql/6.4.1a
|
||||
--
|
||||
-- The standard SQL allows the syntax of UNION that has an order clause
|
||||
-- at the last of query. Unfortunately, HRR dows not support. In addition,
|
||||
-- at the last of query. Unfortunately, HRR does not support. In addition,
|
||||
-- HRR put a select statement having an order clause into parentheses.
|
||||
-- If you want to sort whole row returned from UNION, place a order
|
||||
-- clouse outside of the union relation.
|
||||
|
@ -676,7 +676,7 @@ selfJoin_5_3aT = relation $ do
|
||||
-- | sql/6.4.1a
|
||||
--
|
||||
-- The standard SQL allows the syntax of UNION that has an order clause
|
||||
-- at the last of query. Unfortunately, HRR dows not support. In addition,
|
||||
-- at the last of query. Unfortunately, HRR does not support. In addition,
|
||||
-- HRR put a select statement having an order clause into parentheses.
|
||||
-- If you want to sort whole row returned from UNION, place a order
|
||||
-- clouse outside of the union relation.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Self-join
|
||||
|
||||
sqlite3 exmaples.db "
|
||||
sqlite3 examples.db "
|
||||
SELECT e.fname, e.lname, e_mgr.fname mgr_fname, e_mgr.lname mgr_lname
|
||||
FROM employee e INNER JOIN employee e_mgr
|
||||
ON e.superior_emp_id = e_mgr.emp_id
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -33,13 +33,13 @@ relationalQuery :: Relation p r -- ^ relation to finalize building
|
||||
-> Query p r -- ^ finalized query
|
||||
relationalQuery = relationalQuery_ config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object.
|
||||
insertValue :: TableDerivable r
|
||||
=> Register r (PlaceHolders p)
|
||||
-> Insert p
|
||||
insertValue = insertValue' config
|
||||
|
||||
-- | Make 'Insert' from derived table and monadic builded 'Register' object with no(unit) placeholder.
|
||||
-- | Make 'Insert' from derived table and monadic built 'Register' object with no(unit) placeholder.
|
||||
insertValueNoPH :: TableDerivable r
|
||||
=> Register r ()
|
||||
-> Insert ()
|
||||
|
@ -10,7 +10,7 @@
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- This module implements queries to get
|
||||
-- table schema and table constraint informations
|
||||
-- table schema and table constraint information
|
||||
-- from system catalog of IBM DB2.
|
||||
module Database.Relational.Schema.IBMDB2 (
|
||||
module Database.Relational.Schema.IBMDB2.Config,
|
||||
|
@ -10,7 +10,7 @@
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- This module implements queries to get
|
||||
-- table schema and table constraint informations
|
||||
-- table schema and table constraint information
|
||||
-- from system catalog of PostgreSQL.
|
||||
module Database.Relational.Schema.PostgreSQL (
|
||||
module Database.Relational.Schema.PostgreSQL.Config,
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: sql-words
|
||||
version: 0.1.6.4
|
||||
synopsis: SQL keywords data constructors into OverloadedString
|
||||
description: This package contiains SQL keywords constructors defined as
|
||||
description: This package contains SQL keywords constructors defined as
|
||||
OverloadedString literals and helper functions to concate these.
|
||||
homepage: http://khibino.github.io/haskell-relational-record/
|
||||
license: BSD3
|
||||
|
@ -12,7 +12,7 @@
|
||||
module Language.SQL.Keyword (
|
||||
-- * Module which includes keyword type definition
|
||||
module Language.SQL.Keyword.Type,
|
||||
-- * Module which includes functions to concatinate keywords
|
||||
-- * Module which includes functions to concatenate keywords
|
||||
module Language.SQL.Keyword.Concat
|
||||
) where
|
||||
|
||||
|
@ -9,10 +9,10 @@
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- Concatinations on 'Keyword' types
|
||||
-- Concatenations on 'Keyword' types
|
||||
module Language.SQL.Keyword.Concat (
|
||||
-- * List concatination functions
|
||||
-- $listConcatination
|
||||
-- * List concatenation functions
|
||||
-- $listConcatenation
|
||||
unwords',
|
||||
|
||||
sepBy, parenSepBy,
|
||||
@ -44,23 +44,23 @@ import Data.Monoid (mempty, mconcat, (<>))
|
||||
import Language.SQL.Keyword.Internal.Type (Keyword (..), word, wordShow, toDString, fromDString)
|
||||
|
||||
|
||||
{- $listConcatination
|
||||
Functions to concatinate 'Keyword' list.
|
||||
{- $listConcatenation
|
||||
Functions to concatenate 'Keyword' list.
|
||||
-}
|
||||
|
||||
-- | Separate 'Keyword' list with delimiter 'Keyword' and map to 'String' list.
|
||||
sepBy' :: [Keyword] -> Keyword -> [String]
|
||||
ws `sepBy'` d = map wordShow . intersperse d $ ws
|
||||
|
||||
-- | Concatinate 'Keyword' list like unwords on 'String' list.
|
||||
-- | Concatenate 'Keyword' list like unwords on 'String' list.
|
||||
unwords' :: [Keyword] -> Keyword
|
||||
unwords' = mconcat
|
||||
|
||||
-- | Concatinate 'String' list into one 'Keyword'.
|
||||
-- | Concatenate 'String' list into one 'Keyword'.
|
||||
concatStr :: [String] -> Keyword
|
||||
concatStr = word . concat
|
||||
|
||||
-- | Separate 'Keyword' list with delimiter 'Keyword' and concatinate into one 'Keyword'.
|
||||
-- | Separate 'Keyword' list with delimiter 'Keyword' and concatenate into one 'Keyword'.
|
||||
sepBy :: [Keyword] -> Keyword -> Keyword
|
||||
ws `sepBy` d = concatStr $ ws `sepBy'` d
|
||||
|
||||
@ -69,10 +69,10 @@ parenSepBy :: [Keyword] -> Keyword -> Keyword
|
||||
ws `parenSepBy` d = concatStr $ "(" : (ws `sepBy'` d) ++ [")"]
|
||||
|
||||
{- $binaryOperators
|
||||
Binary operators on SQL. Result is concatinated into one 'Keyword'.
|
||||
Binary operators on SQL. Result is concatenated into one 'Keyword'.
|
||||
-}
|
||||
|
||||
-- | Directly concatinate SQL string without whitespaces.
|
||||
-- | Directly concatenate SQL string without whitespaces.
|
||||
(<++>) :: Keyword -> Keyword -> Keyword
|
||||
x <++> y = fromDString $ toDString x <> toDString y
|
||||
|
||||
@ -97,7 +97,7 @@ defineBinOp op a b = mconcat [a, op, b]
|
||||
(|*|) :: Keyword -> Keyword -> Keyword
|
||||
(|*|) = defineBinOp' ", "
|
||||
|
||||
-- | Binary operator for SQL string expression concatination.
|
||||
-- | Binary operator for SQL string expression concatenation.
|
||||
(.||.) :: Keyword -> Keyword -> Keyword
|
||||
(.||.) = defineBinOp "||"
|
||||
|
||||
@ -145,7 +145,7 @@ fold op = d where
|
||||
d [] = mempty
|
||||
d xs@(_:_) = foldr1 op xs
|
||||
|
||||
-- | Define unary operator on 'Keyword' type represeted by specified 'Keyword'.
|
||||
-- | Define unary operator on 'Keyword' type represented by specified 'Keyword'.
|
||||
-- Result is delimited by whitespace like unwords on 'String' list.
|
||||
defineUniOp :: Keyword -> Keyword -> Keyword
|
||||
defineUniOp op e = mconcat [op, e]
|
||||
|
@ -23,7 +23,7 @@ import Data.Semigroup (Semigroup (..))
|
||||
import Data.Monoid (Monoid (..))
|
||||
|
||||
|
||||
-- | Diff String type for low-cost concatination.
|
||||
-- | Diff String type for low-cost concatenation.
|
||||
newtype DString = DString (String -> String)
|
||||
|
||||
-- | Make 'DString' from 'String'
|
||||
@ -147,7 +147,7 @@ a `kappend` b = fromDString $ toDString a `append'` toDString b
|
||||
instance Semigroup Keyword where
|
||||
(<>) = kappend
|
||||
|
||||
-- | 'Keyword' default concatination separate by space.
|
||||
-- | 'Keyword' default concatenation separate by space.
|
||||
instance Monoid Keyword where
|
||||
mempty = fromDString mempty
|
||||
mappend = (<>)
|
||||
|
@ -19,6 +19,6 @@ import Data.Monoid (mconcat)
|
||||
import Language.SQL.Keyword.Internal.Type (Keyword (..), word, wordShow, DString)
|
||||
|
||||
|
||||
-- | Concatinate keywords into 'String' like unwords
|
||||
-- | Concatenate keywords into 'String' like unwords
|
||||
unwordsSQL :: [Keyword] -> String
|
||||
unwordsSQL = wordShow . mconcat
|
||||
|
Loading…
Reference in New Issue
Block a user