Entropy/EquoInterface:

- regenerate client database indexes only when needed


git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1785 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
lxnay
2008-04-16 18:45:47 +00:00
parent a42eb6af9b
commit b7964fc752
2 changed files with 18 additions and 3 deletions
+12
View File
@@ -3452,6 +3452,18 @@ class etpDatabase:
if not index.startswith("sqlite"):
self.cursor.execute('DROP INDEX IF EXISTS %s' % (index,))
def listAllIndexes(self, only_entropy = True):
self.cursor.execute('SELECT name FROM SQLITE_MASTER WHERE type = "index"')
indexes = self.fetchall2set(self.cursor.fetchall())
if not only_entropy:
return indexes
myindexes = set()
for index in indexes:
if index.startswith("sqlite"):
continue
myindexes.add(index)
return myindexes
def createAllIndexes(self):
self.createContentIndex()
+6 -3
View File
@@ -5720,10 +5720,13 @@ class RepoInterface:
)
dbconn = self.Entropy.openRepositoryDatabase(repo)
dbconn.createAllIndexes()
# get list of indexes
repo_indexes = dbconn.listAllIndexes()
try: # client db can be absent
# XXX: once indexes will get close to final, remove this
self.Entropy.clientDbconn.dropAllIndexes()
self.Entropy.clientDbconn.createAllIndexes()
client_indexes = self.Entropy.clientDbconn.listAllIndexes()
if repo_indexes != client_indexes:
self.Entropy.clientDbconn.dropAllIndexes()
self.Entropy.clientDbconn.createAllIndexes()
except:
pass
# update revision in etpRepositories