Home » Developer & Programmer » Precompilers, OCI & OCCI » getColumnListMetaData problem
getColumnListMetaData problem [message #410269] Thu, 25 June 2009 22:59
oraworker
Messages: 1
Registered: June 2009
Junior Member
Hi,

I tried to use the following code to retrieve meta data. However, the code crashes when it leaves the try clause (after the for loop finishes). The error message is "Debug Assertion Failed" at dbgdel.cpp line 52. Could anyone please help me resolve the problem?

Thanks.

int main()
{
	Environment * env;
	Connection  * conn;
	Statement * stmt;
	ResultSet * resultSet;

	try
	{
		env  = Environment::createEnvironment(Environment::OBJECT);
		conn = env->createConnection("xxx", "xxx", "xxx");

		stmt = conn->createStatement("select * from training_security");
		resultSet = stmt->executeQuery();

		vector<MetaData> selectcols = resultSet->getColumnListMetaData();

		int columnCount = selectcols.size();
		for (int i = 0; i < columnCount; i++)
		{
			cout << "column name" << selectcols[i].getString(MetaData::ATTR_NAME) << endl;
			cout << "column type" << selectcols[i].getInt(MetaData::ATTR_DATA_TYPE) << endl;
		}
		
	}
	catch (SQLException &ex)
	{//cleanup
		cout << "Error, cleaning up..." << ex.getMessage() << endl;	
	}

	// Close ResultSet and Statement
    stmt->closeResultSet(resultSet);
    conn->terminateStatement(stmt);
	env->terminateConnection(conn);
	Environment::terminateEnvironment(env);
}  
Previous Topic: Unable to connect to oracle when compiling the demo proc program with 32bit
Next Topic: What are the types of Project that uses Pro *c
Goto Forum:
  


Current Time: Fri Dec 02 16:56:21 CST 2016

Total time taken to generate the page: 0.35359 seconds