in language-extensions/java/src/JavaSession.cpp [614:677]
void JavaSession::CleanupOutputDataBuffers()
{
// Clean up OutputNullMap and the output data buffers
//
for (unsigned int i = 0; i < m_outputData.size(); ++i)
{
if (m_outputData[i] != nullptr)
{
// Since we store the pointers to output data buffers as void pointers,
// we have to recast them to their original types to destroy them. In the
// future, the types may be implemented as objects to simplify the code here.
//
switch (m_outputDataTypes[i])
{
case SQL_C_SSHORT:
delete[] reinterpret_cast<short*>(m_outputData[i]);
break;
case SQL_C_BIT:
delete[] reinterpret_cast<bool*>(m_outputData[i]);
break;
case SQL_C_SBIGINT:
delete[] reinterpret_cast<SQLBIGINT*>(m_outputData[i]);
break;
case SQL_C_SLONG:
delete[] reinterpret_cast<SQLINTEGER*>(m_outputData[i]);
break;
case SQL_C_FLOAT:
delete[] reinterpret_cast<float*>(m_outputData[i]);
break;
case SQL_C_DOUBLE:
delete[] reinterpret_cast<double*>(m_outputData[i]);
break;
case SQL_C_UTINYINT:
delete[] reinterpret_cast<unsigned short*>(m_outputData[i]);
break;
case SQL_C_WCHAR:
delete[] reinterpret_cast<jchar*>(m_outputData[i]);
break;
case SQL_C_BINARY:
delete[] reinterpret_cast<jbyte*>(m_outputData[i]);
break;
case SQL_C_TYPE_DATE:
delete[] reinterpret_cast<SQL_DATE_STRUCT*>(m_outputData[i]);
break;
case SQL_C_NUMERIC:
delete[] reinterpret_cast<SQL_NUMERIC_STRUCT*>(m_outputData[i]);
break;
case SQL_C_TYPE_TIMESTAMP:
delete[] reinterpret_cast<SQL_TIMESTAMP_STRUCT*>(m_outputData[i]);
break;
}
m_outputData[i] = nullptr;
}
// Clean up the space allocated for the output null map
//
if (m_outputNullMap[i] != nullptr)
{
delete[] m_outputNullMap[i];
m_outputNullMap[i] = nullptr;
}
}
}