Added id column to feeds database
This commit is contained in:
pare
ac8682faee
commit
70b8575fe5
S'han modificat 2 arxius amb 4 adicions i 4 eliminacions
|
@ -139,7 +139,7 @@ print("Creating table...")
|
||||||
db = feeds_db
|
db = feeds_db
|
||||||
db_user = feeds_db_user
|
db_user = feeds_db_user
|
||||||
table = "feeds"
|
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)
|
create_table(db, db_user, table, sql)
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
|
|
@ -75,7 +75,7 @@ for entry in newsfeeds.entries:
|
||||||
|
|
||||||
cur = conn.cursor()
|
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()
|
row = cur.fetchone()
|
||||||
if row == None:
|
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
|
conn = None
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ for entry in newsfeeds.entries:
|
||||||
|
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
|
|
||||||
cur.execute(insert_line, (link,))
|
cur.execute(insert_line, (id, link,))
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència