Stacy

DBI 1.14
Text::CSV_XS 0.22
SQL::Statement 0.1017
DBD::CSV 0.1025

The latter 3 were installed a few minutes ago :-).

weather.dat:
-----><8-----
Date&Time,MaxWSpd,AvgWSpd,WindDir,AirPres,RainBkt,RelHumd,OutTemp,InsTemp,MsrTemp,FocTemp,XtrTemp
26-DEC-1999 00:00:00,  -1,  -2,  -3,  -4,  -5,  -6, -7, -8, -9, -10, -11
-----><8-----

I changed all the 9s so I could see which column was being returned.

x.pl:
-----><8-----
#!/usr/local/bin/perl -w
use DBI;

$dbh = DBI->connect("DBI:CSV:f_dir=d:/temp") or die "Cannot connect: " . $DBI::errstr;
$dbh->{'csv_tables'}->{'weather'} = { 'file' => 'weather'};
my $sql = "SELECT MaxWSpd, WindDir FROM weather WHERE  AvgWSpd < 10.00";

my $sth = $dbh->prepare($sql) or die "Cannot prepare: " . $dbh->errstr();

$sth->execute() or die "Cannot execute: " . $sth->errstr();

my($MaxWSpd, $WindDir, $AvgWSpd);

$sth->bind_columns(\$MaxWSpd, \$WindDir);

while ($sth->fetch) {
  print("Found result row: $MaxWSpd, $WindDir \n");
}

$sth->finish();
$dbh->disconnect();
-----><8-----

Same as yours.

Ouput:
-----><8-----
Found result row:   -1,   -3 
-----><8-----

Cheers
Ron  Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html


Reply via email to