--- Lawrence Statton <[EMAIL PROTECTED]> wrote:
> > I read the CPAN module DBD::CSV and still had some
> > questions.
> >
> > 1)Does this create a "in memory" database with
> data
> > from the spreadsheet for manipulation?
>
> What did reading the source tell you?
>
> >
> > 2)This is really cool! Does anyone have a working
> > example of inserting, deleting and substituting
> data
> > in cells?
>
> Well, since it is a DBI driver, *any* DBI-aware
> program could use it,
> within the limitations of the subset of SQL that it
> supports.
>
> >
> > In the doc it states:
> >
> > $dbh->do("UPDATE $table SET id = 3 WHERE id = 1");
> >
> > and
> >
> > $dbh->do("DELETE FROM $table WHERE id > 1");
> >
> > Would $table be the name of the csv file?
> >
Lawrence
Thank you for replying but since I am trying to learn
your response did not help much. :(
Any add'l help?
Anyway here is what I have tried:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect
(
"DBI:CSV:f_dir=/cygdrive/c/temp",
"DBI:CSV:csv_sep_char=\\;"
)
or die "Cannot connect: " . $DBI::errstr;
$dbh->{'csv_tables'}->{'data'} = { 'file' =>
'UID_CHECK.csv'};
# tie the table name to the filename
my $sth = $dbh->prepare("SELECT * FROM data");
$sth->execute() or die "Cannot execute: " .
$sth->errstr();
$sth->finish();
$dbh->disconnect();
IN DEBUG MODE:
DB<1> n
Execution ERROR: No such column 'PL.1,'.
at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line
2052
SQL::Statement::do_err('DBD::CSV::Statement=HASH(0x1093cc54)',
'No such column \'PL.1,\'') call
ed at /usr/lib/perl5/site_perl/5.8/SQL/Statement.pm
line 1665
SQL::Statement::verify_columns('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0
)', 'SQL::Eval=HASH(0x1096386c)', 'ARRAY(0x10852618)')
called at /usr/lib/perl5/site_perl/5.8/SQL/State
ment.pm line 778
SQL::Statement::SELECT('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0)', 'ARR
AY(0x10957424)') called at
/usr/lib/perl5/site_perl/5.8/SQL/Statement.pm line 196
SQL::Statement::execute('DBD::CSV::Statement=HASH(0x1093cc54)',
'DBI::st=HASH(0x10953cf0)', 'AR
RAY(0x10957424)') called at
/usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line
441
eval {...} called at
/usr/lib/perl5/site_perl/5.8/cygwin/DBD/File.pm line
441
DBD::File::st::execute('DBI::st=HASH(0x10953cf0)')
called at csv_manip.plx line 19
main::(csv_manip.plx:20): $sth->finish();
DB<1>
____________________________________________________________________________________
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/