in reply to Scratch DB
Nice one and thanks. I'm sure I'll find this useful.
BTW, on line 21 I had to add an argument to Term::Realine's constructor to make it work here - I just passed $0. According to http://search.cpan.org/~flora/perl-5.14.2/lib/Term/ReadLine.pm the constructor takes a string.
You also need a newish Text::CSV or you won't have getline_all (I had 1.17 and that did not have it).
Lastly, I notice the table name is optional and if I have a csv file called xxx.csv only containing something like
1,fred 2,dave 3,john
you seem to have to name the table or you get:
sdb> load xxx.csv DBD::SQLite::db prepare failed: unknown database xxx at /home/martin/b +in/scratch_db.pl line 56, <$fh> line 3. Can't call method "execute" on an undefined value at /home/martin/bin/ +scratch_db.pl line 56, <$fh> line 3.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Scratch DB
by Fox (Pilgrim) on Sep 30, 2011 at 14:09 UTC |