def get_count(cls, child_classes=True, count=0): get_one = RawQuery(select=fn.count(cls.id) >> 'count').get_one() count = get_one.count + count if get_one else count if child_classes: for child_pod in cls.pod.child_pods: count = child_pod.cls.get_count(child_classes=child_classes, count=count) return count
def __len__(self): # Return the cardinality of set s. get_one = query.RawQuery(select=fn.count(SetItem.id) >> "count", where=SetItem.parent == self).get_one() if get_one: return get_one.count
def index(self, x): get_one = query.RawQuery(where = (ListItem.parent == self) & (ListItem.value == x)).get_one(error_on_multiple = False) if get_one: return query.RawQuery(select = fn.count(ListItem.id) >> 'count', where = (ListItem.parent == self) & (ListItem.id < get_one.id)).get_one().count else: raise PodListError, "Item '" + str(x) + "' not in list . . ."
def __len__(self): get_one = query.RawQuery(select = fn.count(DictItem.id) >> 'count', where = DictItem.parent == self).get_one() if get_one: return get_one.count
def count(self, x): return query.RawQuery(select = fn.count(ListItem.id) >> 'count', where = (ListItem.parent == self) & (ListItem.value == x)).get_one().count