| Copyright | 2013 Kei Hibino | 
|---|---|
| License | BSD3 | 
| Maintainer | [email protected] | 
| Stability | experimental | 
| Portability | unknown | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
Database.Relational.Query.Type
Contents
Description
This module defines typed SQL.
- newtype Query p a = Query {}
- unsafeTypedQuery :: String -> Query p a
- relationalQuery' :: Relation p r -> QuerySuffix -> Query p r
- relationalQuery :: Relation p r -> Query p r
- relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String
- data KeyUpdate p a = KeyUpdate {- updateKey :: Pi a p
- untypeKeyUpdate :: String
 
- unsafeTypedKeyUpdate :: Pi a p -> String -> KeyUpdate p a
- typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a
- typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r
- newtype Update p = Update {}
- unsafeTypedUpdate :: String -> Update p
- typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p
- typedUpdate :: Table r -> UpdateTarget p r -> Update p
- derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p
- derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p
- typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p)
- restrictedUpdateAllColumn :: PersistableWidth r => Table r -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- updateSQL :: Config -> Table r -> UpdateTarget p r -> String
- data Insert a = Insert {- untypeInsert :: String
- chunkedInsert :: Maybe (String, Int)
 
- untypeChunkInsert :: Insert a -> String
- chunkSizeOfInsert :: Insert a -> Int
- unsafeTypedInsert' :: String -> String -> Int -> Insert a
- unsafeTypedInsert :: String -> Insert a
- typedInsert' :: Config -> Table r -> Pi r r' -> Insert r'
- typedInsert :: Table r -> Pi r r' -> Insert r'
- derivedInsert :: TableDerivable r => Pi r r' -> Insert r'
- typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p
- typedInsertValue :: Table r -> InsertTarget p r -> Insert p
- derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
- derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
- newtype InsertQuery p = InsertQuery {}
- unsafeTypedInsertQuery :: String -> InsertQuery p
- typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- insertQuerySQL :: Config -> Table r -> Pi r r' -> Relation p r' -> String
- newtype Delete p = Delete {}
- unsafeTypedDelete :: String -> Delete p
- typedDelete' :: Config -> Table r -> Restriction p r -> Delete p
- typedDelete :: Table r -> Restriction p r -> Delete p
- derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p
- derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p
- deleteSQL :: Config -> Table r -> Restriction p r -> String
- class UntypeableNoFetch s where- untypeNoFetch :: s p -> String
 
Typed query statement
Query type with place-holder parameter p and query result type a.
Constructors
| Query | |
| Fields | |
Unsafely make typed Query from SQL string.
relationalQuery' :: Relation p r -> QuerySuffix -> Query p r Source
relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String Source
From Relation into untyped SQL query string.
Typed update statement
Update type with key type p and update record type a.
   Columns to update are record columns other than key columns,
   So place-holder parameter type is the same as record type a.
Constructors
| KeyUpdate | |
| Fields 
 | |
unsafeTypedKeyUpdate :: Pi a p -> String -> KeyUpdate p a Source
Unsafely make typed KeyUpdate from SQL string.
typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a Source
typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r Source
Update type with place-holder parameter p.
Constructors
| Update | |
| Fields | |
unsafeTypedUpdate :: String -> Update p Source
Unsafely make typed Update from SQL string.
typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p Source
Make typed Update from Config, Table and UpdateTarget.
typedUpdate :: Table r -> UpdateTarget p r -> Update p Source
Make typed Update using defaultConfig, Table and UpdateTarget.
derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p Source
Make typed Update from Config, derived table and AssignStatement
derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p Source
Make typed Update from defaultConfig, derived table and AssignStatement
typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p) Source
Make typed Update from Table and Restriction.
   Update target is all column.
restrictedUpdateAllColumn Source
Arguments
| :: PersistableWidth r | |
| => Table r | |
| -> RestrictedStatement r (PlaceHolders p) | 
 | 
| -> Update (r, p) | 
restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictedStatement r (PlaceHolders p) -> Update (r, p) Source
updateSQL :: Config -> Table r -> UpdateTarget p r -> String Source
Make untyped update SQL string from Table and UpdateTarget.
Typed insert statement
Insert type to insert record type a.
Constructors
| Insert | |
| Fields 
 | |
untypeChunkInsert :: Insert a -> String Source
Statement to use chunked insert
chunkSizeOfInsert :: Insert a -> Int Source
Size to use chunked insert
unsafeTypedInsert' :: String -> String -> Int -> Insert a Source
Unsafely make typed Insert from single insert and chunked insert SQL.
unsafeTypedInsert :: String -> Insert a Source
Unsafely make typed Insert from single insert SQL.
typedInsert :: Table r -> Pi r r' -> Insert r' Source
derivedInsert :: TableDerivable r => Pi r r' -> Insert r' Source
Table type inferred Insert.
typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p Source
Make typed Insert from Config, Table and monadic builded InsertTarget object.
typedInsertValue :: Table r -> InsertTarget p r -> Insert p Source
Make typed Insert from Table and monadic builded InsertTarget object.
derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p Source
derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p Source
Make typed Insert from defaultConfig, derived table and monadic builded Register object.
newtype InsertQuery p Source
InsertQuery type.
Constructors
| InsertQuery | |
| Fields | |
Instances
| UntypeableNoFetch InsertQuery Source | |
| Show (InsertQuery p) Source | Show insert SQL string. | 
unsafeTypedInsertQuery :: String -> InsertQuery p Source
Unsafely make typed InsertQuery from SQL string.
typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source
Make typed InsertQuery from columns selector Table, Pi and Relation with configuration parameter.
typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p Source
Make typed InsertQuery from columns selector Table, Pi and Relation.
derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p Source
Table type inferred InsertQuery.
Typed delete statement
Delete type with place-holder parameter p.
Constructors
| Delete | |
| Fields | |
unsafeTypedDelete :: String -> Delete p Source
Unsafely make typed Delete from SQL string.
typedDelete' :: Config -> Table r -> Restriction p r -> Delete p Source
Make typed Delete from Config, Table and Restriction.
typedDelete :: Table r -> Restriction p r -> Delete p Source
Make typed Delete from Table and Restriction.
derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p Source
derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p Source
Make typed Delete from defaultConfig, derived table and RestrictContext
deleteSQL :: Config -> Table r -> Restriction p r -> String Source
Make untyped delete SQL string from Table and Restriction.
Generalized interfaces
class UntypeableNoFetch s where Source
Untype interface for typed no-result type statments
   with single type parameter which represents place-holder parameter p.
Methods
untypeNoFetch :: s p -> String Source