50 int64_t lfc_interval = 0;
51 int64_t connect_timeout = 0;
52 int64_t read_timeout = 0;
53 int64_t write_timeout = 0;
54 int64_t tcp_user_timeout = 0;
56 int64_t max_reconnect_tries = 0;
57 int64_t reconnect_wait_time = 0;
58 int64_t max_row_errors = 0;
61 for (
auto const& param : database_config->mapValue()) {
63 if ((param.first ==
"persist") ||
64 (param.first ==
"readonly") ||
65 (param.first ==
"retry-on-startup")) {
66 values_copy[param.first] = (param.second->boolValue() ?
69 }
else if (param.first ==
"lfc-interval") {
70 lfc_interval = param.second->intValue();
71 values_copy[param.first] =
72 boost::lexical_cast<std::string>(lfc_interval);
74 }
else if (param.first ==
"connect-timeout") {
75 connect_timeout = param.second->intValue();
76 values_copy[param.first] =
77 boost::lexical_cast<std::string>(connect_timeout);
79 }
else if (param.first ==
"read-timeout") {
80 read_timeout = param.second->intValue();
81 values_copy[param.first] =
82 boost::lexical_cast<std::string>(read_timeout);
84 }
else if (param.first ==
"write-timeout") {
85 write_timeout = param.second->intValue();
86 values_copy[param.first] =
87 boost::lexical_cast<std::string>(write_timeout);
89 }
else if (param.first ==
"tcp-user-timeout") {
90 tcp_user_timeout = param.second->intValue();
91 values_copy[param.first] =
92 boost::lexical_cast<std::string>(tcp_user_timeout);
94 }
else if (param.first ==
"max-reconnect-tries") {
95 max_reconnect_tries = param.second->intValue();
96 values_copy[param.first] =
97 boost::lexical_cast<std::string>(max_reconnect_tries);
99 }
else if (param.first ==
"reconnect-wait-time") {
100 reconnect_wait_time = param.second->intValue();
101 values_copy[param.first] =
102 boost::lexical_cast<std::string>(reconnect_wait_time);
104 }
else if (param.first ==
"port") {
105 port = param.second->intValue();
106 values_copy[param.first] =
107 boost::lexical_cast<std::string>(port);
109 }
else if (param.first ==
"max-row-errors") {
110 max_row_errors = param.second->intValue();
111 values_copy[param.first] =
112 boost::lexical_cast<std::string>(max_row_errors);
127 values_copy[param.first] = param.second->stringValue();
132 "parameter '" << param.first <<
"' ("
133 << param.second->getPosition() <<
")");
140 auto type_ptr = values_copy.find(
"type");
141 if (type_ptr == values_copy.end()) {
143 "database access parameters must "
144 "include the keyword 'type' to determine type of database "
145 "to be accessed (" << database_config->getPosition() <<
")");
152 string dbtype = type_ptr->second;
153 if ((dbtype !=
"memfile") &&
154 (dbtype !=
"mysql") &&
155 (dbtype !=
"postgresql")) {
158 <<
" (" << value->getPosition() <<
")");
162 if ((lfc_interval < 0) ||
163 (lfc_interval > std::numeric_limits<uint32_t>::max())) {
166 <<
" is out of range, expected value: 0.."
167 << std::numeric_limits<uint32_t>::max()
168 <<
" (" << value->getPosition() <<
")");
172 if ((connect_timeout < 0) ||
173 (connect_timeout > std::numeric_limits<uint32_t>::max())) {
176 <<
" is out of range, expected value: 0.."
177 << std::numeric_limits<uint32_t>::max()
178 <<
" (" << value->getPosition() <<
")");
180 if ((read_timeout < 0) ||
181 (read_timeout > std::numeric_limits<uint32_t>::max())) {
184 <<
" is out of range, expected value: 0.."
185 << std::numeric_limits<uint32_t>::max()
186 <<
" (" << value->getPosition() <<
")");
188 if (read_timeout > 0 && (dbtype !=
"mysql")) {
191 <<
" (" << value->getPosition() <<
")");
193 if ((write_timeout < 0) ||
194 (write_timeout > std::numeric_limits<uint32_t>::max())) {
197 <<
" is out of range, expected value: 0.."
198 << std::numeric_limits<uint32_t>::max()
199 <<
" (" << value->getPosition() <<
")");
201 if (write_timeout > 0 && (dbtype !=
"mysql")) {
204 <<
" (" << value->getPosition() <<
")");
206 if ((tcp_user_timeout < 0) ||
207 (tcp_user_timeout > std::numeric_limits<uint32_t>::max())) {
210 <<
" is out of range, expected value: 0.."
211 << std::numeric_limits<uint32_t>::max()
212 <<
" (" << value->getPosition() <<
")");
214 if (tcp_user_timeout > 0 && (dbtype !=
"postgresql")) {
217 <<
" (" << value->getPosition() <<
")");
222 (port > std::numeric_limits<uint16_t>::max())) {
225 <<
" is out of range, expected value: 0.."
226 << std::numeric_limits<uint16_t>::max()
227 <<
" (" << value->getPosition() <<
")");
231 if ((max_row_errors < 0) ||
232 (max_row_errors > std::numeric_limits<uint32_t>::max())) {
235 <<
" is out of range, expected value: 0.."
236 << std::numeric_limits<uint32_t>::max()
237 <<
" (" << value->getPosition() <<
")");
241 if (max_reconnect_tries < 0) {
244 "max-reconnect-tries cannot be less than zero: ("
245 << value->getPosition() <<
")");
249 if ((reconnect_wait_time < 0) ||
250 (reconnect_wait_time > std::numeric_limits<uint32_t>::max())) {
253 <<
" must be in range 0...MAX_UINT32 (4294967295) "
254 <<
"(" << value->getPosition() <<
")");
261 values_.swap(values_copy);