00001 // $Id: TDbiConnectionMaintainer.cxx,v 1.1 2011/01/18 05:49:19 finch Exp $ 00002 00003 00004 #include "TDbiCascader.hxx" 00005 #include "TDbiConnectionMaintainer.hxx" 00006 #include <TSK_DBI_Log.hxx> 00007 #include <MsgFormat.h> 00008 using std::endl; 00009 00010 ClassImp(TDbiConnectionMaintainer) 00011 00012 // Definition of static data members 00013 // ********************************* 00014 00015 00016 00017 TDbiConnectionMaintainer::TDbiConnectionMaintainer(TDbiCascader* cascader) { 00018 00019 // For database connections that are not permanent, the connection is 00020 // closed as soon as the last associated TDbiStatement is 00021 // deleted. However, standard context queries involve several separate 00022 // SQL queries, each using its own TDbiStatement and hence each involving 00023 // a separate connection. To maintain a single connection for the entire 00024 // set of SQL queries a TDbiConnectionMaintainer can be use. On creation 00025 // it connects to every TDbiConnection which prevents it from closing. On 00026 // destruction it disconnects from them allowing them to close, if 00027 // temporary, once any other associated TDbiStatement.hxxas been deleted. 00028 00029 00030 SK_DBI_Trace( "Creating TDbiConnectionMaintainer" << " "); 00031 00032 fCascader = cascader; 00033 if ( fCascader ) fCascader->HoldConnections(); 00034 00035 } 00036 //..................................................................... 00037 00038 00039 TDbiConnectionMaintainer::~TDbiConnectionMaintainer() { 00040 00041 if ( fCascader ) fCascader->ReleaseConnections(); 00042 00043 00044 SK_DBI_Trace( "Destroying TDbiConnectionMaintainer" << " "); 00045 00046 } 00047 00048 /* Template for New Member Function 00049 00050 //..................................................................... 00051 00052 TDbiConnectionMaintainer:: { 00053 // 00054 // 00055 // Purpose: 00056 // 00057 // Arguments: 00058 // xxxxxxxxx in yyyyyy 00059 // 00060 // Return: 00061 // 00062 // Contact: N. West 00063 // 00064 // Specification:- 00065 // ============= 00066 // 00067 // o 00068 00069 // Program Notes:- 00070 // ============= 00071 00072 // None. 00073 00074 00075 } 00076 00077 */ 00078 00079