⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 endsession.c

📁 适合于Unix/Linux下的一个持久数据库连接池
💻 C
字号:
// Copyright (c) 1999-2001  David Muse// See the file COPYING for more information#include <sqlrconnection.h>void sqlrconnection_svr::endSessionCommand() {	#ifdef SERVER_DEBUG	debugPrint("connection",1,"end session");	#endif	endSessionInternal();	endSession();}void sqlrconnection_svr::endSession() {	// by default, do nothing}void sqlrconnection_svr::endSessionInternal() {	#ifdef SERVER_DEBUG	debugPrint("connection",2,"ending session...");	#endif	// must set suspendedsession to false here so resumed sessions won't 	// automatically re-suspend	suspendedsession=false;	abortAllCursors();	// truncate/drop temp tables	truncateTempTables(cur[0],&sessiontemptablesfortrunc);	dropTempTables(cur[0],&sessiontemptablesfordrop);	// commit or rollback if necessary	if (isTransactional() && commitorrollback) {		if (cfgfl->getEndOfSessionCommit()) {			#ifdef SERVER_DEBUG			debugPrint("connection",2,"committing...");			#endif			commit();			#ifdef SERVER_DEBUG			debugPrint("connection",2,"done committing...");			#endif		} else {			#ifdef SERVER_DEBUG			debugPrint("connection",2,"rolling back...");			#endif			rollback();			#ifdef SERVER_DEBUG			debugPrint("connection",2,"done rolling back...");			#endif		}	}	// reset autocommit behavior	#ifdef SERVER_DEBUG	debugPrint("connection",2,"resetting autocommit behavior...");	#endif	if (autocommit) {		#ifdef SERVER_DEBUG		debugPrint("connection",3,"setting autocommit on...");		#endif		autoCommitOn();		#ifdef SERVER_DEBUG		debugPrint("connection",3,"done setting autocommit on...");		#endif	} else {		#ifdef SERVER_DEBUG		debugPrint("connection",3,"setting autocommit off...");		#endif		autoCommitOff();		#ifdef SERVER_DEBUG		debugPrint("connection",3,"done setting autocommit off...");		#endif	}	#ifdef SERVER_DEBUG	debugPrint("connection",2,"done resetting autocommit behavior...");	debugPrint("connection",1,"done ending session");	#endif}void sqlrconnection_svr::abortAllCursors() {	// abort all cursors	#ifdef SERVER_DEBUG	debugPrint("connection",2,"aborting all busy cursors...");	#endif	for (int32_t i=0; i<cfgfl->getCursors(); i++) {		if (cur[i] && cur[i]->busy) {			#ifdef SERVER_DEBUG			debugPrint("connection",3,i);			#endif			// It's ok to call cleanUpData() here, ordinarily we			// wouldn't so that result sets that were suspended			// after the entire result set was fetched would be			// able to return column data when resumed, but since			// we're ending the session, we don't care...			cur[i]->cleanUpData(true,true);			cur[i]->abort();		}	}	#ifdef SERVER_DEBUG	debugPrint("connection",2,"done aborting all busy cursors");	#endif	// end sid session	if (cfgfl->getSidEnabled()) {		sid_sqlrcon->endSession();	}}void sqlrconnection_svr::cleanUpAllCursorData(bool freeresult, bool freebinds) {	// clean up all busy cursors	#ifdef SERVER_DEBUG	debugPrint("connection",2,"cleaning up all busy cursors...");	#endif	for (int32_t i=0; i<cfgfl->getCursors(); i++) {		if (cur[i] && cur[i]->busy) {			cur[i]->cleanUpData(freeresult,freebinds);		}	}	#ifdef SERVER_DEBUG	debugPrint("connection",2,"done aborting all busy cursors");	#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -