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

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

Database.HDBC.Record.Statement

Description

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

Synopsis

Documentation

data PreparedStatement p a #

Typed prepared statement type.

untypePrepared :: PreparedStatement p a -> Statement #

Unsafely untype prepared statement.

unsafePrepare #

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.

finish :: PreparedStatement p a -> IO () #

Close PreparedStatement. Useful for connection pooling cases.

withUnsafePrepare #

Arguments

:: IConnection conn 
=> conn

Database connection

-> String

Raw SQL String

-> (PreparedStatement p a -> IO b) 
-> IO b 

Bracketed prepare operation. Unsafely make Typed prepared statement.

withPrepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> (PreparedStatement p () -> IO a) -> IO a #

Bracketed prepare operation. Generalized prepare inferred from UntypeableNoFetch instance.

data BoundStatement a #

Typed prepared statement which has bound placeholder parameters.

Constructors

BoundStatement 

Fields

bind' #

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 a #

Typed operation to bind parameters. Inferred RecordToSql is used.

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

Same as bind except for argument is flipped.

data ExecutedStatement a #

Typed executed statement.

executed :: ExecutedStatement a -> Statement #

Untyped executed statement.

result :: ExecutedStatement a -> Integer #

Result of HDBC execute.

executeBound :: BoundStatement a -> IO (ExecutedStatement a) #

Typed execute operation.

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

Warning: Use executeBound instead of this. This name will be used for executePrepared function in future release.

Use executeBound instead of this. WARNING! This name will be used for executePrepared function in future release.

executePrepared :: ToSql SqlValue p => PreparedStatement p a -> p -> IO (ExecutedStatement a) #

Bind parameters, execute prepared statement and get executed statement.

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

Generalized prepare inferred from UntypeableNoFetch instance.

executeBoundNoFetch :: BoundStatement () -> IO Integer #

Typed execute operation. Only get result.

executeNoFetch :: BoundStatement () -> IO Integer #

Use executeBoundNoFetch instead of this. WARNING! This name will be used for runPreparedNoFetch function in future release.

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

Bind parameters, execute prepared statement and get execution result.

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

Prepare and run sequence for polymorphic no-fetch statement.

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

Prepare and run it against each parameter list.