language-extensions/R/src/RExtension.cpp
//--------------------------------------------------------------------------------------------------
// Name: CleanupSession
//
// Description:
//  Cleans up the output data buffers that we persist for
//  ExtHost to finish processing the data
//
// Returns:
//  SQL_SUCCESS on success, else SQL_ERROR
//
CleanupSession
Description:
Cleans up the output data buffers that we persist for
ExtHost to finish processing the data


CleanupSession Description : Cleans up the output data buffers that we persist for ExtHost to finish processing the data
SQLRETURN CleanupSession(
	SQLGUID      sessionId,
	SQLUSMALLINT taskId
)
{
	LOG("RExtension::CleanupSession");
	SQLRETURN result = SQL_ERROR;
	try
	{
		RSession* session = CheckAndGetSession("CleanupSession", sessionId, taskId);
		if (session != nullptr)
		{
			session->Cleanup();
			string sessionIdString = Utilities::ConvertGuidToString(&sessionId);
			g_RSessionMap.erase(sessionIdString);
		}
		result = SQL_SUCCESS;
	}
	catch (const exception &ex)
	{
		LOG_EXCEPTION(ex);
	}
	catch (...)
	{
		LOG_ERROR("Unexpected exception occurred in function CleanupSession().");
	}
	return result;
}
SQLRETURN CleanupSession ( SQLGUID sessionId , SQLUSMALLINT taskId ) { LOG ( " " ) ; SQLRETURN result = SQL_ERROR ; try { RSession * session = CheckAndGetSession ( " " , sessionId , taskId ) ; if ( session != nullptr ) { session -> Cleanup ( ) ; string sessionIdString = Utilities :: ConvertGuidToString ( & sessionId ) ; g_RSessionMap . erase ( sessionIdString ) ; } result = SQL_SUCCESS ; } catch ( const exception & ex ) { LOG_EXCEPTION ( ex ) ; } catch ( ... ) { LOG_ERROR ( " " ) ; } return result ; }
Name: CleanupSession
Description:
Cleans up the output data buffers that we persist for
ExtHost to finish processing the data
Name : CleanupSession Description : Cleans up the output data buffers that we persist for ExtHost to finish processing the data
// Clean up the session; it could be nullptr in case of library sessions // because we don't add library sessions to the map. //