- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Macros
insertpolicy.h File Reference

Declares the InsertPolicy classes. More...

Go to the source code of this file.

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