relational-query-HDBC-0.4.0.0: HDBC instance of relational-query and typed query interface for HDBC

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

Database.HDBC.Record.Query

Description

This module provides typed Query running sequence which intermediate structres are typed.

Synopsis

Documentation

type PreparedQuery p a = PreparedStatement p a Source

Typed prepared query type.

prepare Source

Arguments

:: IConnection conn 
=> conn

Database connection

-> Query p a

Typed query

-> IO (PreparedQuery p a)

Result typed prepared query with parameter type p and result type a

Typed prepare query operation.

prepareQuery Source

Arguments

:: IConnection conn 
=> conn

Database connection

-> Query p a

Typed query

-> IO (PreparedQuery p a)

Result typed prepared query with parameter type p and result type a

Same as prepare.

withPrepareQuery Source

Arguments

:: IConnection conn 
=> conn

Database connection

-> Query p a

Typed query

-> (PreparedQuery p a -> IO b)

Body action to use prepared statement

-> IO b

Result action

Bracketed prepare operation.

fetch :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a) Source

Fetch a record.

fetchAll :: FromSql SqlValue a => ExecutedStatement a -> IO [a] Source

Lazily Fetch all records.

fetchAll' :: FromSql SqlValue a => ExecutedStatement a -> IO [a] Source

Strict version of fetchAll.

listToUnique :: [a] -> IO (Maybe a) Source

Fetch expecting result records is unique.

fetchUnique :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a) Source

Fetch all records but get only first record. Expecting result records is unique.

fetchUnique' :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a) Source

Fetch all records but get only first record. Expecting result records is unique. Error when records count is more than one.

runStatement :: FromSql SqlValue a => BoundStatement a -> IO [a] Source

Execute statement and lazily fetch all records.

runPreparedQuery Source

Arguments

:: (ToSql SqlValue p, FromSql SqlValue a) 
=> PreparedQuery p a

Statement to bind to

-> p

Parameter type

-> IO [a]

Action to get records

Bind parameters, execute statement and lazily fetch all records.

runPreparedQuery' Source

Arguments

:: (ToSql SqlValue p, FromSql SqlValue a) 
=> PreparedQuery p a

Statement to bind to

-> p

Parameter type

-> IO [a]

Action to get records

Strict version of runPreparedQuery.

runQuery Source

Arguments

:: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) 
=> conn

Database connection

-> Query p a

Query to get record type a requires parameter p

-> p

Parameter type

-> IO [a]

Action to get records

Prepare SQL, bind parameters, execute statement and lazily fetch all records.

runQuery' Source

Arguments

:: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) 
=> conn

Database connection

-> Query p a

Query to get record type a requires parameter p

-> p

Parameter type

-> IO [a]

Action to get records

Strict version of runQuery.