# Poco::Data

# template < class T >

# class CopyBinding final

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()).

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

### Ptr

using Ptr = SharedPtr < Type >;

### Type

using Type = CopyBinding < ValType >;

### ValPtr

using ValPtr = SharedPtr < ValType >;

### ValType

using ValType = T;

## Constructors

### CopyBinding

explicit CopyBinding(
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

### ~CopyBinding

~CopyBinding() override = default;

Destroys the CopyBinding.

## Member Functions

### bind

void bind(
std::size_t pos
) override;

See also: Poco::Data::AbstractBinding::bind()

### canBind

bool canBind() const override;

See also: Poco::Data::AbstractBinding::canBind()

### numOfColumnsHandled

std::size_t numOfColumnsHandled() const override;

See also: Poco::Data::AbstractBinding::numOfColumnsHandled()

### numOfRowsHandled

std::size_t numOfRowsHandled() const override;

See also: Poco::Data::AbstractBinding::numOfRowsHandled()

### reset

void reset() override;

See also: Poco::Data::AbstractBinding::reset()