Example #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, )))
Example #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)
Example #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, ))
Example #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, )))
Example #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)
Example #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, ))
Example #7
0
 def count(self, kind):
     return worm.query_for_value('select count(*) from ' + kind)
Example #8
0
 def count(self, kind):
     return worm.query_for_value('select count(*) from ' + kind)