The default database properties are suitable for most c-treeDB applications. Advanced developers may need to tune c-treeDB to meet application requirements.
Once the database object connects, retrieve the database name with CTDatabase::GetName().
// display the database name
printf("Database: %s\n", ADatabase.GetName().c_str());
The database path, by default, is the server directory for client/server applications, or the application directory for non-server applications. To set a different database path, when the database is being created, just insert the appropriate path as the second parameter of CTSession::CreateDatabase(). With this information stored in the Session dictionary, the user does not need to know where it is located, since it will be automatically retrieved given the database name.
Once the database is successfully connected to a session, obtain the database path with CTDatabase::GetPath().
// display database properties
void DisplayDatabaseProperties(CTDatabase &ADatabase)
{
printf("Database: %s\n", ADatabase.GetName().c_str());
printf("Path: %s\n", ADatabase.GetPath().c_str());
printf("Number of tables: %d\n", ADatabase.GetTableCount());
}
CTDatabase::GetTableCount() retrieves the number of tables associated with a database. CTDatabase::GetTableCount() return -1 (minus 1) if the database is not connected or if the database object is invalid.
// display the number of tables in database
printf("Number of tables: %d\n", ADatabase.GetTableCount());