~bakrss.developers/bakrss/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sqlite3,os

class DbaseFeed:
    def __init__(self):
        self.path = os.getcwd()+"/DataBaseFeed"
        if not os.path.exists(self.path):
            self.create(self.path)
        #self.url=[]

    def create(self,path):
        self.conn = sqlite3.connect(self.path)
        self.c = self.conn.cursor()
        self.c.execute('create table indirizzi(url text)')
        self.c.execute('create table feeds(feed text,view text)')
        self.conn.commit()
        self.conn.close()

    def fill(self, url):
        self.url = url
        self.conn = sqlite3.connect(self.path)
        self.c = self.conn.cursor() 
        self.string = "insert into indirizzi values ('"+self.url+"')"
        self.c.execute(self.string)
        self.conn.commit()
        self.conn.close()

    def read(self):
        self.url=[]
        self.conn = sqlite3.connect(self.path)
        self.c = self.conn.cursor()
        self.c.execute('select * from indirizzi order by url')
        for row in self.c:
            self.url.append(row[0])
        return self.url