This commit is contained in:
@ -167,23 +167,23 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
c = db.execute("""
|
c = db.execute("""
|
||||||
insert into sequence (id,forward,reverse)
|
insert into sequence (id,forward,reverse)
|
||||||
values (%d,'%s','%s');
|
values (?,?,?);
|
||||||
""" % (seqid,tseq[0],tseq[1]))
|
""" ,(seqid,tseq[0],tseq[1]))
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
for w in words:
|
for w in words:
|
||||||
try:
|
try:
|
||||||
c = db.execute("""select id from words where word='%s';""" % w)
|
c = db.execute("""select id from words where word=?;""" , (w,))
|
||||||
wid = c.fetchone()["id"]
|
wid = c.fetchone()["id"]
|
||||||
except :
|
except :
|
||||||
db.rollback()
|
db.rollback()
|
||||||
wid = wordid
|
wid = wordid
|
||||||
c = db.execute("""insert into words (id,word) values (%d,'%s') ;""" % (wid,w))
|
c = db.execute("""insert into words (id,word) values (?,?) ;""" , (wid,w))
|
||||||
wordid+=1
|
wordid+=1
|
||||||
|
|
||||||
|
|
||||||
c = db.execute(""" insert into composition (seqid,wordid) values (%d,%d) ;""" % (seqid,wid))
|
c = db.execute(""" insert into composition (seqid,wordid) values (?,?) ;""" , (seqid,wid))
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user