FIX: parsing of PRIMARY KEY (field_name_111, field_name_222)
This commit is contained in:
parent
82bf211e4c
commit
82651d5388
|
@ -32,8 +32,8 @@ class DBSchema:
|
|||
"""
|
||||
|
||||
sqlmaster = "SELECT name, sql FROM sqlite_master WHERE type='table'"
|
||||
scanner_ver = ".85"
|
||||
format_ver = ".90"
|
||||
scanner_ver = "0.85"
|
||||
format_ver = "0.90"
|
||||
|
||||
def __init__(self):
|
||||
self.conn = None
|
||||
|
@ -296,8 +296,6 @@ class TableDefinition:
|
|||
if newField:
|
||||
self.fields[newField['name']] = newField
|
||||
del newField['name']
|
||||
else:
|
||||
print "WARN: <{}> ] failed to parse]".format(tableName)
|
||||
|
||||
#
|
||||
def importTable(self, tbName, sqlStr, fields):
|
||||
|
@ -391,10 +389,10 @@ class TableDefinition:
|
|||
newField['datatype'] = results.group(2)
|
||||
return newField
|
||||
# field_name)
|
||||
results = re.match(r'(?:[`|\"|\'])*(\w+)(?:[`|\"|\'])*(\)?)', sqltext)
|
||||
# results = re.match(r'(?:[`|\"|\'])*(\w+)(?:[`|\"|\'])*(\)?)', sqltext)
|
||||
results = re.match(r'(?:[`|\"|\'])*(\w+)(?:[`|\"|\'])*\)', sqltext)
|
||||
if results:
|
||||
field = self.fields[results.group(1)]
|
||||
field = self.fields[results.group(2)]
|
||||
if (self.primarykeyFlag):
|
||||
field['primarykey'] = True
|
||||
if (field):
|
||||
|
@ -408,6 +406,7 @@ class TableDefinition:
|
|||
print 'WARN: field definition not recognized: "{}"'.format(sqltext)
|
||||
except Exception, e:
|
||||
print 'WARN: problem parsing sql create text: "{}"'.format(sqltext)
|
||||
print 'Exception: \n{}'.format(e)
|
||||
return None
|
||||
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue