language-extensions/R/test/src/RExtensionGetResultColumnTests.cpp
//----------------------------------------------------------------------------------------------
// Name: GetEmptyResultColumnTest
//
// Description:
//  Tests GetResultColumn with a script that returns OutputDataSet with empty rows.
//
GetEmptyResultColumnTest
Description:
Tests GetResultColumn with a script that returns OutputDataSet with empty rows.
GetEmptyResultColumnTest Description : Tests GetResultColumn with a script that returns OutputDataSet with empty rows .
TEST_F(RExtensionApiTests, GetEmptyResultColumnTest)
	{
		string scriptString = ""
			"OutputDataSet <- data.frame(intCol = as.integer(c()))\n"
			"message(OutputDataSet)";
		InitializeSession(
			0,              inputSchemaColumnsNumber
			scriptString);
		SQLUSMALLINT outputschemaColumnsNumber = 0;
		SQLRETURN result = (*sm_executeFuncPtr)(
			*m_sessionId,
			m_taskId,
			0,
			nullptr,
			nullptr,
			&outputschemaColumnsNumber);
		ASSERT_EQ(result, SQL_SUCCESS);
		EXPECT_EQ(outputschemaColumnsNumber, 1);
		GetResultColumn(0,  columnNumber
			SQL_C_SLONG,    dataType
			m_IntSize,      columnSize
			0,              decimalDigits
			SQL_NO_NULLS);  nullable
	}
TEST_F ( RExtensionApiTests , GetEmptyResultColumnTest ) { string scriptString = " " " \n " " " ; InitializeSession ( 0 , scriptString ) ; SQLUSMALLINT outputschemaColumnsNumber = 0 ; SQLRETURN result = ( * sm_executeFuncPtr ) ( * m_sessionId , m_taskId , 0 , nullptr , nullptr , & outputschemaColumnsNumber ) ; ASSERT_EQ ( result , SQL_SUCCESS ) ; EXPECT_EQ ( outputschemaColumnsNumber , 1 ) ; GetResultColumn ( 0 , SQL_C_SLONG , m_IntSize , 0 , SQL_NO_NULLS ) ; }
Name: GetEmptyResultColumnTest
Description:
Tests GetResultColumn with a script that returns OutputDataSet with empty rows.
Name : GetEmptyResultColumnTest Description : Tests GetResultColumn with a script that returns OutputDataSet with empty rows .
// Initialize with a Session that executes the above script // that creates an empty row 1 column OutputDataSet. // // inputSchemaColumnsNumber // columnNumber // dataType // columnSize // decimalDigits // nullable