Hello,

I'm having issues trying to query flat files using DBI & DBD::CSV.  I'm 
currently upgrading from v5.8.8 to v5.16.3 and with the latest Perl platform my 
code no longer works.  I'm running on various Windows platforms.

I'm going to Strawberry Perl v5.16.3  (32-bit)
DBI 1.628    (upgraded core module)
DBD-CSV 0.41
SQL-Statement 1.405
Text-CSV_XS 1.01

From:  Active State Perl v 5.8.8
DBI  1.49
DBD-CSV 0.22
SQL-Statement 1.14
Text-CSV_XS 0.23

Here is a code sample that reproduces my issue:

my %attr = (PrintError => 0, RaiseError => 1, AutoCommit => 1);
my $dbh = DBI->connect ("DBI:CSV:csv_sep_char=|;csv_eol=\n", "", "", \%attr);
$dbh->{csv_tables}->{logs} = { 'file' => basename ($src_file) };
$dbh->{f_dir} = dirname ($src_file);

my $sql = "SELECT File, Extension, Directory, Message from logs where Status = 
" .
                $dbh->quote ("ERROR") . " ORDER BY Time";
my $sth = $dbh->prepare ( $sql );
$sth->execute ();

I turned on tracing (level 2) and according to the error message the file I'm 
trying to find isn't being found.

It looks like the query is ignoring the setting of "f_dir".  It's instead 
looking for the file in the current directory, which isn't what "f_dir" points 
to!  (The trace acknowledges f_dir is pointing to the correct location)

So if I manually run the code from the location where the log file is located, 
everything works.

So I see one of two things being true:

1)      "f_dir" is being ignored.

2)      There is a problem with how I initialized things.

Can anyone comment about which is the real issue?  With the files I'm querying 
all over the place, putting chdir's all over my code isn't really a good option.

Curtis Leach
Lead Engineer
RMS  IT & ERM IT
Phone: (702) 494-4562

[cid:image001.jpg@01CE6D90.EF910560]



<<inline: image001.jpg>>

Attachment: dbitrace.log
Description: dbitrace.log

Reply via email to