aktueller Stand

This commit is contained in:
hubobel 2019-02-12 20:19:52 +01:00
parent d5457380f7
commit 9775f8991d
22 changed files with 692 additions and 216 deletions

22
SQL.py
View file

@ -11,21 +11,7 @@ try:
except:
print ('weiter')
sql="SELECT * FROM facts ORDER BY nr DESC"
resp=cursor.execute(sql)
x=int(resp)+1
updatecount=0
with open('api/chuck.txt', 'r') as fp:
for line in fp:
line=line.replace('\n','')
sql = "INSERT INTO `facts`(`nr`, `fact`) VALUES ('"+str(x)+"','"+line+"')"
sql_q = "SELECT * FROM facts WHERE fact like '%" + line + "%'"
resp = cursor.execute(sql_q)
if resp == 0:
cursor.execute(sql)
x=x+1
updatecount=updatecount+1
connection.commit()
cursor.close()
connection.close()
print('Es wurden '+str(updatecount)+' neue Einträge der Datenbank hinzugefügt.')
sql = "SELECT * FROM facts ORDER BY nr DESC"
resp = cursor.execute(sql)
print(resp)