def ReadHuntObjects(self,
                      offset,
                      count,
                      with_creator=None,
                      created_after=None,
                      with_description_match=None,
                      cursor=None):
    """Reads multiple hunt objects from the database."""
    query = "SELECT {columns} FROM hunts ".format(columns=_HUNT_COLUMNS_SELECT)
    args = []

    components = []
    if with_creator is not None:
      components.append("creator = %s ")
      args.append(with_creator)

    if created_after is not None:
      components.append("create_timestamp > FROM_UNIXTIME(%s) ")
      args.append(mysql_utils.RDFDatetimeToTimestamp(created_after))

    if with_description_match is not None:
      components.append("description LIKE %s")
      args.append("%" + with_description_match + "%")

    if components:
      query += "WHERE " + " AND ".join(components)

    query += " ORDER BY create_timestamp DESC LIMIT %s OFFSET %s"
    args.append(count)
    args.append(offset)

    cursor.execute(query, args)
    return [self._HuntObjectFromRow(row) for row in cursor.fetchall()]
def ReadHuntObjects ( self , offset , count , with_creator = None , created_after = None , with_description_match = None , cursor = None ) : query = "SELECT {columns} FROM hunts " . format ( columns = _HUNT_COLUMNS_SELECT ) args = [ ] components = [ ] if with_creator is not None : components . append ( "creator = %s " ) args . append ( with_creator ) if created_after is not None : components . append ( "create_timestamp > FROM_UNIXTIME(%s) " ) args . append ( mysql_utils . RDFDatetimeToTimestamp ( created_after ) ) if with_description_match is not None : components . append ( "description LIKE %s" ) args . append ( "%" + with_description_match + "%" ) if components : query += "WHERE " + " AND " . join ( components ) query += " ORDER BY create_timestamp DESC LIMIT %s OFFSET %s" args . append ( count ) args . append ( offset ) cursor . execute ( query , args ) return [ self . _HuntObjectFromRow ( row ) for row in cursor . fetchall ( ) ]
Reads multiple hunt objects from the database.