dbutils: enable variant and benchmark selection with LIKE

This does enable % patterns in variant and benchmark selections, like
it is already implemented in the prune-tool.

Change-Id: I7497bfd588d6ffdf851d767bafc660f4872ae92f
This commit is contained in:
Christian Dietrich
2013-07-03 13:42:55 +02:00
parent 12aec4c1a4
commit c74c8a2e30

View File

@ -88,7 +88,7 @@ int Database::get_variant_id(const std::string &variant, const std::string &benc
int variant_id;
std::stringstream ss;
// FIXME SQL injection possible
ss << "SELECT id FROM variant WHERE variant = '" << variant << "' AND benchmark = '" << benchmark << "'";
ss << "SELECT id FROM variant WHERE variant LIKE '" << variant << "' AND benchmark LIKE '" << benchmark << "'";
MYSQL_RES *variant_id_res = query(ss.str().c_str(), true);
if (!variant_id_res) {
return 0;