in reply to Sharing a database handle among objects

If Vhost -> Location, then I'd have the Vhost create the Locations so Vhost can decide what to pass to the Locations c'tor. Then do what lhoward says.

It might be best for each Location to keep a reference to the Vhost. Then the Location could cache the dbhandle, request the dbhandle from the Vhost each time, or submit db requests via the Vhost, depending what makes sense to you.

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: Sharing a database handle among objects