Portability | unknown |
---|---|
Stability | experimental |
Maintainer | [email protected] |
Safe Haskell | None |
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 -> Table r -> Pi r r' -> Insert r'
- typedInsert :: Table r -> Pi r 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 rSource
relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> StringSource
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 aSource
Unsafely make typed KeyUpdate
from SQL string.
typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p aSource
typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p rSource
Update type with place-holder parameter p
.
Constructors
Update | |
Fields |
Instances
UntypeableNoFetch Update | |
Show (Update p) | Show update SQL string |
unsafeTypedUpdate :: String -> Update pSource
Unsafely make typed Update
from SQL string.
typedUpdate :: Table r -> UpdateTarget p r -> Update pSource
Make typed Update
from Table
and Restriction
.
typedUpdateTable :: TableDerivable r => Relation () r -> UpdateTarget p r -> Update pSource
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.
restrictedUpdateAllColumnSource
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 -> StringSource
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 aSource
Unsafely make typed Insert
from single insert and chunked insert SQL.
unsafeTypedInsert :: String -> Insert aSource
Unsafely make typed Insert
from single insert SQL.
typedInsert :: Table r -> Pi r r' -> Insert r'Source
derivedInsert :: TableDerivable r => Insert rSource
Infered Insert
.
newtype InsertQuery p Source
InsertQuery type.
Constructors
InsertQuery | |
Fields |
Instances
Show (InsertQuery p) | Show insert SQL string. |
unsafeTypedInsertQuery :: String -> InsertQuery pSource
Unsafely make typed InsertQuery
from SQL string.
typedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery pSource
Make typed InsertQuery
from columns selector Pi
and Table
and Relation
.
derivedInsertQuery :: TableDerivable r => Relation p r -> InsertQuery pSource
Infered InsertQuery
.
insertQuerySQL :: TableDerivable r => Config -> Pi r r' -> Relation p r' -> StringSource
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 pSource
Unsafely make typed Delete
from SQL string.
typedDelete :: Table r -> Restriction p r -> Delete pSource
Make typed Delete
from Table
and Restriction
.
Arguments
:: Table r | |
-> RestrictionContext p r |
|
-> Delete p |
deleteSQL :: Table r -> Restriction p r -> StringSource
Make untyped delete SQL string from Table
and Restriction
.
Generalized interfaces
class UntypeableNoFetch s whereSource
Untype interface for typed no-result type statments
with single type parameter which represents place-holder parameter p
.
Methods
untypeNoFetch :: s p -> StringSource