core04.sdl
Schema for the core04Example_main.c example. Compile this schema using rdm-compile as follows:
rdm-compile --c-structs --lc-struct-members --catalog core04.sdl
and include the generated header file(s) as follows:
#include "core04_structs.h" #include "core04_cat.h"
and compile the following generated source file(s):
core04_cat.c
Here follows the actual schema:
/*
* EXAMPLE - Core04 for C
*
* This is the DDL (Database Definition Language) for a database implementing
* two one-to-many relationship using reference model sets. The database will
* implement the beginnings of an mp3 collection. The one (owner) side
* of the relationship is an artist records. The many (member) side of the
* relationship is the album record. There will be a second set where the one
* side is the album record and the many side is a track record.
*/
create table artist
(
artistid rowid primary key,
name char(100) not null
);
create table album
(
albumid rowid primary key,
artistid rowid not null references artist(artistid),
title char(100) not null
);
create table track
(
albumid rowid not null references album(albumid),
title char(100) not null
);