Added helper function for column, or table comparison when merging.

pull/2/head
Charlie Duso 8 years ago
parent 98c1ca40ac
commit 47253c0b80

@ -49,15 +49,31 @@ def getTableNames():
# Gets the column names of a table
#
# @param dbName the name of the database file (i.e. "example.db")
# @return a string array of the table names and their respective column names
# @return a string array of the column names - strips primary ids
def getColumnNames( tableName ):
curs.execute("PRAGMA table_info(%s);" % str(tableName))
temp = curs.fetchall()
columns = []
for i in range(0, len(temp)):
columns.append(temp[i][1])
if ((("id" in temp[i][1]) | ("ID" in temp[i][1])) & ("INTEGER" in temp[i][2])):
continue
else:
columns.append(temp[i][1])
return columns
# Compares two lists to see if they have identical data
#
# @param list1 the first list parameter for comparison
# @param list2 the second list parameter for comparison
# @return will return a boolean (0 if lists are not the same, 1 if lists are the same)
def compareLists(list1, list2):
if len(list1) != len(list2):
return 0
else:
for i in range(0, len(list1)):
if list1[i] != list2[i]:
return 0
return 1
############################## Merge Script ####################################
################################################################################

Loading…
Cancel
Save