Source Code Changes

Changes have been made in RDM 15.1 that require changes in your application source code designed to work with RDM 12 (and older) in the following categories.

Changes for pre-RDM 12 Applications (optional)

If you are migrating from a version of RDM older than 12 into RDM 15.1, you may need to take additional steps to make your application compatible with RDM 15.1. These steps involve removing the functions that were available with versions of RDM before version 12 but defunct in RDM 12 and later, as well as changing your application to accommodate the semantic changes made to the existing functions and structures.

Defunct Functions

The following functions are defunct in RDM 12 and later. They return S_DEFUNCT.

d_checkid d_dbrep d_dbtmp d_get_d_rep_type d_lmclear d_set_d_rep_type
d_cmstat d_costat d_crstat d_csstat d_ctbpath d_ctscm
d_ctscr d_dbdpath d_dbfpath d_dbmfpath d_dblog d_dbtaf
d_gtsco d_gtscr d_gtscs d_lockcomm d_lockmgr d_mapchar
d_recstat d_renclean d_renfile d_rlbclear d_rlbset d_rlbtst
d_stscm d_stsco d_stscr d_stscs d_trget d_trincrement
d_utscm d_utsco d_utscr d_utscs d_closeall  
d_ctsco d_gtscm d_recover d_setfiles d_trset  

Semantic changes

The following semantic changes have been made in RDM 12. The new semantics apply to RDM 15.1 as well unless otherwise noted.

  • Since 'x' locks on files have been eliminated, the d_initialize() function will require the database to be opened exclusively ("x").

  • The d_dbuserid() function still works as before but is not necessary. Unless there are other dependencies on a specific DBUSERID, this call may be safely removed.

  • Since the recovery mechanism has changed, the d_open() function will not return S_UNAVAIL if it is performing recovery. Nor will a retry of d_open() work after a short wait.

  • Database addresses (data type DB_ADDR) are structures, not scalar values. Therefore, assignment to a DB_ADDR and a test of a DB_ADDR variable require the use of macros:

Before RDM 12 RDM 12 and later
DB_ADDR dba = 0;
DB_ADDR dba = NULL_DBA;
If (!dba) ... 
If (DBA_ISNULL (dba)) … 
  • The prototypes of the d_decode_dba() and d_encode_dba() functions have changed. You need to change the types of the second and third parameters to these functions.
  • It is now necessary to use a const qualifier on strings containing a database name used with the d_open_ptr() or d_iopen_ptr() functions.
  • The DEFAULT_TASK macro is deprecated in RDM 12 and no longer available in RDM 15.1. Change your application to explicitly allocate an RDM_TASK object by calling d_opentask().

Unicode handling

Unicode handling has changed between older versions of RDM and RDM 12, and again between RDM 12 and RDM 15.1.

In RDM 15.1, strings passed into the Core API functions are assumed to be encoded in UTF-8. Since UTF-8 is compatible with the ASCII values, applications using only ASCII strings do not need to be changed. If your application uses other Unicode encoding such as UCS-2, UTF-16 and UTF-32, you need to convert such strings into UTF-8.

Database header file definitions

The C structure declarations and macros in database header files are generated differently between RDM 12 and 15.1. We use the following database definition to illustrate the differences.

school.ddl (RDM 12) school.sdl (RDM 15.1)
database school
{
    record student
    {
        unique key int32_t id;
        char last_name[15];
        char first_name[15];
    }
}
CREATE TABLE student
(
    id INT32 UNIQUE KEY NOT NULL,
    last_name CHAR(14) DEFAULT '' NOT NULL,
    first_name CHAR(14) DEFAULT '' NOT NULL
);

Here are the corresponding header files generated by RDM 12 and RDM 15.1, respectively.

school.h (RDM 12) school_structs.h (RDM 15.1)
struct student {
   int32_t id;
   char last_name[15];
   char first_name[15];
};

/* Record Name Constants */
#define STUDENT 10000

/* Field Name Constants */
#define ID 0L
#define LAST_NAME 1L
#define FIRST_NAME 2L

/* Set Name Constants */

/* Field Sizes */
#define SIZEOF_ID 4
#define SIZEOF_LAST_NAME 15
#define SIZEOF_FIRST_NAME 15
typedef struct STUDENT_S
{
    int32_t ID;
    char LAST_NAME[57];
    char FIRST_NAME[57];
} STUDENT;

typedef struct STUDENT_ID_KEY_S
{
    int32_t ID;
} STUDENT_ID_KEY;

/** \brief table identifiers enum */
typedef enum SCHOOL_TABLES_E
{
    TABLE_STUDENT = 0x10003
} SCHOOL_TABLES;

/** \brief column identifiers enum */
typedef enum SCHOOL_COLUMNS_E
{
    COL_STUDENT_ID = 0x00060000,
    COL_STUDENT_LAST_NAME = 0x00060001,
    COL_STUDENT_FIRST_NAME = 0x00060002
} SCHOOL_COLUMNS;

/** \brief key identifiers enum */
typedef enum SCHOOL_KEYS_E
{
    KEY_STUDENT_ID = 0x68000
} SCHOOL_KEYS;

Note the following changes:

  1. C structures are now typedef'd with names.

  2. Constants to identify items, such as tables, columns, keys and sets, have been replaced with enumerations. Each enumeration starts with TABLE_, COL_, KEY_ or REF_ depending on the type of the item.

  3. The SIZEOF_ macros have been removed.

TFS Initialization and Termination

RDM 12 supported a set of d_ functions that initialized and terminated the Transaction File Server (TFS) process in your application.

While RDM 15.1 provides legacy support for the d_ API in general, Those TFS-related d_ functions are no longer supported. In order to initialize and terminate a TFS process in your application, use the following Core API functions:

Function Name Description
rdm_rdmAllocTFS Allocate a new TFS instance
rdm_tfsSetOptions Set options for the specified TFS instance
rdm_tfsInitialize Initialize the specified TFS instance for use
rdm_tfsFree Free the specified TFS instance

The d_opentask() function now takes an additional parameter for a TFS instance. Your application must pass in an initialized TFS instance to it. Here is the signature of d_opentask() in RDM 15.1.

int32_t d_opentask (
    RDM_TFS tfs,       /**< [in] An initialized TFS instance */
    RDM_TASK *pTask    /**< [out] Pointer to a new RDM task object */
);

You may need to make additional modifications to your application depending on your database and source code.