|Oracle® Objects for OLE C++ Class Library Developer's Guide
10g Release 1 (10.1)
Part Number B10119-01
This method returns the associated database object by way of an ODatabase handle.
ODatabase GetDatabase(void) const
Given an Odynaset, Obinder, or an OSqlStmt object, you can obtain an ODatabase object, which you can then use to access the Odynaset's, Obinder's, or OSqlStmt's database. Note that this does not create another database object; rather, it returns another ODatabase that is a handle for an already existing database object.
An ODatabase, which will be open on success, closed on failure.
This example assumes that we have been working with an ODynaset object and now we want to execute a general SQL statement on the database.
// we've got an open ODynaset named workdyn
// get an ODatabase from workdyn
ODatabase workdb = workdyn.GetDatabase();
// now execute an SQL statement
workdb.ExecuteSQL("drop table tempwork");
// to do just one thing, we don't even need an ODatabase instance
// so we could have said
workdyn.GetDatabase().ExecuteSQL("drop table tempwork");