[Tutor] Counting MySQL Fields

Don Parris webdev at matheteuo.org
Sun Jun 12 05:21:13 CEST 2005


Oops!  Didn't mean to reply off-list.

On Sat, 11 Jun 2005 23:16:47 +0100
"Alan G" <alan.gauld at freenet.co.uk> wrote:

> HI Don,
> 
> > > > result = Cursor.fetchone()
> > > > Con.close()
> > > >
> > > > # Count the fields
> > > > result.num_fields()
> 
> > Should I have done something more like this?
> >   a = result
> >   the DB code
> >   a.num_fields()
> 
> No I'd have expected something like:
> 
> n = result.num_fields()
> 
> Although taking a guess I susprect num_fields may be a method
> of the cursor object? After all it knows how many felds each row
> has...
> 
> So it may be you need:
> 
> n = Cursor.num_fields()
> 
> But thats pure guesswork based on how I would have designed it!
> I'm gonna be getting into some Python DB programming soon so I'll
> need to find out then I guess.
> 
> Alan G.
> 


-- 
evangelinux    GNU Evangelist
http://matheteuo.org/                   http://chaddb.sourceforge.net/
"Free software is like God's love - you can share it with anyone anytime
anywhere."


More information about the Tutor mailing list