language-extensions/python/src/PythonParam.cpp
//-------------------------------------------------------------------------------------------------
// Name: PythonRawParam::RetrieveValueAndStrLenInd
//
// Description:
//  Retrieves the value from the namespace and populates m_value and m_strLenOrInd
//

:RetrieveValueAndStrLenInd
Description:
Retrieves the value from the namespace and populates m_value and m_strLenOrInd
: RetrieveValueAndStrLenInd Description : Retrieves the value from the namespace and populates m_value and m_strLenOrInd
void PythonRawParam::RetrieveValueAndStrLenInd(bp::object mainNamespace)
{
	bp::dict dictNamespace = bp::extract<bp::dict>(mainNamespace);
	if (dictNamespace.has_key(m_name))
	{
		bp::object tempObj = mainNamespace[m_name];
		m_strLenOrInd = SQL_NULL_DATA;
		if (!tempObj.is_none())
		{
			bp::stl_input_iterator<SQLCHAR> begin(tempObj), end;
			m_value = vector<SQLCHAR>(begin, end);
			if (m_value.empty()) 
			{
				m_value.push_back(L'\0');
				m_strLenOrInd = 0;
			}
			if (m_value.size() > m_size)
			{
				m_value.resize(m_size);
				m_value.shrink_to_fit();
			}
			if (m_strLenOrInd == SQL_NULL_DATA)
			{
				m_strLenOrInd = m_value.size();
			}
		}
	}
}
void PythonRawParam :: RetrieveValueAndStrLenInd ( bp :: object mainNamespace ) { bp :: dict dictNamespace = bp :: extract < bp :: dict > ( mainNamespace ) ; if ( dictNamespace . has_key ( m_name ) ) { bp :: object tempObj = mainNamespace [ m_name ] ; m_strLenOrInd = SQL_NULL_DATA ; if ( ! tempObj . is_none ( ) ) { bp :: stl_input_iterator < SQLCHAR > begin ( tempObj ) , end ; m_value = vector < SQLCHAR > ( begin , end ) ; if ( m_value . empty ( ) ) { m_value . push_back ( L' \0 ' ) ; m_strLenOrInd = 0 ; } if ( m_value . size ( ) > m_size ) { m_value . resize ( m_size ) ; m_value . shrink_to_fit ( ) ; } if ( m_strLenOrInd == SQL_NULL_DATA ) { m_strLenOrInd = m_value . size ( ) ; } } } }
Name: PythonRawParam::RetrieveValueAndStrLenInd
Description:
Retrieves the value from the namespace and populates m_value and m_strLenOrInd
Name : PythonRawParam :: RetrieveValueAndStrLenInd Description : Retrieves the value from the namespace and populates m_value and m_strLenOrInd
// The uninitialized iterator is equivalent to the end of the iterable
 //
 // Copy the py_buffer into a local buffer.
 //
 // Truncate the return data to only be the size specified when creating
 //
