update function to get clearer debug picture

This commit is contained in:
Dario 2020-07-05 10:50:46 +02:00
parent 07f0f039cf
commit 064fe5fbad

View File

@ -321,15 +321,26 @@ namespace controller {
auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER); auto session = cm->getConnection(CONNECTION_MYSQL_LOGIN_SERVER);
Poco::Data::Statement select(session); Poco::Data::Statement select(session);
std::vector<Poco::Tuple<int,Poco::DateTime>> results; std::vector<Poco::Tuple<int,Poco::DateTime>> results;
int email_checked = 0;
int resend_count = 1;
select << "select u.id, v.created from users as u " select << "select u.id, v.created from users as u "
<< "LEFT JOIN email_opt_in as v ON(u.id = v.user_id) " << "LEFT JOIN email_opt_in as v ON(u.id = v.user_id) "
<< "where u.email_checked = 0 " << "where u.email_checked = ? "
<< "AND v.resend_count <= 1", Poco::Data::Keywords::into(results) << "AND v.resend_count <= ?", Poco::Data::Keywords::use(email_checked), Poco::Data::Keywords::use(resend_count), Poco::Data::Keywords::into(results)
; ;
int result_count = 0;
try { try {
result_count = select.execute();
}
catch (Poco::Exception& ex) {
em->addError(new ParamError(function_name, "mysql error by select", ex.displayText().data()));
em->sendErrorsAsEmail();
//return -1;
}
printf("result_count: %d\n", result_count);
if (result_count > 0) {
auto now = Poco::DateTime(); auto now = Poco::DateTime();
select.execute();
int count_scheduled_at_once = 0; int count_scheduled_at_once = 0;
int count_scheduled = 0; int count_scheduled = 0;
@ -354,11 +365,6 @@ namespace controller {
if (count_scheduled_at_once) printf("scheduled %d verification email resend at once\n", count_scheduled_at_once); if (count_scheduled_at_once) printf("scheduled %d verification email resend at once\n", count_scheduled_at_once);
if (count_scheduled) printf("scheduled %d verification email resend in the next 7 days\n", count_scheduled); if (count_scheduled) printf("scheduled %d verification email resend in the next 7 days\n", count_scheduled);
} }
catch (Poco::Exception& ex) {
em->addError(new ParamError(function_name, "mysql error by select", ex.displayText().data()));
em->sendErrorsAsEmail();
return -1;
}
return 0; return 0;
} }