Added id column to feeds database

This commit is contained in:
spla 2020-10-20 12:41:24 +02:00
pare ac8682faee
commit 70b8575fe5
S'han modificat 2 arxius amb 4 adicions i 4 eliminacions

Veure arxiu

@ -139,7 +139,7 @@ print("Creating table...")
db = feeds_db
db_user = feeds_db_user
table = "feeds"
sql = "create table "+table+" (link varchar(200) PRIMARY KEY)"
sql = "create table "+table+" (id varchar(200) PRIMARY KEY, link varchar(250))"
create_table(db, db_user, table, sql)
#####################################

Veure arxiu

@ -75,7 +75,7 @@ for entry in newsfeeds.entries:
cur = conn.cursor()
cur.execute('select link from feeds where link=(%s)', (link,))
cur.execute('select id from feeds where id=(%s)', (id,))
row = cur.fetchone()
if row == None:
@ -109,7 +109,7 @@ for entry in newsfeeds.entries:
#########################################################
insert_line = 'INSERT INTO feeds(link) VALUES (%s)'
insert_line = 'INSERT INTO feeds(id, link) VALUES (%s, %s)'
conn = None
@ -119,7 +119,7 @@ for entry in newsfeeds.entries:
cur = conn.cursor()
cur.execute(insert_line, (link,))
cur.execute(insert_line, (id, link,))
conn.commit()