declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
- if (!mysql_real_connect(&d_db, host.empty() ? NULL : host.c_str(),
- user.empty() ? NULL : user.c_str(),
- password.empty() ? NULL : password.c_str(),
- database.empty() ? NULL : database.c_str(),
- port,
- msocket.empty() ? NULL : msocket.c_str(),
- CLIENT_MULTI_RESULTS)) {
-
- throw sPerrorException("Unable to connect to database");
+
+ if (!mysql_real_connect(&d_db, host.empty() ? NULL : host.c_str(),
+ user.empty() ? NULL : user.c_str(),
+ password.empty() ? NULL : password.c_str(),
+ database.empty() ? NULL : database.c_str(),
+ port,
+ msocket.empty() ? NULL : msocket.c_str(),
+ CLIENT_MULTI_RESULTS)) {
+
+ if (retry == 0)
+ throw sPerrorException("Unable to connect to database");
+ --retry;
+ } else {
+ if (retry == 0) {
+ mysql_close(&d_db);
+ throw sPerrorException("Please add 'innodb-read-committed=no' to your configuration, and reconsider your storage engine if it does not support transactions.");