[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] DBI errors



Hi all -

I'm having a hell of a time getting DBI to work on a CSV file and 
would really appreciate some help. I've listed the error messages, 
code, input data file and output. I have the DBD-CSV-0.1022 README 
and "Programming the Perl DBI" book if it's easier to reference a 
page from one of those. I also have about 6 other Perl books 
(including MPPE) on the desk so chances are you can make a reference 
to a page from another book and I'll find it.

Error messages:
# DBD::CSV::st execute failed: # Error while reading file :test.csv: 
Operation not supported on socket, <GEN0> chunk 1.
File 'Aleutian:Applications:MacPerl:site_perl:DBD:CSV.pm'; Line 201
# Couldn't execute statement # Error while reading file :test.csv: 
Operation not supported on socket, <GEN0> chunk 1.
File 'Aleutian:Applications:MacPerl:site_perl:DBD:CSV.pm'; Line 201


== code begin ==
#!/usr/bin/perl -w
#   include the DataBase Interface
use DBI;

print "connecting ...\n";
my $dbh = DBI->connect("DBI:CSV:")
     or die "Couldn't connect to database: " . DBI->errstr;

print "attributes ...\n";
$dbh->{'csv_tables'}->{'test'} = {
     'col_names' => ["esID", "transID"],
     'eol' => "\r",
     'sep_char' => ",",
     'file' => "test.csv"
};

print "preparing ...\n";
my $sth = $dbh->prepare("SELECT * FROM test WHERE transID < 2500")
     or die "Couldn't prepare statement: " . $dbh->errstr;

print "executing ...\n";
$sth->execute()
     or die "Couldn't execute statement " . $sth->errstr;

print "querying ...\n";
my @row;
while (@row = $sth->fetchrow_hashref) {
     print ("Row: @row\n");
}

print "finishing ...\n";
$sth->finish;

print "disconnecting ...\n";
$dbh->disconnect;

print "\n";
== code end ==


input file (test.cvs):
ES20020,2133
ES20020,2197
ES20020,2262
ES20020,2270
ES20020,2346
ES20020,2475
ES20020,2551
ES20020,2642
ES20020,2643
ES20020,2661


output:
connecting ...
attributes ...
preparing ...
executing ...
# DBD::CSV::st execute failed: # Error while reading file :test.csv: 
Operation not supported on socket, <GEN0> chunk 1.
File 'Aleutian:Applications:MacPerl:site_perl:DBD:CSV.pm'; Line 201
# Couldn't execute statement # Error while reading file :test.csv: 
Operation not supported on socket, <GEN0> chunk 1.
File 'Aleutian:Applications:MacPerl:site_perl:DBD:CSV.pm'; Line 201
-- 

Mike Schienle                                 Interactive Visuals, Inc.
mgs@ivsoftware.com                  Remote Sensing and Image Processing
http://www.ivsoftware.com/         Analysis and Application Development

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org