DbiAddDriver

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiAddDriver

Return to chapter overview

C syntax

DBIResult DbiAddDriver( [hCfg], pszDriverName, pszParams, bPersistent );

Delphi syntax

function DbiAddDriver (hCfg: hDBICfg; pszDriverName: PChar; pszParams: PChar; bPersist: Bool): DBIResult stdcall;

Description

Adds a driver to the configuration file specified by the parameter hCfg.

Parameters

hCfg                Type: hDBICfg                (Input)
Specifies the configuration file to be used. This parameter is required to be NULL, indicating that the new alias is added to the configuration file for the current session.

pszDriverName                Type: pCHAR                (Input)
Pointer to the driver name. This is the new driver that is to be added.

pszParams                Type: pCHAR                (Input)
Pointer to a list of optional parameters. This is a list defined as follows:

"AliasOption: Option Data[;AliasOption: Option Data][;...]"

AliasOption must correspond to a value retrieved by DbiOpenCfgInfoList. If the parameter setting contains a semicolon (;) , enclose the entire setting in quotes ("Option Data";).

bPersistent                Type: BOOL                (Input)
This determines the scope of the new alias:
  TRUE                Stored in the configuration file for future sessions.
   FALSE                For use only in this session.

Usage

The driver added by this function will have whatever default values are associated with the driver unless they are specifically mentioned in the pszParams parameter.

Note:        All changes you make to the current session are also applied to any sessions with sesCFGUPDATE set to ON.

Prerequisites

DbiInit must be called prior to calling DbiAddDriver.

DbiResult

Meaning

DBIERR_INVALIDPARAM

Null or invalid driver name. Invalid characters include a colon (":") and backslash ("\").

DBIERR_NONE

The driver was added successfully.

DBIERR_NAMENOTUNIQUE

Another driver with the same name already exists (applicable only when bPersistent is TRUE).

DBIERR_OBJNOTFOUND

One (or more) of the optional parameters passed in through pszParams was not found as a valid type in the driver section of the configuration file.

See Also

DbiInit, DbiOpenCfgInfoList, DbiDeleteDriver, DbiAddAlias