- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# insertpolicy.h File Reference

Declares the InsertPolicy classes. More...

Go to the source code of this file.

## Classes
class | RowCountInsertPolicy< AccessController >
| An insert policy object that triggers a new INSERT statement after a given number of rows have been inserted. More...
class | SizeThresholdInsertPolicy< AccessController >
| An insert policy object that triggers a new INSERT statement after a size threshold for the length of the INSERT statement is exceeded. More...
class | MaxPacketInsertPolicy< AccessController >
| An insert policy object that triggers a new INSERT statement if the object to be added would cause the statement to exceed a maximum size. More...

## Detailed Description

Declares the InsertPolicy classes.

One creates an insert policy object to control how Query::insertfrom() builds queries from collections of SSQLS objects. Policy objects are what cause Query::insertfrom() to have different insertion behavior than Query::insert(iter, iter)

These templates use a class called the AccessController, which is a stand-in for the mysqlpp::Transaction class and defaults to the Transaction class. Since some of the InsertPolicy objects (SizeThresholdInsertPolicy and MaxPacketInsertPolicy) may cause Query::insertfrom() to issue multiple SQL statements to perform the insertion of all the objects in the container, and a failure in one of these statements would leave the table in an indeterminate state, the whole operation is wrapped in a transaction.

However, a transaction may not be desired if the calling code is managing transactions, or transactions are not being used for some other reason. In this case, the template can be instantiated with the NoTransaction class. It provides the complete Transaction class interface, while doing nothing.

Where possible, you should use one of the provided insert policy classes, but you can define your own if you need a behavior that the provided set doesn't include.

This file is not meant to be included in end-user code. It's included in Query's public interface, since it is only used with Query::insertfrom(). You access it as Query::InsertPolicy<T>