language-extensions/R/src/RSession.cpp
//--------------------------------------------------------------------------------------------------
// Name: RSession::GetResultColumn
//
// Description:
//  Returns information about the output column.
//
:GetResultColumn
Description:
Returns information about the output column.
: GetResultColumn Description : Returns information about the output column .
void RSession::GetResultColumn(
	SQLUSMALLINT columnNumber,
	SQLSMALLINT  *dataType,
	SQLULEN      *columnSize,
	SQLSMALLINT  *decimalDigits,
	SQLSMALLINT  *nullable)
{
	LOG("RSession::GetResultColumn for column #" + to_string(columnNumber));
	*dataType = SQL_UNKNOWN_TYPE;
	*columnSize = 0;
	*decimalDigits = 0;
	*nullable = 0;
	if (columnNumber >= m_outputDataSet.GetVectorColumnsNumber())
	{
		throw invalid_argument("Invalid column #" + to_string(columnNumber)
			+ " provided to GetResultColumn().");
	}
	const vector<unique_ptr<RColumn>>& resultColumns = m_outputDataSet.Columns();
	RColumn *resultColumn = resultColumns[columnNumber].get();
	if (resultColumn != nullptr)
	{
		*dataType = resultColumn->DataType();
		*columnSize = resultColumn->Size();
		*decimalDigits = resultColumn->DecimalDigits();
		*nullable = resultColumn->Nullable();
	}
	else
	{
		throw runtime_error("ResultColumn #" + to_string(columnNumber) +
			" is not initialized for the output dataset.");
	}
}
void RSession :: GetResultColumn ( SQLUSMALLINT columnNumber , SQLSMALLINT * dataType , SQLULEN * columnSize , SQLSMALLINT * decimalDigits , SQLSMALLINT * nullable ) { LOG ( " " + to_string ( columnNumber ) ) ; * dataType = SQL_UNKNOWN_TYPE ; * columnSize = 0 ; * decimalDigits = 0 ; * nullable = 0 ; if ( columnNumber >= m_outputDataSet . GetVectorColumnsNumber ( ) ) { throw invalid_argument ( " " + to_string ( columnNumber ) + " " ) ; } const vector < unique_ptr < RColumn > > & resultColumns = m_outputDataSet . Columns ( ) ; RColumn * resultColumn = resultColumns [ columnNumber ] . get ( ) ; if ( resultColumn != nullptr ) { * dataType = resultColumn -> DataType ( ) ; * columnSize = resultColumn -> Size ( ) ; * decimalDigits = resultColumn -> DecimalDigits ( ) ; * nullable = resultColumn -> Nullable ( ) ; } else { throw runtime_error ( " " + to_string ( columnNumber ) + " " ) ; } }
Name: RSession::GetResultColumn
Description:
Returns information about the output column.
Name : RSession :: GetResultColumn Description : Returns information about the output column .