Python and DB support (was: Re: Is Python Dead?)

Alex Martelli aleaxit at yahoo.com
Tue Jul 3 18:22:34 CEST 2001


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:Y3k07.26347$he.1370115 at e420r-atl1.usenetserver.com...
    ...
> cursor.execute("SELECT f1, f2, f3 FROM table WHERE f4=? AND f5=?", (f4val,
> f5val))
>
> I think you'll find it's more than a little tricky. Also, in VBScript, if
rs

Make a command object, with the CommandText property set to just
the same string as above, and call its Execute with the Parameters
set to Array(f4val,f5val).  What's "more than a little tricky"
about this -- having to set CommandText then call Execute in
two steps?  But this opens an opportunity to _prepare_ the
command object (set its Prepared property too) if you need to
execute it repeatedly with different parameters.

> is a recordset (with an implied current member), you have to access fields
> using
>
>     rs("FieldName")
>
> This is a bizarre way to reference things by name. If your colleagues see
> this as natural then they have their Microsoft blinkers on. I have no

I guess I must have such blinkers, because I don't see this as an
issue.  I may typically have the field names in variables, so how
else would I access the fields unless by using those values as
parameters to SOME call or other?  it could be more explicit, for
sure -- hey, you CAN write rs.Fields("FieldName").Value, you know,
you don't HAVE to take the above shortcuts!-).


I'm no Microsoft lover, but SOME of their stuff ain't too bad,
and I think ADO falls into the "not too bad" category (some SMALL
subset of their stuff is EXCELLENT, and COM is right there, but
that's another issue:-).  Indeed, I believe ADO (and much more
so, COM:-) deserves a far better language than Visual Basic...
Python, for example!-).


Alex






More information about the Python-list mailing list