[IronPython] MySQL and Iron Python

Ian Hobson ian at ianhobson.co.uk
Thu Jul 22 16:05:24 CEST 2010

While not the most efficent (or pythonic) approach, this works.

query = "SELECT ..... " # select one row
db = c.fetchmany(1)
rec = db[0]
def field(name):
     i = 0
     for d in c.description:
         if d[0] == name:
              return str(rec[i])
         i+= 1

rt.FindName("customerKey").Text = field("customerKey")



On 20/07/2010 21:47, Vernon Cole wrote:
> Field name access is the next development step. The API calls for 
> position (field number) access. Field name access is an extension. I 
> personally think that it is the obvious thing to do, but the movers 
> and shakers of the database API don't see it the same way.  My big 
> goal is to add that feature. I implemented name access for (input) 
> parameters in the last revision.
> (paramstyle='named').  So for today, you must use column position to 
> read the data.
> --
> Vernon

More information about the Ironpython-users mailing list