comparison src/memory/sqlite.py @ 2209:ea41cf1e6d29

memory (persistent, sqlite): fixed getPrivates bug with keys arguments and its use in LazyPersistentBinaryDict
author Goffi <goffi@goffi.org>
date Wed, 29 Mar 2017 19:27:52 +0200
parents 087eec4c6c07
children fa43e285df1d
comparison
equal deleted inserted replaced
2208:c316c6f6a737 2209:ea41cf1e6d29
569 table = self._getPrivateTable(binary, profile) 569 table = self._getPrivateTable(binary, profile)
570 query_parts = [u"SELECT key,value FROM", table, "WHERE namespace=?"] 570 query_parts = [u"SELECT key,value FROM", table, "WHERE namespace=?"]
571 args = [namespace] 571 args = [namespace]
572 572
573 if keys is not None: 573 if keys is not None:
574 query_parts.append(u'AND key IN ?') 574 placeholders = u','.join(len(keys) * u'?')
575 args.append(keys) 575 query_parts.append(u'AND key IN (' + placeholders + u')')
576 args.extend(keys)
576 577
577 if profile is not None: 578 if profile is not None:
578 query_parts.append(u'AND profile_id=?') 579 query_parts.append(u'AND profile_id=?')
579 args.append(self.profiles[profile]) 580 args.append(self.profiles[profile])
580 581