On Tue, Aug 26, 2003 at 09:33:58AM -0700, Jeff Zucker wrote:
> Thomas A. Lowery wrote:

> know if you have other ideas that wouldn't break existing scripts.

What was I thinking ...  break every CSV process in the world using
DBD::CSV. <sigh>

> DBD::CSV expects by default.  You need to either add the names to the 
> data file, or tell the DBD the column names for the table like so:
>     $dbh->{csv_tables}->{myfile}->{col_names}=['id','name'];

This syntax presents a challenge for using dbish/DBI::Shell.
The driver configuration is done using the command line "dbi:...:..." or
DBI_DSN.

To start shell I use: dbish "dbi:CSV:f_dir=.;csv_eol=\n"
This leaves me at a dbish prompt.  So to effectively use the DBD::CSV, I'll
need a plug-in to support commands like:
        /csv table table_name file_name column_names
        /csv table eol \n
        ...

Will DBD::CSV use an external configuration file or an ini like file?

Here's a test using the above connection string:

        [EMAIL PROTECTED] dbish]$ dbish "dbi:CSV:f_dir=.;csv_eol=\n"
        DBI::Shell 11.91 using DBI 1.38
        ...
        Connecting to 'dbi:CSV:f_dir=.;csv_eol=\n' as 'test'...
        Loaded plugins DBI::Shell::SQLMinus
        [EMAIL PROTECTED]:CSV:f_dir=.;csv_eol=\n> /tab
        col1,col2,col3,col4,col5
        ...
        undef,'tlowery','testcsv','TABLE',undef
        ...
        [17 rows of 5 fields returned]
        [EMAIL PROTECTED]:CSV:f_dir=.;csv_eol=\n> select * from testcsv
        [EMAIL PROTECTED]:CSV:f_dir=.;csv_eol=\n> /
        nNumber,nName
        '',undef
        '',undef
        '',undef
        'gel',undef
        [4 rows of 2 fields returned]

Odd, I get the column headers for no data. I need to determine where things are
getting lost.

Tom

File testcsv:
nNumber,nName
1,Tom
2,Susan
3,Phillip
4,Aaron
5,Ryan
6,Angel
7,"Little Wing"

Reply via email to