Programming Guide



dm_init

Initializes access to a specific database engine

#include <dmuproto.h>
int dm_init(char *engine, int support_function, int case, char *arg);

engine
A name you assign to the engine. If an application uses two or more engines, the application uses the mnemonic engine to indicate a particular DBMS. Most examples in the guide use a vendor name as the mnemonic, for example sybase or oracle, but any character string that is not a keyword is valid. For a list of keywords, refer to Chapter 13, "Keywords in Database Drivers." If engine is already installed, dm_init returns 0.

support_function
One of the function names documented in the dbiinit.c file. The file name is usually in the form dm_vendorsup where vendor is an abbreviated vendor name. For example:
dm_sybsup
dm_orasup
dm_intsup

case
Sets the case processing for the specified engine. The constants are shown in Table 5-4 in Description.

arg
Reserved for future use. Set this parameter to 0.

Environment

C only

Returns

Description

Before an application can access a database, Panther must perform an engine initialization. The initialization adds the engine name to the list of available engines, allocates a data structure for the engine, calls the engine's support function to initialize the data structure, and sets case handling for the engine. You can use the vendor_list structure in dbiinit.c to initialize an engine at startup or else use dm_init to initialize an engine at a later point in the application.

The case parameter specifies how Panther uses case to map column names to variables when executing a SELECT statement. Table 5-4 lists the available options.

Table 5-4 Database engine case constants

Constant Description

DM_DEFAULT_CASE

Use the case option set in the support function for that engine. For information on this setting, refer to the documentation for "Database Drivers."

DM_PRESERVE_CASE

Use case exactly as returned by the engine.

DM_FORCE_TO_UPPER_CASE

Force all column names returned by an engine to upper case. Therefore, the application should use upper case names for Panther variables.

DM_FORCE_TO_LOWER_CASE

Force all column names returned by an engine to lower case. Therefore, the application should use lower case names for Panther variables.

After the engine is initialized, the application can declare a connection on it.

Example

#include <dmerror.h>
#include <smusrdbi.h>

int retcode;

retcode = dm_init("jdb", dm_jdbsup, DM_DEFAULT_CASE, 0);

See Also

dm_reset