Products Support Documentation Download
Macros | Functions
Core06.c File Reference

Source code for the RDM core06 example. More...

#include <stdio.h>
#include <string.h>
#include "print_error.h"
#include "rdm.h"
#include "core06_db_structs.h"
#include "core06_db_cat.h"

Macros

#define RLEN(x)   (sizeof (x) / sizeof (x[0]))
 Macro to determine number of elements in an array of ptrs.
 

Functions

RDM_RETCODE openEmptyDatabase (RDM_DB *pDB)
 Initialize the RDM runtime library for use in the core06 example. More...
 
void cleanup (RDM_DB hDB)
 Cleanup the RDM runtime library. More...
 
RDM_RETCODE insertArtist (RDM_DB hDB, const char *artistName)
 Insert an artis. More...
 
RDM_RETCODE insertAlbum (RDM_DB hDB, const char *artistName, const char *albumTitle, const char **trackList, size_t listSize)
 Insert an artist and all of the albums associated with the artist. More...
 
RDM_RETCODE readAllAlbums (RDM_DB hDB)
 Read all the artists and the associated albums and tracks. More...
 
int main (void)
 Main function for core06 example. More...
 

Detailed Description

Source code for the RDM core06 example.

Function Documentation

◆ cleanup()

void cleanup ( RDM_DB  hDB)

Cleanup the RDM runtime library.

This functions closes all open databases and cleans up the RDM runtime task used in the core06 example.

Returns
Returns an RDM_RETCODE code (sOKAY if successful)
Parameters
[out]hDB[out] Pointer to the DB handle to be terminated

◆ insertAlbum()

RDM_RETCODE insertAlbum ( RDM_DB  hDB,
const char *  artistName,
const char *  albumTitle,
const char **  trackList,
size_t  listSize 
)

Insert an artist and all of the albums associated with the artist.

This function adds one more row to the ARTIST table in the core03 database and one to many rows to the ALBUM table associated with the given artist.

Returns
Returns an RDM_RETCODE code (sOKAY if successful)
Parameters
[in]hDB[in] Database handle to open database
[in]artistName[in] Name of the artist
[in]albumTitle[in] Artist name to insert
[in]trackList[in] List of album names for the artist
[in]listSize[in] Number of album names in the list

◆ insertArtist()

RDM_RETCODE insertArtist ( RDM_DB  hDB,
const char *  artistName 
)

Insert an artis.

This function adds one more row to the ARTIST table in the core03 database.

Returns
Returns an RDM_RETCODE code (sOKAY if successful)
Parameters
[in]hDB[in] Database handle to open database
[in]artistName[in] Artist name to insert

◆ main()

int main ( void  )

Main function for core06 example.

The function initializes the RDM environment and runs the create, read operations.

Returns
Returns the RDM_RETCODE on exit.

◆ openEmptyDatabase()

RDM_RETCODE openEmptyDatabase ( RDM_DB *  pDB)

Initialize the RDM runtime library for use in the core06 example.

This function initializes the RDM Transactional File Server (TFS) to use the EMBEDED TFS implementation. It also allocates a database handle and opens the "core06" database in exclusive mode. Exclusve mode does not require database locks or transactions.

Returns
Returns RDM_RETCODE status code (sOKAY if successful)
Parameters
[out]pDB[out] Pointer to the RDM database handle

◆ readAllAlbums()

RDM_RETCODE readAllAlbums ( RDM_DB  hDB)

Read all the artists and the associated albums and tracks.

This function reads and displays each row from the ARTIST table in the core06 database and the ALBUMS and TRACKS associated with the artist.

Returns
Returns an RDM_RETCODE code (sOKAY if successful)
Parameters
[in]hDB[in] Database handle to open database