more stray queries

This commit is contained in:
Ulf Gebhardt 2021-10-21 05:33:49 +02:00
parent 95ab503626
commit dbae29f47d
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD

View File

@ -446,8 +446,9 @@ namespace controller {
std::vector<Poco::Tuple<int,Poco::DateTime>> results; std::vector<Poco::Tuple<int,Poco::DateTime>> results;
int email_checked = 0; int email_checked = 0;
int resend_count = 1; int resend_count = 1;
select << "select u.id, v.created from users as u " std::string table_name_email_opt_in = "login_email_opt_in";
<< "LEFT JOIN email_opt_in as v ON(u.id = v.user_id) " select << "select u.id, v.created from " << db->getTableName() << " as u "
<< "LEFT JOIN " << table_name_email_opt_in << " as v ON(u.id = v.user_id) "
<< "where u.email_checked = ? " << "where u.email_checked = ? "
<< "AND v.resend_count <= ? " << "AND v.resend_count <= ? "
<< "ORDER BY u.id, v.created " , << "ORDER BY u.id, v.created " ,
@ -525,8 +526,8 @@ namespace controller {
Poco::Data::Statement select(session); Poco::Data::Statement select(session);
std::vector<Poco::Tuple<int, std::string>> results; std::vector<Poco::Tuple<int, std::string>> results;
select << "select id, email from users " select << "select id, email from " << db->getTableName()
<< "where email_hash IS NULL " << " where email_hash IS NULL "
, Poco::Data::Keywords::into(results) , Poco::Data::Keywords::into(results)
; ;
int result_count = 0; int result_count = 0;
@ -556,7 +557,7 @@ namespace controller {
// update db // update db
// reuse connection, I hope it's working // reuse connection, I hope it's working
Poco::Data::Statement update(session); Poco::Data::Statement update(session);
update << "UPDATE users set email_hash = ? where id = ?" update << "UPDATE " << db->getTableName() << " set email_hash = ? where id = ?"
, Poco::Data::Keywords::use(updates); , Poco::Data::Keywords::use(updates);
int updated_count = 0; int updated_count = 0;
try { try {