isc_version()

From InterBase

Go Up to API Function Reference


Returns database implementation and version information.

Syntax

 int isc_version(
 isc_db_handle *db_handle,
 isc_callback function_name,
 void *user_arg);
Parameter Type Description

db_handle

isc_db_handle *

  • Pointer to a database handle set by a previous call to ­isc_attach_database().
  • db_handle returns an error in status_vector if it is NULL.

function_name

isc_callback

  • Pointer to a function to call with the relevant information.
  • Passing a NULL pointer in C programs calls printf().

user_arg

void *

An application-specified parameter to pass as the first of two arguments to function_name.

Description

isc_version() determines the database implementation and on-disk structure (ODS) version numbers for the database specified by db_handle. It passes this information in two separate calls to the callback function pointed to by ­function_name.

function_name should point to an application function that takes two arguments: a void pointer, user_arg, and a char pointer. Applications can pass any kind of parameter desired in user_arg.

isc_version() makes two calls to function_name. First it determines the database implementation number, builds a string containing the information, and calls function_name with user_arg, and a pointer to the string containing the implementation number in the following format:

<implementation>(<class>), version "<version>"

where:

  • implementation is a text string, such as “InterBase/NT”.
  • class is a text string specifying the implementation class, such as “access method”.
  • version is a version identification string, such as “8.0”. Note that InterBase 2007 is equivalent to version 8.0 of the InterBase code, so use 8.0 for this call.
  • The callback function specified by function_name is free to do with this information what it pleases.

After the callback function returns control to isc_version(), isc_version() builds a new string containing the ODS major and minor version numbers, then calls function_name a second time with user_arg, and a pointer to the string containing the ODS version number in the following format:

on disk structure version <ods_major_num>.<ods_minor_num>

where:

  • ods_major_num is the major ODS number. A server can always access a database that has the same major ODS as the server. When possible, CodeGear ensures that InterBase servers can access databases that are one major ODS older as well.
  • ods_minor_num is the minor ODS number. Differences in the minor ODS number do not affect database access.
Tip: If a NULL pointer is passed for function_name, isc_version() sets ­function_name to point to the C printf() function.

Examples

The following code fragment calls isc_version() with a NULL callback function:

#include <ibase.h>
. . .
int ret;
. . .
ret = isc_version(&db1, NULL, "\t%s\n");

Return value

If successful, isc_version() returns 0. Otherwise, it returns a nonzero value.

See Also

Advance To: