[IronPython] MySQL and Iron Python

Harry Percival harry.percival at gmail.com
Fri Jul 23 10:47:08 CEST 2010


i'm no guru, but if you want to get more pythonic, the list index()
function could save you a few lines of code
http://docs.python.org/tutorial/datastructures.html :)


On Thu, Jul 22, 2010 at 4:05 PM, Ian Hobson <ian at ianhobson.co.uk> wrote:
> While not the most efficent (or pythonic) approach, this works.
>
> query = "SELECT ..... " # select one row
> c.execute(query)
> 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")
>
> Regards
>
> Ian
>
>
> 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
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



-- 
------------------------------
Harry J.W. Percival
------------------------------
Italy Mobile: +39 389 095 8959
UK Mobile:  +44 (0) 78877 02511
Skype:         harry dot percival



More information about the Ironpython-users mailing list