Wordlist into database

Your assignment is to write a Bash script db.bash that takes a wordlist file, like those produced in the previous wordlist assignment, and have it add a new table to a SQLITE3 database. For instance, your program should be able to do the following:
$ cat 0.out
all
all-inspiring
ask
could
did
er
for
high
jump
jumped
jumping
land
leap
oh
rabbit
rabbits
sat
saw
sight
so
that
the
then
there
they
we
were
what
% ./db.bash all.db data0 0.out
% echo '.d' | sqlite3 all.db
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE data0 (id integer,word text, primary key(id));
INSERT INTO data0 VALUES(1,'all');
INSERT INTO data0 VALUES(2,'all-inspiring');
INSERT INTO data0 VALUES(3,'ask');
INSERT INTO data0 VALUES(4,'could');
INSERT INTO data0 VALUES(5,'did');
INSERT INTO data0 VALUES(6,'er');
INSERT INTO data0 VALUES(7,'for');
INSERT INTO data0 VALUES(8,'high');
INSERT INTO data0 VALUES(9,'jump');
INSERT INTO data0 VALUES(10,'jumped');
INSERT INTO data0 VALUES(11,'jumping');
INSERT INTO data0 VALUES(12,'land');
INSERT INTO data0 VALUES(13,'leap');
INSERT INTO data0 VALUES(14,'oh');
INSERT INTO data0 VALUES(15,'rabbit');
INSERT INTO data0 VALUES(16,'rabbits');
INSERT INTO data0 VALUES(17,'sat');
INSERT INTO data0 VALUES(18,'saw');
INSERT INTO data0 VALUES(19,'sight');
INSERT INTO data0 VALUES(20,'so');
INSERT INTO data0 VALUES(21,'that');
INSERT INTO data0 VALUES(22,'the');
INSERT INTO data0 VALUES(23,'then');
INSERT INTO data0 VALUES(24,'there');
INSERT INTO data0 VALUES(25,'they');
INSERT INTO data0 VALUES(26,'we');
INSERT INTO data0 VALUES(27,'were');
INSERT INTO data0 VALUES(28,'what');
COMMIT;
    

Your script should expect exactly three arguments: 1) the name of the database file 2) the table in the database and 3) the name of the wordlist file.

You can use any of Bash built-in features (echo, array variables, and so forth) to do this.

The difficult part of this assignment is the quoting necessary to insert items into the database; dealing with SQLITE's quoting conventions is quite a challenge from a Bash script.

This assignment is due by the beginning of class on Friday, April 12 Monday, April 15. Your programs should be able to produce identical output for the sample files, and should be able to handle similar text files in addition to the provided samples. Please leave a copy of db.bash on cop3353.org so that I can test it.