Poco::Data

template < class T >

class Binding

Library: Data
Package: DataCore
Header: Poco/Data/Binding.h

Description

Binding maps a value or multiple values (see Binding specializations for STL containers as well as type handlers) to database column(s). Values to be bound can be either mapped directly (by reference) or a copy can be created, depending on the value of the copy argument. To pass a reference to a variable, it is recommended to pass it to the intermediate utility function use(), which will create the proper binding. In cases when a reference is passed to binding, the storage it refers to must be valid at the statement execution time. To pass a copy of a variable, constant or string literal, use utility function bind(). Variables can be passed as either copies or references (i.e. using either use() or bind()). Constants, however, can only be passed as copies. this is best achieved using bind() utility function. An attempt to pass a constant by reference shall result in compile-time error.

Inheritance

Direct Base Classes: AbstractBinding

All Base Classes: AbstractBinding

Member Summary

Member Functions: bind, canBind, numOfColumnsHandled, numOfRowsHandled, reset

Inherited Functions: bind, bulkSize, canBind, getBinder, getDirection, isBulk, name, numOfColumnsHandled, numOfRowsHandled, reset, setBinder

Types

Ptr

typedef SharedPtr < Type > Ptr;

Type

typedef Binding < ValType > Type;

ValPtr

typedef SharedPtr < ValType > ValPtr;

ValType

typedef T ValType;

Constructors

Binding inline

explicit Binding(
    T & val,
    const std::string & name = "",
    Direction direction = PD_IN
);

Creates the Binding using the passed reference as bound value. If copy is true, a copy of the value referred to is created.

Destructor

~Binding virtual inline

~Binding();

Destroys the Binding.

Member Functions

bind virtual inline

void bind(
    std::size_t pos
);

canBind virtual inline

bool canBind() const;

numOfColumnsHandled virtual inline

std::size_t numOfColumnsHandled() const;

numOfRowsHandled virtual inline

std::size_t numOfRowsHandled() const;

reset virtual inline

void reset();