15 def make_insert(table,fields):
16 s = 'INSERT INTO ' + table + ' VALUES('
31 thisline = thisline[:-1]
33 if thisline[-2:] == '\r\n':
34 thisline = thisline[:-2]
38 if lastline=='Pre-name style:':
41 if lastline=='Post-name style:':
44 if lastline == 'Name:':
45 a = re.search(' ([A-Z]+[^a-z])',thisline)
46 names = thisline.split()
50 firstName = name[0] + name[1:].lower()
57 thisName = add_quotes(thisline)
58 if lastline == 'Born:':
59 yb = findYear.find_year(thisline)
60 mb = findYear.find_month(thisline)
61 thisBorn = add_quotes(thisline)
62 if lastline == 'Died:':
63 yd = findYear.find_year(thisline)
64 md = findYear.find_month(thisline)
65 thisDied = add_quotes(thisline)
67 if lastline == 'URL:':
68 url = add_quotes(thisline)
69 if lastline == 'Picture:':
70 picture = add_quotes(thisline)
71 if lastline == 'Father:':
72 a = is_number(thisline)
73 s = make_insert('parents',[thisID, a])
75 if lastline=='Mother:':
77 s = make_insert('parents',[thisID, a])
80 if finishedRecord ==1:
91 titleName += pre + ' '
92 titleName += firstName
95 titleName = add_quotes(titleName)
97 prens = add_quotes(prens)
98 postns = add_quotes(postns)
99 firstName = add_quotes(firstName)
100 s = make_insert('people',\
101 [thisID,titleName,firstName,thisBorn,yb,\
102 thisDied,yd,mb,md,url,picture,prens,postns,thisName])
105 if lastline == 'Style:':
106 thisStyle = add_quotes(thisline)
112 thisTerr.append(add_quotes(thisline))
113 if lastline == 'Territories:':
114 thisTerr=[add_quotes(thisline)]
117 if lastline=='From:':
118 yf = findYear.find_year(thisline)
119 thisFrom = add_quotes(thisline)
121 yt = findYear.find_year(thisline)
122 thisTo = add_quotes(thisline)
123 s = make_insert('styles',[thisID,thisStyle,thisFrom,\
127 for terr in thisTerr:
128 s = make_insert('territories',[thisID,terr,\
129 thisFrom,yf,thisTo,yt])