CREATE TABLE cd (
cdid INTEGER PRIMARY KEY,
- artist INTEGER NOT NULL REFERENCES artist(id),
+ artist INTEGER NOT NULL REFERENCES artist(artistid),
title TEXT NOT NULL);
CREATE TABLE track (
trackid INTEGER PRIMARY KEY,
- cd INTEGER NOT NULL REFERENCES cd(id),
+ cd INTEGER NOT NULL REFERENCES cd(cdid),
title TEXT NOT NULL) ;
and create the sqlite database file:
use DB::Main;
use strict;
- my $schema = DB::Main->connect('dbi:SQLite:dbic_test.db');
+ my $schema = DB::Main->connect('dbi:SQLite:example.db');
# here's some of the sql that is going to be generated by the schema
# INSERT INTO artist VALUES (NULL,'Michael Jackson');
use DB::Main;
use strict;
- my $schema = DB::Main->connect('dbi:mysql:cdtestdb', 'testuser', 'testpass');
+ my $schema = DB::Main->connect('dbi:SQLite:example.db');
get_tracks_by_cd('Bad');
get_tracks_by_artist('Michael Jackson');