Source code for the RDM core06 example. More...
#include <stdio.h>
#include <string.h>
#include "rdm.h"
#include "core06_db_structs.h"
#include "core06_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 | 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, 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 | readAllAlbums (RDM_DB hDB) |
Read all the artists and the associated albums and tracks. More... | |
int | main (void) |
Main function for core06 example. More... | |
Source code for the RDM core06 example.
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.
[out] | hDB | Pointer to the DB handle to be terminated |
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.
[in] | hDB | Database handle to open database |
[in] | artistName | Name of the artist |
[in] | albumID | Unique albumID number |
[in] | albumTitle | Artist name to insert |
[in] | trackList | List of album names for the artist |
[in] | listSize | Number of album names in the list |
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.
[in] | hDB | Database handle to open database |
[in] | artistID | Unique ID for artist |
[in] | artistName | Artist name to insert |
int main | ( | void | ) |
Main function for core06 example.
The function initializes the RDM environment and runs the create, read operations.
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.
[out] | pDB | Pointer to the RDM database handle |
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.
[in] | rc | RDM_RETCODE to analyze |
[in] | file | Sourcec filename |
[in] | line | Lineno in source file |
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.
[in] | hDB | Database handle to open database |