Thanks for the response. Good questions to ask, just did not help me resolve it.
> -----Original Message----- > From: Simon Oliver [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 31, 2002 4:45 AM > To: Adam Frielink > Cc: [EMAIL PROTECTED] > Subject: Re: DBD::AnyData and/or DBD::CSV problem > > > > $db->func('SHEPC', 'Tab', 'C:/documents and > > settings/user/desktop/dataformats/SHEPC', 'ad_catalog'); > You're missing a comma (flags?) You are correct, but, the docs say that if you do not use the optional flag, a 'r' mode (read-only) will be used by default. When I do specify the flag (both as a literal and a variable), I get a 'strict' error... "Can't use string ("r") as a HASH ref while "strict refs" in use at C:/Perl/site/lib/DBD/AnyData.pm line 353." Now, from the DBD::AnyData Documentation, # SELECT DATA FROM A PASSWD FILE # $dbh->func( 'users', 'Passwd', '/etc/passwd', 'ad_catalog'); my $sth = $dbh->prepare("SELECT username,homedir,GID FROM users'); # INSERT A NEW ROW INTO A CSV FILE # $dbh->func( 'cars', 'CSV', 'cars.csv', 'ad_catalog'); $dbh->do("INSERT INTO cars VALUES ('Honda','Odyssey')"); There are no flags being used in the $dbh->func(), so I wonder, what am I missing? > > $db->func('SHEPC', 'Tab', 'C:/documents and > settings/user/desktop/dataformats/SHEPC', , 'ad_catalog'); Tried the above change as-is and also with an undef for the flag param. I get the same error I originally posted. "DBD::AnyData::db prepare failed: Parse error near () FROM SHEPC at C:/Perl/site/lib/DBD/AnyData.pm line 126." > > Is the file SHEPC readable? yes > > die "Can't read file '$file'" unless (-r $file); The file is readable. Original Code __BEGIN__ use strict; use DBI; # Version 1.14 use DBD::AnyData; # Version 0.05 my ($db, $sth, $sthcnt, @values, $count); $db = DBI->connect('dbi:AnyData:(RaiseError=>1') || print "$DBI::errstr\n"; $db->func('SHEPC', 'Tab', 'C:/documents and settings/user/desktop/dataformats/SHEPC', 'ad_catalog'); $sth = $db->prepare('SELECT * FROM SHEPC') || die "Unable to prepare SELECT *: $DBI::errstr\n"; $sthcnt = $db->prepare('SELECT COUNT() FROM SHEPC') || die "Unable to prepare SELECT COUNT: $DBI::errstr\n"; $sthcnt->execute() || die "Unable to Execute Count: $DBI::errstr\n";; $count = $sthcnt->fetchrow(); print "There are $count records in the table\n\nHere they are!!!"; $sth->execute() || die "Unable to execute select: $DBI::errstr\n"; while (@values=$sth->fetchrow_array()) { print @values; sleep 1; } __END__ Is this an easily correctable problem, something simple?
