X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=24cb9044aa0579892df0936e857455d507413b49;hb=e5f927252329bbb26a2946ffcb225fcbb86dfa47;hp=05bb208fd8ad163b92ca2b9c7a89994c5a183389;hpb=04dc27ae10c3dc9bb001544c297ae089256c3ef1;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 05bb208f..24cb9044 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() @@ -160,7 +168,7 @@ class DBConn(Singleton): @return: the database id for the given suite """ - return self.__get_id('id', 'suite', 'suite_name', suite) + return int(self.__get_id('id', 'suite', 'suite_name', suite)) def get_section_id(self, section): """ @@ -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)