By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,957 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,957 IT Pros & Developers. It's quick & easy.

Re: Problem with sqlite3 cursor and imbricated for loop

P: n/a
Gerhard Häring wrote:
Steve Holden wrote:
[...]
>>>
It's also why SQLite's not a real RDBMS. Fortunately this doesn't stop
it being very useful.

What does pysqlite extending the DB-API have to do with *SQLite* not
being a "real" RDBMS?
Nothing at all. I was just being pissy. Sorry about that.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Nov 13 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
c.execute("select * from stocks")
for s in list(c):
print s[0]
c.execute("select * from stocks where price<20")
for sp in c:
print ' '+sp[0]
c.close()

The simple addition of list() should do away with the dependency on
mysql's implementation, since it forces the instant fetch of all data.
Whether that is better than to use a 2nd cursor is probably a matter
of taste.

Using "*" in selects is always bad, though. ;)
Nov 19 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.