relational-query-0.0.1.2: Typeful, Modular, Relational, algebraic query engine

Copyright2013 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Database.Relational.Query.Type

Contents

Description

This module defines typed SQL.

Synopsis

Typed query statement

newtype Query p a Source

Query type with place-holder parameter p and query result type a.

Constructors

Query 

Fields

untypeQuery :: String
 

Instances

Show (Query p a)

Show query SQL string

unsafeTypedQuery Source

Arguments

:: String

Query SQL to type

-> Query p a

Typed result

Unsafely make typed Query from SQL string.

relationalQuery' :: Relation p r -> QuerySuffix -> Query p r Source

From Relation into typed Query with suffix SQL words.

relationalQuery :: Relation p r -> Query p r Source

From Relation into typed Query.

relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String Source

From Relation into untyped SQL query string.

Typed update statement

data KeyUpdate p a Source

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

updateKey :: Pi a p
 
untypeKeyUpdate :: String
 

Instances

Show (KeyUpdate p a)

Show update SQL string

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

Make typed KeyUpdate from Table and key indexes.

typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r Source

Make typed KeyUpdate object using derived info specified by Relation type.

newtype Update p Source

Update type with place-holder parameter p.

Constructors

Update 

Fields

untypeUpdate :: String
 

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

Make typed Update object using derived info specified by Relation type.

targetUpdate Source

Arguments

:: Table r 
-> UpdateTargetContext p r

Target monad context

-> Update p 

Directly make typed Update from Table and Target monad context.

targetUpdateTable Source

Arguments

:: TableDerivable r 
=> Relation () r 
-> UpdateTargetContext p r

Target monad context

-> Update p 

Directly make typed Update from Relation and Target monad context.

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

Restrict monad context

-> Update (r, p) 

Directly make typed Update from Table and Restrict monad context. Update target is all column.

restrictedUpdateTableAllColumn :: (PersistableWidth r, TableDerivable r) => Relation () r -> RestrictionContext p r -> Update (r, p) Source

Directly make typed Update from Table and Restrict monad context. Update target is all column.

updateSQL :: Table r -> UpdateTarget p r -> String Source

Make untyped update SQL string from Table and Restriction.

Typed insert statement

data Insert a Source

Insert type to insert record type a.

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' :: Config -> Pi r r' -> Table r -> Insert r' Source

Make typed Insert from columns selector Pi and Table.

typedInsert :: Pi r r' -> Table r -> Insert r' Source

Make typed Insert from columns selector Pi and Table.

newtype InsertQuery p Source

InsertQuery type.

Constructors

InsertQuery 

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.

insertQuerySQL :: TableDerivable r => Config -> Pi r r' -> Relation p r' -> String Source

Make untyped insert select SQL string from Table and Relation.

Typed delete statement

newtype Delete p Source

Delete type with place-holder parameter p.

Constructors

Delete 

Fields

untypeDelete :: String
 

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.

restrictedDelete Source

Arguments

:: Table r 
-> RestrictionContext p r

Restrict monad context.

-> Delete p 

Directly make typed Delete from Table and Restrict monad context.

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