Method
__insert_detection
(self, cur, diff_id, detection, status)
Source from the content-addressed store, hash-verified
| 204 | self._db.execute(DETECTION_SCHEMA) |
| 205 | |
| 206 | def __insert_detection(self, cur, diff_id, detection, status): |
| 207 | assert status in ("new", "removed") |
| 208 | |
| 209 | cur.execute(""" |
| 210 | INSERT into DETECTIONS ( |
| 211 | is_new, |
| 212 | is_removed, |
| 213 | signature, |
| 214 | score, |
| 215 | type, |
| 216 | data, |
| 217 | diff |
| 218 | ) VALUES (?,?,?,?,?,?,?) |
| 219 | """, [ |
| 220 | (status == "new"), |
| 221 | (status == "removed"), |
| 222 | detection.signature, |
| 223 | detection.score, |
| 224 | detection.name, |
| 225 | json.dumps(detection._asdict(), default=json_encoder), |
| 226 | diff_id |
| 227 | ]) |
| 228 | |
| 229 | def output_diff(self, diffs_analyzer): |
| 230 | cur = self._db.cursor() |
Tested by
no test coverage detected