language-extensions/R/src/RSession.cpp
//--------------------------------------------------------------------------------------------------
// Name: RSession::ExecuteWorkflow
//
// Description:
//  Executes the workflow for the session
//
:ExecuteWorkflow
Description:
Executes the workflow for the session
: ExecuteWorkflow Description : Executes the workflow for the session
void RSession::ExecuteWorkflow(
	SQLULEN      rowsNumber,
	SQLPOINTER   *data,
	SQLINTEGER   **strLen_or_Ind,
	SQLUSMALLINT *outputSchemaColumnsNumber)
{
	LOG("RSession::ExecuteWorkflow");
	m_inputDataSet.AddColumnsToDataFrame(rowsNumber, data, strLen_or_Ind);
	 Add the DataFrame for InputDataSet to the R environment.
	m_inputDataSet.AddDataFrameToEmbeddedR();
	 Execute the script, any standard output or error is flushed to the console.
	ExecuteScript(m_script);
	 In case of streaming clean up the previous stream batch's output buffers
	if (m_isStreaming)
	{
		m_outputDataSet.CleanupColumns();
	}
	 After script evaluation, retrieve the DataFrame for OutputDataSet.
	m_outputDataSet.RetrieveDataFrameFromEmbeddedR();
	 Get the column number from the underlying DataFrame
	 and set it to be the outputSchemaColumnsNumber.
	*outputSchemaColumnsNumber = m_outputDataSet.GetDataFrameColumnsNumber();
	if (*outputSchemaColumnsNumber > 0)
	{
		m_outputDataSet.GetColumnsDataType();
		m_outputDataSet.PopulateRowsNumber();
		m_outputDataSet.GetColumnsFromDataFrame();
	}
}
void RSession :: ExecuteWorkflow ( SQLULEN rowsNumber , SQLPOINTER * data , SQLINTEGER * * strLen_or_Ind , SQLUSMALLINT * outputSchemaColumnsNumber ) { LOG ( " " ) ; m_inputDataSet . AddColumnsToDataFrame ( rowsNumber , data , strLen_or_Ind ) ; m_inputDataSet . AddDataFrameToEmbeddedR ( ) ; ExecuteScript ( m_script ) ; if ( m_isStreaming ) { m_outputDataSet . CleanupColumns ( ) ; } m_outputDataSet . RetrieveDataFrameFromEmbeddedR ( ) ; * outputSchemaColumnsNumber = m_outputDataSet . GetDataFrameColumnsNumber ( ) ; if ( * outputSchemaColumnsNumber > 0 ) { m_outputDataSet . GetColumnsDataType ( ) ; m_outputDataSet . PopulateRowsNumber ( ) ; m_outputDataSet . GetColumnsFromDataFrame ( ) ; } }
Name: RSession::ExecuteWorkflow
Description:
Executes the workflow for the session
Name : RSession :: ExecuteWorkflow Description : Executes the workflow for the session
// Add columns to the input DataFrame. // // Add the DataFrame for InputDataSet to the R environment. // // Execute the script, any standard output or error is flushed to the console. // // In case of streaming clean up the previous stream batch's output buffers // // After script evaluation, retrieve the DataFrame for OutputDataSet. // // Get the column number from the underlying DataFrame // and set it to be the outputSchemaColumnsNumber. //