db access and base classes

Greg Lindstrom greg.lindstrom at novasyshealth.com
Wed Jul 28 09:03:01 EDT 2004


Hello-

I am writing an application that uses a base class to help define multiple
record segments.  Currently, there are 18 different segment types, with many
more to come.  I would like to access a SQL Server to generate job info, id
numbers, etc. and would like to place the connection in the base class so
all segments use it via inheritance.  My problem is I do not know how to set
things up so the connection is on opened once.  I don't know which segment
will be generated first, so I can't base it off that.  How can I set things
up so if the connection does not exist one will be opened, but if the
connection is open it will be used. Additionally, if segment "A" opens the
connection, then segment "B" invokes it, then segment "A" is destroyed, I
would like to hold the connection open until all segments are destroyed
(sounds like reference counting to me).

Can this be done, or am I simply trying to do something that is not
possible/desirable with my base class?

Thanks for your help and expertise,
--greg

Greg Lindstrom                                         (501) 975-4859
NovaSys Health                  greg.lindstrom at novasyshealth.com

"We are the music makers, and we are the dreamers of dreams"  W.W.





More information about the Python-list mailing list