language-extensions/python/src/PythonExtension.cpp
//-------------------------------------------------------------------------------------------------
// Name: Execute
//
// Description:
//  Given the data from ExtHost, convert and populate the arrays in the user python program. Then,
//  invoke the specified function and retrieve the output schema and convert the data back to
//  ODBC types.
//
// Returns:
//  SQL_SUCCESS on success, else SQL_ERROR
//

Execute
Description:
Given the data from ExtHost, convert and populate the arrays in the user python program. Then,
invoke the specified function and retrieve the output schema and convert the data back to
ODBC types.


Execute Description : Given the data from ExtHost convert and populate the arrays in the user python program . Then invoke the specified function and retrieve the output schema and convert the data back to ODBC types .
SQLRETURN Execute(
	SQLGUID      sessionId,
	SQLUSMALLINT taskId,
	SQLULEN      rowsNumber,
	SQLPOINTER   *data,
	SQLINTEGER   **strLen_or_Ind,
	SQLUSMALLINT *outputSchemaColumnsNumber
)
{
	LOG("Execute");
	SQLRETURN result = SQL_SUCCESS;
	string session = PythonExtensionUtils::ConvertGuidToString(&sessionId);
	try
	{
		g_pySessionMap[session]->ExecuteWorkflow(rowsNumber,
									data,
									strLen_or_Ind,
									outputSchemaColumnsNumber);
	}
	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 Execute()");
	}
	return result;
}
SQLRETURN Execute ( SQLGUID sessionId , SQLUSMALLINT taskId , SQLULEN rowsNumber , SQLPOINTER * data , SQLINTEGER * * strLen_or_Ind , SQLUSMALLINT * outputSchemaColumnsNumber ) { LOG ( " " ) ; SQLRETURN result = SQL_SUCCESS ; string session = PythonExtensionUtils :: ConvertGuidToString ( & sessionId ) ; try { g_pySessionMap [ session ] -> ExecuteWorkflow ( rowsNumber , data , strLen_or_Ind , outputSchemaColumnsNumber ) ; } 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: Execute
Description:
Given the data from ExtHost, convert and populate the arrays in the user python program.
Name : Execute Description : Given the data from ExtHost convert and populate the arrays in the user python program .