I have just tried to use DBD::CSV and seem to be missing something
fundamental

I have written a simple select * from table query which seems to return no
data.
The associated file seems to being read as the NUM_OF_FIELDS in the trace is
getting set to 16. I have attached the trace (level 1) if somebody could
explain what is going on please?

my $dbh = DBI->connect("dbi:CSV:f_dir=.") or die "Connect connect to CSV\n";
$dbh->{'csv_sep_char'} =',';
$dbh->{'RaiseError'} = 1;
$dbh->{'csv_tables'}->{'ISS'} = { 'file' => 'ISS'};
my $sth = $dbh->prepare("select * from ISS");
$sth->execute;
while (my @row = $sth->fetchrow_array){
        print "Looping\n";
        print "@row\n";
}

 DBI 1.21-nothread dispatch trace level set to 1
    -> DBI->connect(dbi:CSV:f_dir=/usr/local/apache/cgi-bin, , ****)
    -> DBI->install_driver(CSV) for linux perl=5.006001 pid=10310 ruid=0
euid=0
       install_driver: DBD::CSV version 0.2002 loaded from
/usr/local/lib/perl5/site_perl/5.6.1/DBD/CSV.pm
    <- install_driver= DBI::dr=HASH(0x81a3810)
    <- default_user= ( undef undef ) [2 items] at DBI.pm line 468
    <- STORE('f_dir' '.' ...)= 1 at File.pm line 94
    <- STORE('f_dir' '/usr/local/apache/cgi-bin' ...)= 1 at File.pm line 105
    <- FETCH= undef at CSV.pm line 77
    <- STORE('csv_tables' HASH(0x82778a4) ...)= 1 at CSV.pm line 77
    <- connect= DBI::db=HASH(0x83a8ec0) at DBI.pm line 471
    <- STORE('PrintError' 1 ...)= 1 at DBI.pm line 513
    <- STORE('AutoCommit' 1 ...)= 1 at DBI.pm line 513
    <- connect= DBI::db=HASH(0x83a8ec0)
    <- STORE('csv_sep_char' ',' ...)= 1 at IntegratedSplit.pl line 14
    <- STORE('RaiseError' 1 ...)= 1 at IntegratedSplit.pl line 15
    <- FETCH= HASH(0x82778a4)0keys ('csv_tables' from cache) at
IntegratedSplit.pl line 16
    <- FETCH= 'DBD::CSV::st' ('ImplementorClass' from cache) at File.pm line
161
    <- STORE('f_stmt' DBD::CSV::Statement=HASH(0x83805e8) ...)= 1 at File.pm
line 182
    <- STORE('f_params' ARRAY(0x838063c) ...)= 1 at File.pm line 183
    <- STORE('NUM_OF_PARAMS' 0 ...)= 1 at File.pm line 184
    <- prepare('select * from ISS' CODE)= DBI::st=HASH(0x8277874) at
IntegratedSplit.pl line 17
    <- FETCH= HASH(0x82778a4)1keys ('csv_tables' from cache) at CSV.pm line
119
    <- FETCH= undef at CSV.pm line 124
    <- FETCH= undef at CSV.pm line 126
    <- FETCH= undef at CSV.pm line 129
2   <- FETCH= ',' ('csv_sep_char' from cache) at DBI.pm line 1015
    <- EXISTS= 1 at CSV.pm line 130
    <- FETCH= ',' ('csv_sep_char' from cache) at CSV.pm line 130
2   <- FETCH= undef at DBI.pm line 1015
    <- EXISTS= '' at CSV.pm line 133
2   <- FETCH= undef at DBI.pm line 1015
    <- EXISTS= '' at CSV.pm line 137
    <- FETCH= '/usr/local/apache/cgi-bin' ('f_dir' from cache) at Unix.pm
line 57
2   <- FETCH= 0 at File.pm line 386
2   <- STORE('NUM_OF_FIELDS' 16 ...)= 1 at File.pm line 386
    <- execute(CODE)= '0E0' at IntegratedSplit.pl line 18
2   <- fetch= undef row-1 at IntegratedSplit.pl line 19
    <- fetchrow_array= ( ) [0 items] row-1 at IntegratedSplit.pl line 19
    <- disconnect= 1 at IntegratedSplit.pl line 23
    <- DESTROY= undef
    <- DESTROY= undef
    <- disconnect_all= undef at DBI.pm line 533
    <- DESTROY= undef during global destruction

Ken Gaul
IT Infrastructure Manager
beCogent Ltd
www.beCogent..com 

T: +44 (0) 1236 628 140
F: +44 (0) 1236 628 101
E:  mailto:[EMAIL PROTECTED] 

 <<Ken Gaul.vcf>> 

Attachment: Ken Gaul.vcf
Description: Binary data

Reply via email to