// $Id: IDbiConnectionMaintainer.cxx,v 1.1 2011/01/18 05:49:19 finch Exp $ #include "IDbiCascader.hxx" #include "IDbiConnectionMaintainer.hxx" #include #include using std::endl; ClassImp(COMET::IDbiConnectionMaintainer) // Definition of static data members // ********************************* COMET::IDbiConnectionMaintainer::IDbiConnectionMaintainer(COMET::IDbiCascader* cascader) { // For database connections that are not permanent, the connection is // closed as soon as the last associated COMET::IDbiStatement is // deleted. However, standard context queries involve several separate // SQL queries, each using its own COMET::IDbiStatement and hence each involving // a separate connection. To maintain a single connection for the entire // set of SQL queries a COMET::IDbiConnectionMaintainer can be use. On creation // it connects to every COMET::IDbiConnection which prevents it from closing. On // destruction it disconnects from them allowing them to close, if // temporary, once any other associated IDbiStatement.hxxas been deleted. COMETTrace( "Creating COMET::IDbiConnectionMaintainer" << " "); fCascader = cascader; if ( fCascader ) fCascader->HoldConnections(); } //..................................................................... COMET::IDbiConnectionMaintainer::~IDbiConnectionMaintainer() { if ( fCascader ) fCascader->ReleaseConnections(); COMETTrace( "Destroying COMET::IDbiConnectionMaintainer" << " "); } /* Template for New Member Function //..................................................................... COMET::IDbiConnectionMaintainer:: { // // // Purpose: // // Arguments: // xxxxxxxxx in yyyyyy // // Return: // // Contact: N. West // // Specification:- // ============= // // o // Program Notes:- // ============= // None. } */