def getLocationNameList(self): ''' Returns a list of home location names ''' cur = self.cursor() cur.execute("SELECT name FROM Locations ORDER BY name") return rows2list(cur.fetchall())
def getCacheCodeList(self): ''' Returns a list of the codes of each cache in the database ''' cur = self.cursor() cur.execute("SELECT code FROM Caches ORDER BY code") return rows2list(cur.fetchall())
def getAddWaypointCodes(self): '''Returns a list of the codes of the waypoints associated with the cache''' cur = geocacher.db().cursor() cur.execute( "SELECT code FROM Waypoints WHERE cache_id = ? ORDER BY code", (self.id, )) return rows2list(cur.fetchall())
def getTravelBugRefs(self): '''Returns a list of the ref's of the travel bugs in the cache''' cur = geocacher.db().cursor() cur.execute( "SELECT ref FROM Travelbugs WHERE cache_id = ? ORDER BY ref", (self.id, )) return rows2list(cur.fetchall())
def getLogDates(self): ''' Returns a sorted list of the dates on which the cache has been logged with the most recent first ''' cur = geocacher.db().cursor() cur.execute("SELECT date FROM Logs WHERE cache_id = ? ORDER BY date DESC", (self.id,)) return rows2list(cur.fetchall())
def getLogDates(self): ''' Returns a sorted list of the dates on which the cache has been logged with the most recent first ''' cur = geocacher.db().cursor() cur.execute( "SELECT date FROM Logs WHERE cache_id = ? ORDER BY date DESC", (self.id, )) return rows2list(cur.fetchall())
def getLogIdList(self, sort=True, descending=True, maxLen=None): ''' Returns a list of the ID's of the logs associated with the cache Keyword arguments sort Enable sorting of the log list by date descending Sort with the most recent log first maxLen Truncate the list at this position ''' cur = geocacher.db().cursor() sql = "SELECT id FROM Logs WHERE cache_id = ?" if sort: sql = sql + " ORDER BY log_date" if descending: sql = sql + " DESC" cur.execute(sql, (self.id, )) rows = cur.fetchall() if maxLen is not None: if descending: rows = rows[:maxLen] else: rows = rows[-maxLen:] return rows2list(rows)
def getLogIdList(self, sort=True, descending=True, maxLen=None): ''' Returns a list of the ID's of the logs associated with the cache Keyword arguments sort Enable sorting of the log list by date descending Sort with the most recent log first maxLen Truncate the list at this position ''' cur = geocacher.db().cursor() sql = "SELECT id FROM Logs WHERE cache_id = ?" if sort: sql = sql + " ORDER BY log_date" if descending: sql = sql + " DESC" cur.execute(sql , (self.id,)) rows = cur.fetchall() if maxLen is not None: if descending: rows = rows[:maxLen] else: rows = rows[-maxLen:] return rows2list(rows)
def getAttributeIds(self): '''Returns a list of the id's of the caches attributes''' cur = geocacher.db().cursor() cur.execute("SELECT id FROM Attributes WHERE cache_id = ? ORDER BY id", (self.id, )) return rows2list(cur.fetchall())
def getAddWaypointCodes(self): '''Returns a list of the codes of the waypoints associated with the cache''' cur = geocacher.db().cursor() cur.execute("SELECT code FROM Waypoints WHERE cache_id = ? ORDER BY code",(self.id,)) return rows2list(cur.fetchall())
def getTravelBugRefs(self): '''Returns a list of the ref's of the travel bugs in the cache''' cur = geocacher.db().cursor() cur.execute("SELECT ref FROM Travelbugs WHERE cache_id = ? ORDER BY ref" , (self.id,)) return rows2list(cur.fetchall())
def getAttributeIds(self): '''Returns a list of the id's of the caches attributes''' cur = geocacher.db().cursor() cur.execute("SELECT id FROM Attributes WHERE cache_id = ? ORDER BY id" , (self.id,)) return rows2list(cur.fetchall())