db_get_generation()

Purpose

Obtains the latest generation of the active database

Old name

#define get_generation db_get_generation

Syntax (CCOWN)

int db_get_generation(void);

Syntax (DP4DBAPI)

int dp4_db_get_generation(DCONN * dconn);

Description

The db_get_generation() function obtains the generation number of the active database. It does not change the generation in which the database is currently opened. For CCOWN prograsm this is determined by the global variable db_generation. For DP4DBAPI programs it is determined by the generation specified in the call to dp4_db_open()

To open a database at the latest generation, call the function db_open() with a generation of 0, then either set the global variable db_generation to the value returned by the function db_get_generation(), or call db_open()/dp4_db_open() again, this time specifying the return value from this function. Please refer to the advice given in the information on db_generation.

Return values

Returns the latest generation number

See also

open_database()