stephb9959
2023-01-25 16:15:28 -08:00
parent acdb617d35
commit ce1818c93c
10 changed files with 196 additions and 13 deletions

View File

@@ -17,15 +17,15 @@ namespace OpenWifi {
std::string baseQuery;
if(!nameSearch.empty() || !emailSearch.empty()) {
if(!nameSearch.empty())
baseQuery = fmt::format(" Lower(name) like('%{}%') ", Poco::toLower(nameSearch) );
baseQuery = fmt::format(" Lower(name) like('%{}%') ", ORM::Escape(Poco::toLower(nameSearch)) );
if(!emailSearch.empty())
baseQuery += baseQuery.empty() ? fmt::format(" Lower(email) like('%{}%') ", Poco::toLower(emailSearch))
: fmt::format(" and Lower(email) like('%{}%') ", Poco::toLower(emailSearch));
baseQuery += baseQuery.empty() ? fmt::format(" Lower(email) like('%{}%') ", ORM::Escape(Poco::toLower(emailSearch)))
: fmt::format(" and Lower(email) like('%{}%') ", ORM::Escape(Poco::toLower(emailSearch)));
}
if(QB_.CountOnly) {
std::string whereClause;
if(!operatorId.empty()) {
if(!operatorId.empty() && Utils::ValidUUID(operatorId)) {
whereClause = baseQuery.empty() ? fmt::format(" owner='{}' ", operatorId) :
fmt::format(" owner='{}' and {} ", operatorId, baseQuery);
auto count = StorageService()->SubDB().Count(whereClause);
@@ -35,7 +35,7 @@ namespace OpenWifi {
return ReturnCountOnly(count);
} else if(QB_.Select.empty()) {
std::string whereClause;
if(!operatorId.empty()) {
if(!operatorId.empty() && Utils::ValidUUID(operatorId)) {
whereClause = baseQuery.empty() ? fmt::format(" owner='{}' ", operatorId) :
fmt::format(" owner='{}' and {} ", operatorId, baseQuery);
}