(self, diffs_analyzer)
| 227 | ]) |
| 228 | |
| 229 | def output_diff(self, diffs_analyzer): |
| 230 | cur = self._db.cursor() |
| 231 | try: |
| 232 | for d in self.filtered(diffs_analyzer.diffs): |
| 233 | data = d.as_dict() |
| 234 | |
| 235 | |
| 236 | cur.execute(""" |
| 237 | INSERT INTO diffs ( |
| 238 | operation, |
| 239 | a_ref, |
| 240 | b_ref, |
| 241 | a_size, |
| 242 | b_size, |
| 243 | a_mime, |
| 244 | b_mime, |
| 245 | a_md5, |
| 246 | b_md5, |
| 247 | similarity |
| 248 | ) VALUES (?,?,?,?,?,?,?,?,?,?) |
| 249 | """, [ |
| 250 | data["operation"], |
| 251 | data.get("a_ref"), |
| 252 | data.get("b_ref"), |
| 253 | data.get("a_size"), |
| 254 | data.get("b_size"), |
| 255 | data.get("a_mime"), |
| 256 | data.get("b_mime"), |
| 257 | data.get("a_md5"), |
| 258 | data.get("b_md5"), |
| 259 | data["similarity"] |
| 260 | ]) |
| 261 | |
| 262 | diff_id = cur.lastrowid |
| 263 | |
| 264 | if d.diff and self.patch: |
| 265 | cur.execute("INSERT INTO patches (diff, patch) VALUES (?,?)", [diff_id, d.diff]) |
| 266 | |
| 267 | if d.new_detections: |
| 268 | for detection in d.new_detections: |
| 269 | self.__insert_detection( |
| 270 | cur=cur, |
| 271 | diff_id = diff_id, |
| 272 | detection=detection, |
| 273 | status="new" |
| 274 | ) |
| 275 | |
| 276 | if d.removed_detections: |
| 277 | for detection in d.removed_detections: |
| 278 | self.__insert_detection( |
| 279 | cur=cur, |
| 280 | diff_id=diff_id, |
| 281 | detection=detection, |
| 282 | status="removed" |
| 283 | ) |
| 284 | |
| 285 | except: |
| 286 | self._db.rollback() |
nothing calls this directly
no test coverage detected