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

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

#include <stdio.h>
#include <string.h>
#include "rdm.h"
#include "core10_db_structs.h"
#include "core10_db_cat.h"

Macros

#define print_error(rc)   print_errorEx (rc, __FILE__, __LINE__)
 Standard error print macro.
 
#define RLEN(x)   (sizeof(x)/sizeof(x[0]))
 Macro to determine number of elements in an array of ptrs.
 

Functions

void print_errorEx (RDM_RETCODE rc, const char *file, int line)
 Standard error print format for popcorn examples. More...
 
RDM_RETCODE insertArtist (RDM_DB hDB, int artistID, const char *artistName)
 Insert an artis. More...
 
RDM_RETCODE insertAlbum (RDM_DB hDB, const char *artistName, int albumID, const char *albumTitle, const char **trackList, size_t listSize)
 Insert an artist and all of the albums associated with the artist. More...
 
RDM_RETCODE openPopulatedDatabase (RDM_DB *pDB)
 Initialize the RDM runtime library for use in the core10 example. More...
 
int main (void)
 Main function for core10 example. More...
 

Detailed Description

Source code for the RDM core10 example.

Function Documentation

◆ insertAlbum()

RDM_RETCODE insertAlbum ( RDM_DB  hDB,
const char *  artistName,
int  albumID,
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]hDBDatabase handle to open database
[in]artistNameName of the artist
[in]albumIDUnique albumID number
[in]albumTitleArtist name to insert
[in]trackListList of album names for the artist
[in]listSizeNumber of album names in the list

◆ insertArtist()

RDM_RETCODE insertArtist ( RDM_DB  hDB,
int  artistID,
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]hDBDatabase handle to open database
[in]artistIDUnique ID for artist
[in]artistNameArtist name to insert

◆ main()

int main ( void  )

Main function for core10 example.

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

Returns
Returns the RDM_RETCODE on exit.

◆ openPopulatedDatabase()

RDM_RETCODE openPopulatedDatabase ( RDM_DB *  pDB)

Initialize the RDM runtime library for use in the core10 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 "core10" database in exclusive mode. Exclusve mode does not require database locks or transactions.

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

◆ print_errorEx()

void print_errorEx ( RDM_RETCODE  rc,
const char *  file,
int  line 
)

Standard error print format for popcorn examples.

This demonstrates the usage of the rdm_retcodeGetName() and rdm_retcodeGetDescription() functions.

Parameters
[in]rcRDM_RETCODE to analyze
[in]fileSourcec filename
[in]lineLineno in source file