haskelldb-2.0.1: A library of combinators for generating and executing SQL statements.

Portabilitynon-portable
Stabilityexperimental
Maintainerhaskelldb-users@lists.sourceforge.net

Database.HaskellDB.Sql.Default

Contents

Description

Default SQL generation.

Synopsis

Documentation

defaultSqlQuery :: SqlGenerator -> PrimQuery -> SqlSelectSource

Creates a SqlSelect based on the PrimQuery supplied. Corresponds to the SQL statement SELECT.

defaultSqlUpdateSource

Arguments

:: SqlGenerator 
-> TableName

Name of the table to update.

-> [PrimExpr]

Conditions which must all be true for a row to be updated.

-> Assoc

Update the data with this.

-> SqlUpdate 

Creates a SqlUpdate. Corresponds to the SQL statement UPDATE which updates data in a table.

defaultSqlDeleteSource

Arguments

:: SqlGenerator 
-> TableName

Name of the table

-> [PrimExpr]

Criteria which must all be true for a row to be deleted.

-> SqlDelete 

Creates a SqlDelete. Corresponds to the SQL statement DELETE which deletes rows in a table.

defaultSqlInsertSource

Arguments

:: SqlGenerator 
-> TableName

Name of the table

-> Assoc

What to insert.

-> SqlInsert 

Creates a SqlInsert.

defaultSqlInsertQuerySource

Arguments

:: SqlGenerator 
-> TableName

Name of the table

-> PrimQuery

What to insert

-> SqlInsert 

Creates a SqlInsert. Corresponds to the SQL statement INSERT INTO which is used to insert new rows in a table.

defaultSqlCreateDBSource

Arguments

:: SqlGenerator 
-> String

name of the database.

-> SqlCreate 

Use this to create a SqlCreate data type corresponding to the SQL statement CREATE DATABASE which creates a new database.

defaultSqlCreateTableSource

Arguments

:: SqlGenerator 
-> TableName

name of the table to be created.

-> [(Attribute, FieldDesc)]

Column descriptions

-> SqlCreate 

Use this to create a SqlCreate data type corresponding to the SQL statement CREATE which creates a new table.

defaultSqlDropDB :: SqlGenerator -> String -> SqlDropSource

Creates a SqlDrop that delete the database with the name given as the first argument.

defaultSqlDropTable :: SqlGenerator -> TableName -> SqlDropSource

Creates a SqlDrop that delete the database named in the first argument.

defaultSqlGroup :: SqlGenerator -> Assoc -> SqlSelect -> SqlSelectSource

Ensures the groupby value on the SqlSelect either preserves existing grouping or that it will group on all columns (i.e, Mark == All).

Utilities

toSqlSelect :: SqlSelect -> SqlSelectSource

Make sure our SqlSelect statement is really a SqlSelect and not another constructor.