# Poco::Data::PostgreSQL

# class StatementExecutor

Library: Data/PostgreSQL
Package: PostgreSQL
Header: Poco/Data/PostgreSQL/StatementExecutor.h

## Description

PostgreSQL statement executor.

## Member Summary

Member Functions: bindParams, columnsReturned, execute, fetch, getAffectedRowCount, metaColumn, operator PGresult *, prepare, resultColumn, state

## Enumerations

### State

STMT_INITED

STMT_COMPILED

STMT_EXECUTED

## Constructors

### StatementExecutor

explicit StatementExecutor(
SessionHandle & aSessionHandle,
bool binaryExtraction
);

Creates the StatementExecutor.

## Destructor

### ~StatementExecutor

~StatementExecutor();

Destroys the StatementExecutor.

## Member Functions

### bindParams

void bindParams(
const InputParameterVector & anInputParameterVector
);

Binds the params - REQUIRED if the statement has input parameters/placeholders Pointer and list elements must stay valid for the lifetime of the StatementExecutor!

### columnsReturned

std::size_t columnsReturned() const;

get the count of columns returned by the statement

### execute

void execute();

Executes the statement.

### fetch

bool fetch();

Fetches the data for the current row

### getAffectedRowCount

std::size_t getAffectedRowCount() const;

get the count of rows affected by the statement

### metaColumn

const MetaColumn & metaColumn(
std::size_t aPosition
) const;

Returns the reference to the specified metacolumn - 0 based

### operator PGresult *

operator PGresult * ();

Cast operator to native result handle type.

### prepare

void prepare(
const std::string & aSQLStatement
);

Prepares the statement for execution.

### resultColumn

const OutputParameter & resultColumn(
std::size_t aPosition
) const;

Returns the reference to the specified result - 0 based

### state

State state() const;

Returns the current state.