Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Database properties

The default database properties are suitable for most c-treeDB applications. Advanced developers may need to tune c-treeDB to meet application requirements.

In This Section

Database name

Database path

Table count

Previous Topic

Next Topic

Database name

Once the database object connects, retrieve the database name with CTDatabase::GetName().

// display the database name

printf("Database: %s\n", ADatabase.GetName().c_str());

Previous Topic

Next Topic

Database path

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());

}

Previous Topic

Next Topic

Table count

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());

TOCIndex