56 #if !defined(MYSQLPP_INSERTPOLICY_H)
57 #define MYSQLPP_INSERTPOLICY_H
67 #if defined(MYSQLPP_DEFINE_INSERT_POLICY_TEMPLATES)
76 template <
class AccessController = Transaction>
77 class MYSQLPP_EXPORT RowCountInsertPolicy
81 RowCountInsertPolicy(
unsigned int rows) :
88 ~RowCountInsertPolicy() { }
95 bool can_add(
int,
const RowT&)
97 if (++cur_rows_ > max_rows_) {
107 typedef AccessController access_controller;
110 unsigned int cur_rows_;
111 unsigned const int max_rows_;
122 template <
class AccessController = Transaction>
123 class MYSQLPP_EXPORT SizeThresholdInsertPolicy
127 SizeThresholdInsertPolicy(
int size) :
133 ~SizeThresholdInsertPolicy() { }
142 template <
class RowT>
143 bool can_add(
int size,
const RowT&
object)
const
146 return (size < size_);
150 typedef AccessController access_controller;
164 template <
class AccessController = Transaction>
165 class MYSQLPP_EXPORT MaxPacketInsertPolicy
173 MaxPacketInsertPolicy(Connection* con,
int size) :
174 conn_(con), size_(size)
186 MaxPacketInsertPolicy(
int size) :
187 conn_(0), size_(size)
192 ~MaxPacketInsertPolicy() { }
201 template <
class RowT>
202 bool can_add(
int size,
const RowT&
object)
const
208 s <<
",(" <<
object.value_list() <<
")";
209 return (size_ - size) >=
static_cast<int>(s.str().size());
218 typedef AccessController access_controller;