relational-query-HDBC-0.1.0.0: HDBC instance of relational join and typed query for HDBC

Portabilityunknown
Stabilityexperimental
Maintainerex8k.hibino@gmail.com
Safe HaskellNone

Database.HDBC.Record.Statement

Description

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

Synopsis

Documentation

data PreparedStatement p a Source

Typed prepared statement type.

untypePrepared :: PreparedStatement p a -> StatementSource

Unsafely untype prepared statement.

unsafePrepareSource

Arguments

:: IConnection conn 
=> conn

Database connection

-> String

Raw SQL String

-> IO (PreparedStatement p a)

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

Run prepare and unsafely make Typed prepared statement.

data BoundStatement a Source

Typed prepared statement which has bound placeholder parameters.

Constructors

BoundStatement 

Fields

bound :: Statement

Untyped prepared statement before executed.

params :: [SqlValue]

Bound parameters.

bind'Source

Arguments

:: RecordToSql SqlValue p

Proof object to convert from parameter type p into SqlValue list.

-> PreparedStatement p a

Prepared query to bind to

-> p

Parameter to bind

-> BoundStatement a

Result parameter bound statement

Typed operation to bind parameters.

bind :: ToSql SqlValue p => PreparedStatement p a -> p -> BoundStatement aSource

Typed operation to bind parameters. Infered RecordToSql is used.

bindTo :: ToSql SqlValue p => p -> PreparedStatement p a -> BoundStatement aSource

Same as bind except for argument is flipped.

data ExecutedStatement a Source

Typed executed statement.

executed :: ExecutedStatement a -> StatementSource

Untyped executed statement.

result :: ExecutedStatement a -> IntegerSource

Result of HDBC execute.

execute :: BoundStatement a -> IO (ExecutedStatement a)Source

Typed execute operation.

prepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> IO (PreparedStatement p ())Source

Generalized prepare inferred from UntypeableNoFetch instance.

executeNoFetch :: BoundStatement () -> IO IntegerSource

Typed execute operation. Only get result.

runPreparedNoFetch :: ToSql SqlValue a => PreparedStatement a () -> a -> IO IntegerSource

Bind parameters, execute statement and get execution result.

runNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> a -> IO IntegerSource

Prepare and run sequence for polymorphic no-fetch statement.

mapNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> [a] -> IO [Integer]Source

Prepare and run it against each parameter list.