Share this page

# lrd_init

Initializes the LRD environment.

    LRDRET lrd_init( LRD_INIT_INFO *mptInitInfo, LRD_DEFAULT_DB_VERSION *mpatDefaultDBVersion);

mptInitInfo | A pointer to an LRD_INIT_INFOstructure.
mpatDefaultDBVersion | The DBTypeVersion parameter which points to an array of the default Database Versions.

The lrd_init function sets up the LRD_INIT_INFO structure that contains initialization information for the LRD environment. This function is called once within a script, and precedes all other LRD function calls.

You can get the initialization information for your site by recording a script using the query tool for your database manager. If you use Oracle, for example, record with SQL*Plus. It is recommended not to attempt to enter this information manually in a script .

For more details refer to the Function Header File lrd.h in the include directory.

## Return Values

See LRD Return Values.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lrd_init sets up the environment in the vuser_init section. Static variables `InitInfo` and `DBTypeVersion` are used as arguments.

    #include "lrd.h"

    /* This declaration should appear on your site exactly as it appears here. Do not change any of the fields of the structure. */

    static LRD_INIT_INFO InitInfo = {LRD_INIT_INFO_EYECAT};

    /* This declaration should be recorded at your site. Do not edit it. *

    static LRD_DEFAULT_DB_VERSION DBTypeVersion[] =
    {
        {LRD_DBTYPE_NONE, LRD_DBVERSION_NONE}
    };

    static void FAR *    OraEnv1;
    static void FAR *    OraSvc1;
    static void FAR *    OraSrv1;
    static void FAR *    OraSes1;

    vuser_init()
    {
        lrd_init(&InitInfo, DBTypeVersion);
        /* The second argument (2) initializes
            Oracle in object-relational mode*/

        lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);
        lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);

        // Allocate server, service context, and session handles

        lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
        lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
        lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);

        // The second argument is the name of the server being used.

        lrd_server_attach(OraSrv1, "db_server_1", -1, 0, 0);
        lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);

        // The third argument is the name of the user.

        lrd_ora8_attr_set(OraSes1, USERNAME, "henry", -1, 0);

        // The third argument is the password of the user.

        lrd_ora8_attr_set(OraSes1, PASSWORD, "tilden", -1, 0);
        lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
        lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
    }

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: