Hi,
I've been doing some work with SQLObject with debug turned on and
noticed a lot more querying of the database going on than I expected.
When looping over a single table like:
----
mns = MarketNote.select(MarketNote.q.id < 6)
for mn in mns:
print mn.id
print mn.added
----
the 'print mn.added' line causes _SO_getValue to be called, 'print
mn.id' doesn't cause an extra call. My understanding was that this
should now not happen and the original SELECT called from iterSelect
should have got all the values.
Now my Python is not great so I could quite likely be doing something
wrong or misunderstanding how iterators work but the debug trace (with
a few more prints put in) seems to show the iterator running all the
way to the end of the selected items before the prints happen which
doesn't quite seem right to me.
This is all against the latest CVS version.
This is the debug from the code above:
----
<class 'SQLObject.SQLObject.SelectResults'> >> __iter__
SQLObject.DBConnection.SQLiteConnection >> iterSelect
Select: SELECT market_notes.id, market_notes.login,
market_notes.opportunity, market_notes.opportunity_desc,
market_notes.added, market_notes.modified, market_notes.notes FROM
market_notes WHERE (market_notes.id < 6)
in while loop
lazyColumns 0
in while loop
lazyColumns 0
in while loop
lazyColumns 0
in while loop
result is None
3
_SO_getValue >> added
_SO_selectOne
QueryOne: SELECT added FROM market_notes WHERE id = 3
Thu Feb 27 23:38:52 2003
4
_SO_getValue >> added
_SO_selectOne
QueryOne: SELECT added FROM market_notes WHERE id = 4
Thu Feb 27 23:56:56 2003
5
_SO_getValue >> added
_SO_selectOne
QueryOne: SELECT added FROM market_notes WHERE id = 5
Fri Feb 28 00:09:59 2003
---
Am I doing something wrong here or is this a bug?
Also I've been looking at adding support for an Interbase/Firebird
connection, has anyone else done any work on this?
regards,
--
peter w.
|