output
[1,2,3] but i am not getting how to map chapterId and versesId with
bookId
<sigh> You also didn't answer the question about multiple
occurrences of "book" so I've created an extended sample input file:
-=-=-=-=-=-
PRA 1:13 2:20 3:5
SRA 1:45 2:75 3:9
TRA 1:2 2:65 3:45
PRA 3:6-10
2:89-103 5:5
-=-=-=-=-=-
Note that I've added a second "PRA" line after the others (so they
aren't in alphabetical order); I've added start-end verse notation; AND
I've added a line with no "book" at the start -- representing a
continuation of the previous line.
Code to process this follows is supposed to follow -- but it seems I
attached the wrong file to the email from work (I can't post from work,
so I had to email the program home... but didn't <G>)
You'll have wait for tomorrow night to see the code. However, the
database looks like:
CREATE TABLE Book
(
ID integer primary key autoincrement unique,
titleCode varchar unique
)
CREATE TABLE Citation
(
ID integer primary key autoincrement unique,
bookID integer not null,
chapter integer not null,
startVerse integer not null,
endVerse integer default null,
foreign key (bookID) references Book (ID)
)
With (in SQL export format) data of:
INSERT INTO "Book" VALUES(1,'PRA');
INSERT INTO "Book" VALUES(2,'SRA');
INSERT INTO "Book" VALUES(3,'TRA');
INSERT INTO "Citation" VALUES(1,1,1,13,NULL);
INSERT INTO "Citation" VALUES(2,1,2,20,NULL);
INSERT INTO "Citation" VALUES(3,1,3,5,NULL);
INSERT INTO "Citation" VALUES(4,2,1,45,NULL);
INSERT INTO "Citation" VALUES(5,2,2,75,NULL);
INSERT INTO "Citation" VALUES(6,2,3,9,NULL);
INSERT INTO "Citation" VALUES(7,3,1,2,NULL);
INSERT INTO "Citation" VALUES(8,3,2,65,NULL);
INSERT INTO "Citation" VALUES(9,3,3,45,NULL);
INSERT INTO "Citation" VALUES(10,1,3,6,10);
INSERT INTO "Citation" VALUES(11,1,2,89,103);
INSERT INTO "Citation" VALUES(12,1,5,5,NULL);