Source code for the RDM core04 example. More...
#include <stdio.h>
#include <string.h>
#include "print_error.h"
#include "rdm.h"
#include "core04_db_structs.h"
#include "core04_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 core04 example. More... | |
RDM_RETCODE | insertArtist (RDM_DB hDB, const char *artistName, RDM_CURSOR *artistCursor) |
Insert an artist. More... | |
RDM_RETCODE | insertAlbum (RDM_DB hDB, RDM_CURSOR artistCursor, const char *albumTitle, const char **trackList, size_t listSize) |
Insert 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 core04 example. More... | |
Source code for the RDM core04 example.
RDM_RETCODE insertAlbum | ( | RDM_DB | hDB, |
RDM_CURSOR | artistCursor, | ||
const char * | albumTitle, | ||
const char ** | trackList, | ||
size_t | listSize | ||
) |
Insert 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 this version of the example, the function will obtain the ID for the artist and insert it into the record. This will automatically generate the reference links between the artist and the album on insert rather than later using the rdm_cursorLinkRow() function like the Core03 popcorn example.
[in] | hDB | Database handle to open database |
[in] | artistCursor | Cursor of the artist |
[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, |
const char * | artistName, | ||
RDM_CURSOR * | artistCursor | ||
) |
Insert an artist.
This function adds one more row to the ARTIST table in the core03 database.
[in] | hDB | Database handle to open database |
[in] | artistName | Artist name to insert |
[out] | artistCursor | Cursor to the the row we just inserted |
int main | ( | void | ) |
Main function for core04 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 core04 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 "core04" database in exclusive mode. Exclusve mode does not require database locks or transactions.
[out] | pDB | Pointer to the RDM database handle |
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 core04 database and the ALBUMS and TRACKS associated with the artist.
[in] | hDB | Database handle to open database |