[Tutor] python classes and mysql

Lawrence Oluyede l.oluyede@virgilio.it
Tue, 13 Aug 2002 18:21:16 +0200


At 15.40 13/08/2002, rickp@telocity.com wrote:
>If I create multiple classes in python to deal with different aspects of
>a program and each of those classes needs to access mysql what is the
>best way of handling connections/cursors?

I think you can use multiple threads and handling the locking of mysql by them.
Create a daemon and pass the data along your classes (use the 2 or 3).


>1) Each class opens a connection and creates a cursor.
>2) The toplevel opens a connection which is passed to the class which
>    then creates a cursor.
>3) The toplevel opens a connection and creates a cursor which is passed
>    to the class.

--
Lawrence Oluyede
http://www26.brinkster.com/rhymes