# MaxPacketInsertPolicy< AccessController > Class Template Reference

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

`#include <insertpolicy.h>`

List of all members.

## Public Types

typedef AccessController | access_controller
| Alias for our access controller type.

## Public Member Functions

| MaxPacketInsertPolicy (Connection *con, int size)
| Constructor.
| MaxPacketInsertPolicy (int size)
| Constructor.
| ~MaxPacketInsertPolicy ()
| Destructor.
template<class RowT>
bool | can_add (int size, const RowT &object) const
| Can we add another object to the query?

## Detailed Description

### template<class AccessController = Transaction>
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.

This differs from the SizeThresholdInsertPolicy in that it builds the VALUES expression and checks whether it would cause the length of the INSERT statement to exceed the maximum size.

## Constructor & Destructor Documentation

template<class AccessController = Transaction>

MaxPacketInsertPolicy< AccessController >::MaxPacketInsertPolicy | ( | Connection * | con,
|  | int | size |
| ) |  |  | `[inline]`

Constructor.

Parameters:

  | con | connection object used for escaping text
  | size | the maximum allowed size for an INSERT statement

template<class AccessController = Transaction>

MaxPacketInsertPolicy< AccessController >::MaxPacketInsertPolicy | ( | int | size | ) | `[inline]`

Constructor.

This version does not use a Connection* so it will not be able to take the character set into account when escaping the text.

Parameters:

  | size | the maximum allowed size for an INSERT statement

## Member Function Documentation

template<class AccessController = Transaction>
template<class RowT>

bool MaxPacketInsertPolicy< AccessController >::can_add | ( | int | size,
|  | const RowT & | object |
| ) |  |  | const`[inline]`

Can we add another object to the query?

Parameters:

  | size | current length of the INSERT statement
  | object | the SSQLS object to be added

Return values:

  | true | if the object is allowed to be added to the INSERT statement

The documentation for this class was generated from the following file:

- insertpolicy.h