language-extensions/python/src/PythonExtension.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("CleanupSession");
	SQLRETURN result = SQL_SUCCESS;
	string session = PythonExtensionUtils::ConvertGuidToString(&sessionId);
	try
	{
		if (g_pySessionMap.count(session) > 0)
		{
			g_pySessionMap[session]->Cleanup();
			delete g_pySessionMap[session];
			g_pySessionMap.erase(session);
		}
	}
	catch (const exception &ex)
	{
		result = SQL_ERROR;
		LOG_ERROR(ex.what());
	}
	catch (const bp::error_already_set&)
	{
		result = SQL_ERROR;
		LOG_ERROR("Python error: " + PythonExtensionUtils::ParsePythonException());
	}
	catch (...)
	{
		result = SQL_ERROR;
		LOG_ERROR("Unexpected exception occurred in function CleanupSession()");
	}
	return result;
}
SQLRETURN CleanupSession ( SQLGUID sessionId , SQLUSMALLINT taskId ) { LOG ( " " ) ; SQLRETURN result = SQL_SUCCESS ; string session = PythonExtensionUtils :: ConvertGuidToString ( & sessionId ) ; try { if ( g_pySessionMap . count ( session ) > 0 ) { g_pySessionMap [ session ] -> Cleanup ( ) ; delete g_pySessionMap [ session ] ; g_pySessionMap . erase ( session ) ; } } catch ( const exception & ex ) { result = SQL_ERROR ; LOG_ERROR ( ex . what ( ) ) ; } catch ( const bp :: error_already_set & ) { result = SQL_ERROR ; LOG_ERROR ( " " + PythonExtensionUtils :: ParsePythonException ( ) ) ; } catch ( ... ) { result = SQL_ERROR ; 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