Commit 6f83bebd authored by Benjamin REIS's avatar Benjamin REIS Committed by Benjamin REIS

Revert "Use soci api"

This reverts commit cd704bc8.
parent 3fa414a3
Pipeline #1830 passed with stages
in 17 minutes and 35 seconds
......@@ -282,7 +282,13 @@ void SociAuthDB::getUserWithPhoneWithPool(const string &phone, const string &dom
if(get_user_with_phone_request != "") {
*sql << get_user_with_phone_request, into(user), use(phone, "phone");
} else {
rowset<row> ret = (sql->prepare << get_users_with_phones_request, use(phone, "phones"));
string s = get_users_with_phones_request;
int index = s.find(":phones");
while(index > -1) {
s = s.replace(index, 7, phone);
index = s.find(":phones");
}
rowset<row> ret = (sql->prepare << s);
for (rowset<row>::const_iterator it = ret.begin(); it != ret.end(); ++it) {
row const& row = *it;
user = row.get<string>(0);
......@@ -335,6 +341,13 @@ void SociAuthDB::getUsersWithPhonesWithPool(list<tuple<string, string,AuthDbList
}
}
string s = get_users_with_phones_request;
int index = s.find(":phones");
while(index > -1) {
s = s.replace(index, 7, in.str());
index = s.find(":phones");
}
try {
start = steady_clock::now();
// will grab a connection from the pool. This is thread safe
......@@ -344,7 +357,7 @@ void SociAuthDB::getUsersWithPhonesWithPool(list<tuple<string, string,AuthDbList
SLOGD << "[SOCI] Pool acquired in " << DURATION_MS(start, stop) << "ms";
start = stop;
rowset<row> ret = (sql->prepare << get_users_with_phones_request, use(in.str(), "phones"));
rowset<row> ret = (sql->prepare << s);
stop = steady_clock::now();
SLOGD << "[SOCI] Got users in " << DURATION_MS(start, stop) << "ms";
......@@ -375,6 +388,7 @@ void SociAuthDB::getUsersWithPhonesWithPool(list<tuple<string, string,AuthDbList
} catch (mysql_soci_error const &e) {
stop = steady_clock::now();
SLOGE << "[SOCI] getUsersWithPhonesWithPool MySQL error after " << DURATION_MS(start, stop) << "ms : " << e.err_num_ << " " << e.what();
SLOGE << "[SOCI] MySQL request causing the error was : " << s;
presences.clear();
if (listener) listener->onResults(phones, presences);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment