equal
deleted
inserted
replaced
1 """The `ResultSet` class which is returned as result of a rql query |
1 """The `ResultSet` class which is returned as result of an rql query |
2 |
2 |
3 :organization: Logilab |
3 :organization: Logilab |
4 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
4 :copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
13 |
13 |
14 from cubicweb import NotAnEntity |
14 from cubicweb import NotAnEntity |
15 |
15 |
16 |
16 |
17 class ResultSet(object): |
17 class ResultSet(object): |
18 """a result set wrap a RQL query result. This object implements a partial |
18 """A result set wraps a RQL query result. This object implements a partial |
19 list protocol to allow direct use as a list of result rows. |
19 list protocol to allow direct use as a list of result rows. |
20 |
20 |
21 :type rowcount: int |
21 :type rowcount: int |
22 :ivar rowcount: number of rows in the result |
22 :ivar rowcount: number of rows in the result |
23 |
23 |
202 descr.append(self.description[index]) |
202 descr.append(self.description[index]) |
203 rset.rowcount = len(rows) |
203 rset.rowcount = len(rows) |
204 return rset |
204 return rset |
205 |
205 |
206 def split_rset(self, keyfunc=None, col=0, return_dict=False): |
206 def split_rset(self, keyfunc=None, col=0, return_dict=False): |
207 """Splits the result set in multiple result set according to a given key |
207 """splits the result set in multiple result set according to a given key |
208 |
208 |
209 :type keyfunc: callable(entity or FinalType) |
209 :type keyfunc: callable(entity or FinalType) |
210 :param keyfunc: |
210 :param keyfunc: |
211 a callable which should take a value of the rset in argument and |
211 a callable which should take a value of the rset in argument and |
212 return the value used to group the value. If not define, raw value |
212 return the value used to group the value. If not define, raw value |