Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#! /usr/bin/perl -w use strict; use DBI; my $pair1 = shift; my $pair2 = shift; my $dbh = DBI->connect("DBI:CSV:") or die "Cannot connect: " . $DBI::errstr; $dbh->{RaiseError} = 1; my $query1 = "SELECT * FROM $pair1"; my $query2 = "SELECT * FROM $pair2"; my $getpair1 = $dbh->prepare($query1) or die "Cannot prepare: " . $dbh->errstr(); $getpair1->execute() or die "Cannot execute"; my $getpair2 = $dbh->prepare($query2) or die "Cannot prepare: " . $dbh->errstr(); #$getpair2->execute() or die "Cannot execute"; our $pair2_hash = $dbh->selectall_hashref($getpair2, 1); our @pair1_array; while (my $pair1_array = $getpair1->fetchrow_arrayref({Date =>1})) { if (exists($pair2_hash->{$pair1_array->[0]})) { # # Call function to write new data set # # } } $getpair1->finish(); $getpair2->finish();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data Set Combination
by jZed (Prior) on Aug 26, 2005 at 20:32 UTC | |
by Anonymous Monk on Aug 29, 2005 at 14:18 UTC | |
|
Re: Data Set Combination
by sgifford (Prior) on Aug 26, 2005 at 19:48 UTC | |
by Anonymous Monk on Aug 26, 2005 at 20:07 UTC | |
by sgifford (Prior) on Aug 26, 2005 at 20:21 UTC | |
|
Re: Data Set Combination
by injunjoel (Priest) on Aug 27, 2005 at 04:05 UTC | |
by Anonymous Monk on Aug 29, 2005 at 14:23 UTC | |
|
Re: Data Set Combination
by Anonymous Monk on Aug 26, 2005 at 20:22 UTC | |
|
Re: Data Set Combination
by dragonchild (Archbishop) on Aug 27, 2005 at 02:47 UTC |