X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=89072918a2f2c25f4a7a5c81bf39fa7c26ca36ad;hb=3996b7fcc054088be18d4a1199f0c67e61646926;hp=05bb208fd8ad163b92ca2b9c7a89994c5a183389;hpb=aeff0b009db845e9a924853846eff6fbb8e3f07b;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 05bb208f..89072918 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -113,6 +113,14 @@ class DBConn(Singleton): 'suite_version': Cache(lambda x: '%s_%s' % (x['source'], x['suite'])), } + self.prepared_statements = {} + + def prepare(self,name,statement): + if not self.prepared_statements.has_key(name): + c = self.cursor() + c.execute(statement) + self.prepared_statements[name] = statement + def clear_caches(self): self.__init_caches() @@ -547,6 +555,8 @@ class DBConn(Singleton): for fullpath in fullpaths: (path, file) = os.path.split(fullpath) + if path.startswith( "./" ): + path = path[2:] # Get the necessary IDs ... file_id = self.get_or_set_contents_file_id(file) path_id = self.get_or_set_contents_path_id(path)