[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] How to retrieve number of fields of a query from
From:       Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date:       2010-03-24 16:49:42
Message-ID: 201003241749.43342.wolfgang () rohdewald ! de
[Download RAW message or body]

On Mittwoch 24 März 2010, bar tomas wrote:
> Hi,
> QSqlQuery's size method gives the number of rows retrieved
> with a query. But is there some way to get the number of
> fields (columns) of that query?
> Many thanks.

if self.query.isSelect():
  record = self.query.record()
  qFields = [record.field(x) for x in range(record.count())]

-- 
Wolfgang
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic