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 :: Table r -> UpdateTarget p r -> Update p
- typedUpdateTable :: TableDerivable r => Relation () r -> UpdateTarget p r -> Update p
- targetUpdate :: Table r -> UpdateTargetContext p r -> Update p
- targetUpdateTable :: TableDerivable r => Relation () r -> UpdateTargetContext p r -> Update p
- typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p)
- restrictedUpdateAllColumn :: PersistableWidth r => Table r -> RestrictionContext p r -> Update (r, p)
- restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictionContext p r -> Update (r, p)
- updateSQL :: Table r -> UpdateTarget p r -> String
- data Insert a = Insert {}
- unsafeTypedInsert' :: String -> String -> Int -> Insert a
- unsafeTypedInsert :: String -> Insert a
- typedInsert' :: Config -> Pi r r' -> Table r -> Insert r'
- typedInsert :: Pi r r' -> Table r -> Insert r'
- derivedInsert :: TableDerivable r => Insert r
- newtype InsertQuery p = InsertQuery {}
- unsafeTypedInsertQuery :: String -> InsertQuery p
- typedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- derivedInsertQuery :: TableDerivable r => Relation p r -> InsertQuery p
- insertQuerySQL :: TableDerivable r => Config -> Pi r r' -> Relation p r' -> String
- newtype Delete p = Delete {}
- unsafeTypedDelete :: String -> Delete p
- typedDelete :: Table r -> Restriction p r -> Delete p
- restrictedDelete :: Table r -> RestrictionContext p r -> Delete p
- deleteSQL :: 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 |
Instances
UntypeableNoFetch Update | |
Show (Update p) | Show update SQL string |
unsafeTypedUpdate :: String -> Update p Source
Unsafely make typed Update
from SQL string.
typedUpdate :: Table r -> UpdateTarget p r -> Update p Source
Make typed Update
from Table
and Restriction
.
typedUpdateTable :: TableDerivable r => Relation () r -> UpdateTarget p r -> Update p Source
Arguments
:: Table r | |
-> UpdateTargetContext p r |
|
-> Update p |
Arguments
:: TableDerivable r | |
=> Relation () r | |
-> UpdateTargetContext p r |
|
-> Update p |
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 | |
-> RestrictionContext p r |
|
-> Update (r, p) |
restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictionContext p r -> Update (r, p) Source
updateSQL :: Table r -> UpdateTarget p r -> String Source
Make untyped update SQL string from Table
and Restriction
.
Typed insert statement
Insert type to insert record type a
.
Constructors
Insert | |
Fields |
Instances
UntypeableNoFetch Insert | |
Show (Insert a) | Show insert SQL string. |
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 :: Pi r r' -> Table r -> Insert r' Source
derivedInsert :: TableDerivable r => Insert r Source
Infered Insert
.
newtype InsertQuery p Source
InsertQuery type.
Constructors
InsertQuery | |
Fields |
Instances
Show (InsertQuery p) | Show insert SQL string. |
unsafeTypedInsertQuery :: String -> InsertQuery p Source
Unsafely make typed InsertQuery
from SQL string.
typedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p Source
Make typed InsertQuery
from columns selector Pi
and Table
and Relation
.
derivedInsertQuery :: TableDerivable r => Relation p r -> InsertQuery p Source
Infered InsertQuery
.
insertQuerySQL :: TableDerivable r => Config -> Pi r r' -> Relation p r' -> String Source
Typed delete statement
Delete type with place-holder parameter p
.
Constructors
Delete | |
Fields |
Instances
UntypeableNoFetch Delete | |
Show (Delete p) | Show delete SQL string |
unsafeTypedDelete :: String -> Delete p Source
Unsafely make typed Delete
from SQL string.
typedDelete :: Table r -> Restriction p r -> Delete p Source
Make typed Delete
from Table
and Restriction
.
Arguments
:: Table r | |
-> RestrictionContext p r |
|
-> Delete p |
deleteSQL :: 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