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);
126 values_copy[param.first] = param.second->stringValue();
131 "parameter '" << param.first <<
"' ("
132 << param.second->getPosition() <<
")");
139 auto type_ptr = values_copy.find(
"type");
140 if (type_ptr == values_copy.end()) {
142 "database access parameters must "
143 "include the keyword 'type' to determine type of database "
144 "to be accessed (" << database_config->getPosition() <<
")");
151 string dbtype = type_ptr->second;
152 if ((dbtype !=
"memfile") &&
153 (dbtype !=
"mysql") &&
154 (dbtype !=
"postgresql")) {
157 <<
" (" << value->getPosition() <<
")");
161 if ((lfc_interval < 0) ||
162 (lfc_interval > std::numeric_limits<uint32_t>::max())) {
165 <<
" is out of range, expected value: 0.."
166 << std::numeric_limits<uint32_t>::max()
167 <<
" (" << value->getPosition() <<
")");
171 if ((connect_timeout < 0) ||
172 (connect_timeout > std::numeric_limits<uint32_t>::max())) {
175 <<
" is out of range, expected value: 0.."
176 << std::numeric_limits<uint32_t>::max()
177 <<
" (" << value->getPosition() <<
")");
179 if ((read_timeout < 0) ||
180 (read_timeout > std::numeric_limits<uint32_t>::max())) {
183 <<
" is out of range, expected value: 0.."
184 << std::numeric_limits<uint32_t>::max()
185 <<
" (" << value->getPosition() <<
")");
187 if (read_timeout > 0 && (dbtype !=
"mysql")) {
190 <<
" (" << value->getPosition() <<
")");
192 if ((write_timeout < 0) ||
193 (write_timeout > std::numeric_limits<uint32_t>::max())) {
196 <<
" is out of range, expected value: 0.."
197 << std::numeric_limits<uint32_t>::max()
198 <<
" (" << value->getPosition() <<
")");
200 if (write_timeout > 0 && (dbtype !=
"mysql")) {
203 <<
" (" << value->getPosition() <<
")");
205 if ((tcp_user_timeout < 0) ||
206 (tcp_user_timeout > std::numeric_limits<uint32_t>::max())) {
209 <<
" is out of range, expected value: 0.."
210 << std::numeric_limits<uint32_t>::max()
211 <<
" (" << value->getPosition() <<
")");
213 if (tcp_user_timeout > 0 && (dbtype !=
"postgresql")) {
216 <<
" (" << value->getPosition() <<
")");
221 (port > std::numeric_limits<uint16_t>::max())) {
224 <<
" is out of range, expected value: 0.."
225 << std::numeric_limits<uint16_t>::max()
226 <<
" (" << value->getPosition() <<
")");
230 if ((max_row_errors < 0) ||
231 (max_row_errors > std::numeric_limits<uint32_t>::max())) {
234 <<
" is out of range, expected value: 0.."
235 << std::numeric_limits<uint32_t>::max()
236 <<
" (" << value->getPosition() <<
")");
240 if (max_reconnect_tries < 0) {
243 "max-reconnect-tries cannot be less than zero: ("
244 << value->getPosition() <<
")");
248 if ((reconnect_wait_time < 0) ||
249 (reconnect_wait_time > std::numeric_limits<uint32_t>::max())) {
252 <<
" must be in range 0...MAX_UINT32 (4294967295) "
253 <<
"(" << value->getPosition() <<
")");
260 values_.swap(values_copy);