Reputation: 11
I have a table with multiple VARCHAR2(n) columns ('n' differs for each column). I access the table from a C++ application via OCCI library. Is there a way to get this limit value (n) for a column using the OCCI library?
Upvotes: 1
Views: 151
Reputation: 109
That can be done using MetaData. Here is the sample:
MetaData metaData = connection->getMetaData((utext*)L"\"TableName\"", MetaData::PTYPE_TABLE);
vector<MetaData> metaDataVector = metaData.getVector(MetaData::ATTR_LIST_COLUMNS);
for (UINT i = 0; i < (UINT)metaDataVector.size(); i++)
{
if(metaDataVector[i].getInt(MetaData::ATTR_DATA_TYPE) == OCCI_SQLT_CHR)
columnInfo.size = metaDataVector[i].getInt(MetaData::ATTR_DATA_SIZE);
}
Upvotes: 0