FIX: fixed the MD5 cmoparison
This commit is contained in:
parent
2271075114
commit
0862011ee6
|
@ -6,6 +6,7 @@ import json
|
|||
import sqlite3
|
||||
import hashlib
|
||||
import time
|
||||
import logging
|
||||
from libs import toolbox
|
||||
from libs.exceptions import FingerprintWrite
|
||||
|
||||
|
@ -132,13 +133,14 @@ class DBSchema:
|
|||
try:
|
||||
fh = open(file_json, "r")
|
||||
jsonData = json.load(fh)
|
||||
dbmt = jsonData['db-metadata']
|
||||
tb = jsonData['tables']
|
||||
dbmt = jsonData['db-metadata']
|
||||
dbht = jsonData['db-metadata-hashes']
|
||||
all_tables = tb.keys()
|
||||
for table_name in all_tables:
|
||||
print "[[ Table <" + table_name + "> imported ]]"
|
||||
newTable = TableDefinition()
|
||||
newTable.importTable(table_name, dbmt[table_name], tb[table_name])
|
||||
newTable.importTable(table_name, tb[table_name], dbmt[table_name], dbht[table_name])
|
||||
tables[table_name] = newTable
|
||||
|
||||
except Exception, e:
|
||||
|
@ -148,6 +150,9 @@ class DBSchema:
|
|||
return tables
|
||||
|
||||
|
||||
def __DBMD5Compare(self):
|
||||
pass
|
||||
|
||||
def __DBSchemaCompare(self):
|
||||
# the json database schema definition is what our tools is expecting...
|
||||
# ...so we use it as the baseline
|
||||
|
@ -162,6 +167,7 @@ class DBSchema:
|
|||
print "[[ Comparing Table: " + tableName + " ]]"
|
||||
if (table):
|
||||
if not (self.tablesJson[tableName].hash() == table.hash()):
|
||||
logging.info("*** Hash difference 1:{}!={}".format(self.tablesJson[tableName].hash(), table.hash()))
|
||||
(total, diff_num) = self.__CompareTable(self.tablesJson[tableName], table)
|
||||
all_total += total
|
||||
diff_total += diff_num
|
||||
|
@ -343,10 +349,11 @@ class TableDefinition:
|
|||
del newField['name']
|
||||
|
||||
#
|
||||
def importTable(self, tbName, sqlStr, fields):
|
||||
def importTable(self, tbName, fields, sqlStr, hashStr):
|
||||
self.tableName = tbName
|
||||
self.sqlStr = sqlStr
|
||||
self.fields = fields
|
||||
self.sqlStrHash = hashStr
|
||||
|
||||
|
||||
# Table Definition
|
||||
|
|
Loading…
Reference in New Issue