limit results at the sql level.

This commit is contained in:
Kevin Whitaker
2017-02-23 21:58:20 -05:00
parent f389ebaf40
commit 4e34ce5d21

View File

@@ -140,7 +140,7 @@ void RequestInterface::searchClicked()
}
//Do a like search on title, artist, and album on DB
Wt::Dbo::collection<Wt::Dbo::ptr<AudioTrack>> trackOptions = sqlSession.find<AudioTrack>(std::string("where tracks.name like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.artist like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.album like \"%")+searchBox->text().toUTF8()+std::string("%\""));
Wt::Dbo::collection<Wt::Dbo::ptr<AudioTrack>> trackOptions = sqlSession.find<AudioTrack>(std::string("where tracks.name like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.artist like \"%")+searchBox->text().toUTF8()+std::string("%\" OR tracks.album like \"%")+searchBox->text().toUTF8()+std::string("%\"")).limit(49);
//Make sure all items are gone
for(RequestItem* item: foundItems)
@@ -167,7 +167,7 @@ void RequestInterface::searchClicked()
}
else
{
searchBox->setText("Not enough/too many results");
searchBox->setText("Not enough results");
}
searchTransaction.commit();
}