Ejemplo n.º 1
0
 def Select(self, row_template=None, ignore_expiration=False):
   """Returns the list of rows that match row_template, None for all."""
   if row_template is not None:
     self._CheckRowTemplates([row_template])
   if not ignore_expiration and not self.restricted and not self.modified:
     raise exceptions.CacheTableExpired(
         '[{}] cache table [{}] has expired.'.format(
             self._cache.name, self.name))
   self._cache.cursor.execute(
       u'SELECT {fields} FROM "{table}"{where}'.format(
           fields=self._fields, table=self.name, where=_Where(row_template)))
   return self._cache.cursor.fetchall()
Ejemplo n.º 2
0
 def Select(self, row_template=None, ignore_expiration=False):
     """Returns the list of rows that match row_template, None for all."""
     if row_template is not None:
         self._CheckRowTemplates([row_template])
     if not ignore_expiration and not self.restricted and not self.modified:
         raise exceptions.CacheTableExpired(
             '[{}] cache table [{}] has expired.'.format(
                 self._cache.name, self.name))
     matched = []
     for row in self._rows:
         if row and self._RowMatch(row_template, row):
             matched.append(row)
     return matched