Esempio n. 1
0
    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
Esempio n. 2
0
 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
Esempio n. 3
0
 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 . . ."
Esempio n. 4
0
 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
Esempio n. 5
0
 def count(self, x):
     return query.RawQuery(select = fn.count(ListItem.id) >> 'count', where = (ListItem.parent == self) & (ListItem.value == x)).get_one().count