deriving MySQLdb class

tekion tekion at gmail.com
Wed Jan 27 21:18:21 EST 2010


On Jan 21, 11:48 pm, Sean DiZazzo <half.ital... at gmail.com> wrote:
> On Jan 21, 8:17 pm, tekion <tek... at gmail.com> wrote:
>
> > Sean,
> > I did a little investigation, there are other classes besides
> > Connection. So, could I only set up a derived class from Connection
> > and still be able to use the connection to query database and retrieve
> > data?
>
> Im not sure I understand you completely...
>
> In theory, you could use the C API directly and subclass
> _mysql.connection to get at the database.  But I think the point of
> MySQLdb is that they've done all the hard work.  Why not use it?

Regarding above statement, Yeah; what you said is true.  I am just
playing with inheritance to get a better understanding of it and since
I am working with database connection, then I might as learn it by
doing it.

> I think the other stuff in the module is in support of the Connection
> () class.  ie.  You cant get a cursor unless you already have a
> connection.
Yes, I have confirmed it just by inheriting the connection class, I am
able to connect and perform normal database functions.  Sweet!!! This
is why I like Python.

Thanks for your help.





More information about the Python-list mailing list