Project

General

Profile

Bug #3618 » 0001-Add-schema-quoting-in-Auth-Dbo-UserDatabase.patch

Bruce Toll, 10/02/2014 05:30 PM

View differences:

src/Wt/Auth/Dbo/UserDatabase
Wt::Dbo::Transaction t(session_);
setUser(session_.query< Wt::Dbo::ptr<DboType> >
(std::string() +
"select u from \"" + session_.tableName<DboType>() + "\" u "
"join \"" + session_.tableName<AuthIdentityType>() + "\" i "
"on u.id = i." + session_.tableName<DboType>() + "_id")
"select u from " + session_.tableNameQuoted<DboType>() + " u "
"join " + session_.tableNameQuoted<AuthIdentityType>() + " i "
"on u.id = i.\"" + session_.tableName<DboType>() + "_id\"")
.where("i.provider = ?").bind(provider)
.where("i.identity = ?").bind(identity));
t.commit();
......
session_.execute
(std::string() +
"delete from \"" + session_.tableName<AuthIdentityType>() +
"\" where " + session_.tableName<DboType>() + "_id = ?"
"delete from " + session_.tableNameQuoted<AuthIdentityType>() +
" where \"" + session_.tableName<DboType>() + "_id\" = ?"
" and provider = ?").bind(user.id()).bind(provider);
t.commit();
......
Wt::Dbo::Transaction t(session_);
setUser(session_.query< Wt::Dbo::ptr<DboType> >
(std::string() +
"select u from \"" + session_.tableName<DboType>() + "\" u "
"join \"" + session_.tableName<AuthTokenType>() + "\" t "
"on u.id = t." + session_.tableName<DboType>() + "_id")
"select u from " + session_.tableNameQuoted<DboType>() + " u "
"join " + session_.tableNameQuoted<AuthTokenType>() + " t "
"on u.id = t.\"" + session_.tableName<DboType>() + "_id\"")
.where("t.value = ?").bind(hash)
.where("t.expires > ?").bind(WDateTime::currentDateTime()));
t.commit();
(1-1/2)