[Tutor] python classes and mysql

SA sarmstrong13@mac.com
Tue, 13 Aug 2002 11:31:07 -0500


On 8/13/02 11:06 AM, "Alan Trautman" <ATrautman@perryjudds.com> wrote:

> Ok another .02USD worth.
> 
> The DB handling functions are usually better left in one class object and
> are a good thing to put in a class IMO. This allows easy changes to the DB
> connections and structure, i.e. if the location or password changes the same
> connection string is used. In addition by putting insert and creation info
> in one location changes are much easier than trying to remember which
> classes contain what. The final benefit being that if you decide to support
> more than one database type you can simply insert the new database
> connection class to handle all of the differences without losing the
> original functionality. This also works well for simple test environments
> where a simple copy is made only the DB name constant needs to be changed to
> support testing.
> 
This would work even better. Thanks Alan.

So instead of having the connections at the toplevel. You wish to make a
class specifically for handling connections(generic so diff. Dbs can be
used). And the other class will handle all of the db calls? Is this correct?
This is why I like OOP. It makes it easier to build different little
'engines' to perform complex tasks on different input.

Thanks Again.

SA


-- 
"I can do everything on my Mac I used to on my PC. Plus a lot more ..."
-Me