MOD: insert is working, but there is already collisions for the md5 of the entire schema and the field was marked as unique. I will investigate if this accurate.
This commit is contained in:
		
							parent
							
								
									5e6fc05b81
								
							
						
					
					
						commit
						246cb522da
					
				|  | @ -8,6 +8,7 @@ import sys | |||
| import logging | ||||
| import sqlite3 as sql | ||||
| from libs.exceptions import FingerprintIndexWrite | ||||
| from libs.exceptions import FingerprintIndexOpen | ||||
| from libs.fingerprint import FingerprintDB | ||||
| 
 | ||||
| # prefixed with "_" so that it will be listed first and visible | ||||
|  | @ -67,6 +68,8 @@ class FingerprintIndex: | |||
|     """ read each file, pull md5, add row to database """ | ||||
|     failCount = 0 | ||||
|     finCount = 0 | ||||
|     # self.db_conn.execute("INSERT INTO md5_index VALUES(?, ?, ?)", ["AAA", "BBB", "CCC"]) | ||||
|     # self.db_conn.execute("INSERT INTO md5_index VALUES('DDD', 'EEE', 'FFF')") | ||||
|     try: | ||||
|       db = FingerprintDB() | ||||
|       files = os.listdir(fp_dir) | ||||
|  | @ -80,22 +83,23 @@ class FingerprintIndex: | |||
|           # print("db_hash=={}".format(db.db_hash)) | ||||
|           # print("table_hashes={}".format(db.table_hashes)) | ||||
|           #md5_all = __createMD5Index(dbht) | ||||
|           return | ||||
|           finCount = finCount+1 | ||||
|         except: | ||||
|           failCount = failCount+1 | ||||
|     except: | ||||
|       pass | ||||
|     finally: | ||||
|       self.db_conn.commit() | ||||
|     logging.info("Completed populating the index. Completed: {}  Failed: {} ".format(str(finCount), str(failCount))) | ||||
| 
 | ||||
|   # | ||||
|   def __insertRecord(self, md5_all, md5_list, filename): | ||||
|     try: | ||||
|       logging.info("INSERT INTO md5_index VALUES(?, ?, ?): {}; {}; {}".format(md5_all, str(md5_list), filename)) | ||||
|       # logging.info("INSERT INTO md5_index VALUES(?, ?, ?): {}; {}; {}".format(md5_all, str(md5_list), filename)) | ||||
|       self.db_conn.execute( | ||||
|         ''' | ||||
|         INSERT INTO md5_index VALUES(?, ?, ?) | ||||
|         ''', (md5_all, str(md5_list), filename)) | ||||
|         ''', [md5_all, ','.join(md5_list), filename]) | ||||
|     except Exception as e: | ||||
|       logging.error("Error inserting a row\n{}".format(e)) | ||||
|       raise FingerprintIndexWrite("Error inserting a row") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 JohnE
						JohnE