dabo Commit
Revision 6523
Date: 2011-04-02 08:55:15 -0700 (Sat, 02 Apr 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6523
Changed:
U trunk/dabo/db/dCursorMixin.py
Log:
Some improvements in getDataSet() method - eliminating need for looping through
all rows.
Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py 2011-04-02 15:50:11 UTC (rev 6522)
+++ trunk/dabo/db/dCursorMixin.py 2011-04-02 15:55:15 UTC (rev 6523)
@@ -1198,26 +1198,29 @@
"""
ds = []
internals = (kons.CURSOR_TMPKEY_FIELD,)
+ rowCount = self.RowCount
if rows is None:
- rows = self.RowCount
- for row, rec in enumerate(self._records):
- if row >= rowStart and row < (rowStart + rows):
- tmprec = rec.copy()
- for k, v in self.VirtualFields.items():
- # only calc requested virtualFields
- if (flds and k in flds) or not flds:
- tmprec.update({k:
self.getFieldVal(k, row)})
- if flds:
- # user specified specific fields - get
rid of all others
- for k in tmprec.keys():
- if k not in flds:
- del tmprec[k]
- if not flds and not returnInternals:
- # user didn't specify explicit fields
and doesn't want internals
- for internal in internals:
- tmprec.pop(internal, None)
- ds.append(tmprec)
+ rows = rowCount
+ else:
+ rows = min(rowStart + rows, rowCount)
+ for row in xrange(rowStart, rows):
+ tmprec = self._records[row].copy()
+ for k, v in self.VirtualFields.items():
+ # only calc requested virtualFields
+ if (flds and k in flds) or not flds:
+ tmprec.update({k: self.getFieldVal(k,
row)})
+ if flds:
+ # user specified specific fields - get rid of
all others
+ for k in tmprec.keys():
+ if k not in flds:
+ del tmprec[k]
+ if not flds and not returnInternals:
+ # user didn't specify explicit fields and
doesn't want internals
+ for internal in internals:
+ tmprec.pop(internal, None)
+ ds.append(tmprec)
+
return dDataSet(ds)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]