Exemplo n.º 1
0
 def get_next(self):
     if self.filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     query = '''select t1.id from photo t1
                where t1.time_taken > %%s
                %s
                order by t1.time_taken asc limit 1''' % filter
     return Photo(worm.query_for_value(query, (self._time_taken, )))
Exemplo n.º 2
0
 def get_voted_photos(self, filter=False):
     if filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     return worm.query_for_value('''
                    select count(t1.*)
                    from photo t1
                    where exists (select * from photo_score s
                                  where s.photo = t1.id)''' + filter)
Exemplo n.º 3
0
 def get_photo_count(self):
     if self._filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     return worm.query_for_value('''
        select count(t1.*)
        from photo t1
        where substring(t1.time_taken from 1 for 7) = %%s %s''' % filter,
                                 (self._month, ))
Exemplo n.º 4
0
 def get_next(self):
     if self.filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     query = '''select t1.id from photo t1
                where t1.time_taken > %%s
                %s
                order by t1.time_taken asc limit 1''' % filter
     return Photo(worm.query_for_value(query, (self._time_taken, )))
Exemplo n.º 5
0
 def get_voted_photos(self, filter = False):
     if filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     return worm.query_for_value('''
                    select count(t1.*)
                    from photo t1
                    where exists (select * from photo_score s
                                  where s.photo = t1.id)''' + filter)
Exemplo n.º 6
0
 def get_photo_count(self):
     if self._filter:
         filter = ' and ' + SQL_PHOTO_FILTER
     else:
         filter = ''
     return worm.query_for_value(
         '''
        select count(t1.*)
        from photo t1
        where substring(t1.time_taken from 1 for 7) = %%s %s''' % filter,
         (self._month, ))
Exemplo n.º 7
0
 def count(self, kind):
     return worm.query_for_value('select count(*) from ' + kind)
Exemplo n.º 8
0
 def count(self, kind):
     return worm.query_for_value('select count(*) from ' + kind)