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
145 return (size < size_);
149 typedef AccessController access_controller;
163 template <
class AccessController = Transaction>
164 class MYSQLPP_EXPORT MaxPacketInsertPolicy
172 MaxPacketInsertPolicy(Connection* con,
int size) :
173 conn_(con), size_(size)
185 MaxPacketInsertPolicy(
int size) :
186 conn_(0), size_(size)
191 ~MaxPacketInsertPolicy() { }
200 template <
class RowT>
201 bool can_add(
int size,
const RowT&
object)
const
207 s <<
",(" <<
object.value_list() <<
")";
208 return (size_ - size) >=
static_cast<int>(s.str().size());
217 typedef AccessController access_controller;
224 #endif // defined(MYSQLPP_DEFINE_INSERT_POLICY_TEMPLATES)
226 #endif // !defined(MYSQLPP_INSERTPOLICY_H)