~bakrss.developers/bakrss/main

« back to all changes in this revision

Viewing changes to dbaseclass.py

  • Committer: akus-py
  • Date: 2009-04-10 11:15:04 UTC
  • Revision ID: akus.py@gmail.com-20090410111504-cdldwwr0g5bw0z29
display site name now is ok

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
    def create(self,path):
11
11
        self.conn = sqlite3.connect(self.path)
12
12
        self.c = self.conn.cursor()
13
 
        self.c.execute('create table indirizzi(url text)')
 
13
        self.c.execute('create table indirizzi(url text,name text)')
14
14
        self.c.execute('create table feeds(feed text,view text)')
15
15
        self.conn.commit()
16
16
        self.conn.close()
17
17
 
18
 
    def fill(self, url):
 
18
    def fill(self, url,name):
19
19
        self.url = url
 
20
        self.name=name
20
21
        self.conn = sqlite3.connect(self.path)
21
22
        self.c = self.conn.cursor() 
22
 
        self.string = "insert into indirizzi values ('"+self.url+"')"
 
23
        self.string = "insert into indirizzi values ('"+self.url+"','"+self.name+"')"
 
24
        print "self.string= ",self.string
23
25
        self.c.execute(self.string)
24
26
        self.conn.commit()
25
27
        self.conn.close()
26
28
 
27
29
    def read(self):
28
 
        self.url=[]
 
30
        self.url={}
29
31
        self.conn = sqlite3.connect(self.path)
30
32
        self.c = self.conn.cursor()
31
33
        self.c.execute('select * from indirizzi order by url')
32
34
        for row in self.c:
33
 
            self.url.append(row[0])
 
35
            self.url[str(row[1])]=str(row[0])
 
36
        print self.url
34
37
        return self.url
35
38