Source Code Changes
Changes have been made in RaimaDB 16.0 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 RaimaDB 16.0, you may need to take additional steps to make your application compatible with RaimaDB 16.0. 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 RaimaDB 16.0 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 specificDBUSERID
, this call may be safely removed. - Since the recovery mechanism has changed, the
d_open()
function will not returnS_UNAVAIL
if it is performing recovery. Nor will a retry ofd_open()
work after a short wait. - Database addresses (data type
DB_ADDR
) are structures, not scalar values. Therefore, assignment to aDB_ADDR
and a test of aDB_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()
andd_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 thed_open_ptr()
ord_iopen_ptr()
functions. - The
DEFAULT_TASK
macro is deprecated in RDM 12 and no longer available in RaimaDB 16.0. Change your application to explicitly allocate anRDM_TASK
object by callingd_opentask()
.
Unicode handling
Unicode handling has changed between older versions of RDM and RDM 12, and again between RDM 12 and RaimaDB 16.0.
In RaimaDB 16.0, 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 RaimaDB 16.0. We use the following database definition to illustrate the differences.
school.ddl (RDM 12) | school.sdl (RaimaDB 16.0) |
---|---|
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 RaimaDB 16.0, respectively.
school.h (RDM 12) | school_structs.h (RaimaDB 16.0) |
---|---|
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:
- C structures are now
typedef
'd with names. - Constants to identify items, such as tables, columns, keys and sets, have been replaced with enumerations. Each enumeration starts with
TABLE_
,COL_
,KEY_
orREF_
depending on the type of the item. - 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 RaimaDB 16.0 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 RaimaDB 16.0.
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.