Deleted switch statement for hashing algorithms, using the integer field directly for the query
This commit is contained in:
committed by
Andreas Steffen
parent
2db719a509
commit
86f1cd15b8
@@ -58,20 +58,6 @@ METHOD(pts_database_t, create_meas_enumerator, enumerator_t*,
|
|||||||
private_pts_database_t *this, char *product, int id, pts_meas_algorithms_t algorithm)
|
private_pts_database_t *this, char *product, int id, pts_meas_algorithms_t algorithm)
|
||||||
{
|
{
|
||||||
enumerator_t *e;
|
enumerator_t *e;
|
||||||
int algo = 0;
|
|
||||||
|
|
||||||
switch(algorithm)
|
|
||||||
{
|
|
||||||
case PTS_MEAS_ALGO_SHA1:
|
|
||||||
algo = 32768;
|
|
||||||
break;
|
|
||||||
case PTS_MEAS_ALGO_SHA256:
|
|
||||||
algo = 16384;
|
|
||||||
break;
|
|
||||||
case PTS_MEAS_ALGO_SHA384:
|
|
||||||
algo = 8192;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* look for all entries belonging to a product and file in file_hashes table */
|
/* look for all entries belonging to a product and file in file_hashes table */
|
||||||
e = this->db->query(this->db,
|
e = this->db->query(this->db,
|
||||||
@@ -79,7 +65,7 @@ METHOD(pts_database_t, create_meas_enumerator, enumerator_t*,
|
|||||||
"JOIN files AS f ON fh.file = f.id "
|
"JOIN files AS f ON fh.file = f.id "
|
||||||
"JOIN products AS p ON fh.product = p.id "
|
"JOIN products AS p ON fh.product = p.id "
|
||||||
"WHERE p.name = ? AND f.id = ? AND fh.algo = ?",
|
"WHERE p.name = ? AND f.id = ? AND fh.algo = ?",
|
||||||
DB_TEXT, product, DB_INT, id, DB_INT, algo, DB_BLOB);
|
DB_TEXT, product, DB_INT, id, DB_INT, algorithm, DB_BLOB);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user