From: Damu on
I'm writing an application using C++ and OCCI driver.


try
{
MetaData tabInfo = conn->getMetaData( tab_name,
MetaData::PTYPE_TABLE );

if(tabInfo.getInt(tabInfo.ATTR_PTYPE) != MetaData::PTYPE_TABLE)
{
error_msg = tab_name + ". Invalid table.";
return false;
}

vector<MetaData> colsInfo =
tabInfo.getVector( MetaData::ATTR_LIST_COLUMNS );
for( unsigned int i=0; i<colsInfo.size(); i++ )
{
cout << colsInfo[i].getString( MetaData::ATTR_NAME ) << endl;
cout << colsInfo[i].getInt( MetaData::ATTR_PRECISION ) << endl;
cout << colsInfo[i].getInt( MetaData::ATTR_SCALE ) << endl;
cout << colsInfo[i].getString( MetaData::ATTR_TYPE_NAME ) << endl;
cout << colsInfo[i].getBoolean( MetaData::ATTR_IS_NULL ) << endl;
}
}
catch( SQLException & e )
{
retval = false;
string str = e.getMessage();
}

I can't get the type table's column
From: Michael Austin on
Damu wrote:
> I'm writing an application using C++ and OCCI driver.
>
>
> try
> {
> MetaData tabInfo = conn->getMetaData( tab_name,
> MetaData::PTYPE_TABLE );
>
> if(tabInfo.getInt(tabInfo.ATTR_PTYPE) != MetaData::PTYPE_TABLE)
> {
> error_msg = tab_name + ". Invalid table.";
> return false;
> }
>
> vector<MetaData> colsInfo =
> tabInfo.getVector( MetaData::ATTR_LIST_COLUMNS );
> for( unsigned int i=0; i<colsInfo.size(); i++ )
> {
> cout << colsInfo[i].getString( MetaData::ATTR_NAME ) << endl;
> cout << colsInfo[i].getInt( MetaData::ATTR_PRECISION ) << endl;
> cout << colsInfo[i].getInt( MetaData::ATTR_SCALE ) << endl;
> cout << colsInfo[i].getString( MetaData::ATTR_TYPE_NAME ) << endl;
> cout << colsInfo[i].getBoolean( MetaData::ATTR_IS_NULL ) << endl;
> }
> }
> catch( SQLException & e )
> {
> retval = false;
> string str = e.getMessage();
> }
>
> I can't get the type table's column



What does getMetaData() do? does it query a table or select from the
table and parse to get the information.

Can you query the V$ views or DBA_* views to parse the information you
are needing??