1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU Library General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 import sqlite3 as sqlite
21 DBVERSION = _sqlitecache.DBVERSION
23 class RepodataParserSqlite:
24 def __init__(self, storedir, repoid, callback=None):
25 self.callback = callback
28 def open_database(self, filename):
31 con = sqlite.connect(filename)
32 con.text_factory = str
33 if sqlite.version_info[0] > 1:
34 con.row_factory = sqlite.Row
36 cur.execute("pragma locking_mode = EXCLUSIVE")
40 def getPrimary(self, location, checksum):
41 """Load primary.xml.gz from an sqlite cache and update it
43 return self.open_database(_sqlitecache.update_primary(location,
48 def getFilelists(self, location, checksum):
49 """Load filelist.xml.gz from an sqlite cache and update it if
51 return self.open_database(_sqlitecache.update_filelist(location,
56 def getOtherdata(self, location, checksum):
57 """Load other.xml.gz from an sqlite cache and update it if required"""
58 return self.open_database(_sqlitecache.update_other(location,