Am 25.11.2013 um 18:00 schrieb David E. Wheeler <da...@justatheory.com>:

> On Nov 25, 2013, at 3:50 AM, Jens Rehsack <rehs...@gmail.com> wrote:
> 
>>   DBI->connect($dsn, $user, $passwd, \%attr)
>> 
>> 4th argument is wasted in your current proposal.
> 
> Er, well, I failed to provide a complete set of examples. Here’s one from the 
> PostgreSQL docs:
> 
>  
> postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
> 
> All the attributes are provided by the GET query string.

Let’s go - shoot:

    # specify most possible flags via driver flags
    $dbh = DBI->connect ("dbi:CSV:", undef, undef, {
        f_schema         => undef,
        f_dir            => "data",
        f_dir_search     => [],
        f_ext            => ".csv/r",
        f_lock           => 2,
        f_encoding       => "utf8",

        csv_eol          => "\r\n",
        csv_sep_char     => ",",
        csv_quote_char   => '"',
        csv_escape_char  => '"',
        csv_class        => "Text::CSV_XS",
        csv_null         => 1,
        csv_tables       => {
            info => { f_file => "info.csv" }
            },

        RaiseError       => 1,
        PrintError       => 1,
        FetchHashKeyName => "NAME_lc",
        }) or die $DBI::errstr;

And keep in mind, csv_tables can be more complex and there’re other
attributes like it eg. in DBD::AnyData.

Cheers
-- 
Jens Rehsack
rehs...@gmail.com





Reply via email to