Re: Queryset Refactoring: __nonzero__ for MySQL

2008-03-30 Thread Malcolm Tredinnick
On Thu, 2008-03-27 at 15:30 +0100, Michael Radziej wrote: > Hi, > > I've recently read Malcolm's blog entry about __iter__ and __len__ in the > refactored QuerySets. Interesting! > > In the refactored QuerySet, if you do e.g. > > if models.Something.objects.all(): > ... > > then

Re: Queryset Refactoring: __nonzero__ for MySQL

2008-03-27 Thread Arien
On Thu, Mar 27, 2008 at 4:18 PM, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > Please note that psycopg2's cursor.execute() doesn't really respect > DB-API either, in the sense that .fetchone does actually fetch the > entire resultset into the python process unless the cursor is named, > i.e.

Re: Queryset Refactoring: __nonzero__ for MySQL

2008-03-27 Thread Jeremy Dunck
On Thu, Mar 27, 2008 at 10:19 AM, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote: > > On Thu, Mar 27, 2008 at 9:30 AM, Michael Radziej <[EMAIL PROTECTED]> wrote: > > I see one possible problem: I observe that mysql always slurps in the > > whole result set from the database when you only issue

Re: Queryset Refactoring: __nonzero__ for MySQL

2008-03-27 Thread Jacob Kaplan-Moss
On Thu, Mar 27, 2008 at 9:30 AM, Michael Radziej <[EMAIL PROTECTED]> wrote: > I see one possible problem: I observe that mysql always slurps in the > whole result set from the database when you only issue a select > (cursor.query(...)) *Sigh*. > Theoretically, it's probably possible to

Queryset Refactoring: __nonzero__ for MySQL

2008-03-27 Thread Michael Radziej
Hi, I've recently read Malcolm's blog entry about __iter__ and __len__ in the refactored QuerySets. Interesting! In the refactored QuerySet, if you do e.g. if models.Something.objects.all(): ... then QuerySet.__nonzero__ will execute the query and try to fetch the first result. I