[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS Update: fgo.ca
- To: cvs@lists.cleannorth.org
- Subject: CVS Update: fgo.ca
- From: Dan Brosemer <odin@cleannorth.org>
- Date: Mon, 9 Jun 2008 08:54:50 -0401 (EDT)
- List-help: <mailto:cvs-request@lists.cleannorth.org?subject=help>
- List-post: <mailto:cvs@lists.cleannorth.org>
- List-subscribe: <mailto:cvs-request@lists.cleannorth.org?subject=subscribe>
- List-unsubscribe: <mailto:cvs-request@lists.cleannorth.org?subject=unsubscribe>
- Resent-date: Mon, 9 Jun 2008 08:54:55 -0401 (EDT)
- Resent-from: cvs@lists.cleannorth.org
- Resent-message-id: <RriPbC.A.SXH.1gSTIB@skroob.cleannorth.org>
- Resent-sender: cvs-request@lists.cleannorth.org
Log Message:
-----------
Insert into database
Modified Files:
--------------
fgo.ca/public_html:
butternut.pl
Revision Data
-------------
Index: butternut.pl
===================================================================
RCS file: /cvs/fgo.ca/public_html/butternut.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lpublic_html/butternut.pl -Lpublic_html/butternut.pl -u -r1.3 -r1.4
--- public_html/butternut.pl
+++ public_html/butternut.pl
@@ -376,9 +376,136 @@
};
push @messages, {message => $member->fileName()." is $type" };
my $data = '';
- $data = nontabparse($tmp, $nontab{$type}) if ($nontab{$type});
- $data = tabparse($tmp, $tab{$type}) if ($tab{$type});
- push @messages, {message => Data::Dump::dump($data)};
+ if ($nontab{$type})
+ {
+ $data = nontabparse($tmp, $nontab{$type});
+ if ($type eq 'appendix2')
+ {
+ my $SQL = <<EOT;
+insert into bnut_appendix2 ( plotno1, plotno2, plotno3, plotname, day1, day2, month1, month2, year1, year2, year3, year4,
+ evaluators, propertyowner, location1, location2, location3, UTM1, UTM2, easting1, easting2, easting3, easting4, easting5, easting6,
+ northing1, northing2, northing3, northing4, northing5, northing6, northing7, spbearing1, spbearing2, spbearing3,
+ spdist1, spdist2, spdist3, spUTM1, spUTM2, speasting1, speasting2, speasting3, speasting4, speasting5, speasting6,
+ spnorthing1, spnorthing2, spnorthing3, spnorthing4, spnorthing5, spnorthing6, spnorthing7, tree1bearing1, tree1bearing2, tree1bearing3,
+ tree1distance1, tree1distance2, tree1distance3)
+values
+(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+EOT
+
+ my $cursor = $dbh->prepare($SQL);
+ $cursor->execute(map {($_ eq '')?undef:$_} map {$data->{$_}} qw(plotno1 plotno2 plotno3 plotname day1 day2 month1 month2 year1 year2 year3 year4
+ evaluators propertyowner location1 location2 location3 UTM1 UTM2 easting1 easting2 easting3 easting4 easting5 easting6
+ northing1 northing2 northing3 northing4 northing5 northing6 northing7 spbearing1 spbearing2 spbearing3
+ spdist1 spdist2 spdist3 spUTM1 spUTM2 speasting1 speasting2 speasting3 speasting4 speasting5 speasting6
+ spnorthing1 spnorthing2 spnorthing3 spnorthing4 spnorthing5 spnorthing6 spnorthing7 tree1bearing1 tree1bearing2 tree1bearing3
+ tree1distance1 tree1distance2 tree1distance3) );
+
+ push @errors, $DBI::errstr if $DBI::errstr;
+
+ }
+ elsif ($type eq 'appendix3')
+ {
+ my $SQL = <<EOT;
+insert into bnut_appendix3 ( plotno1, plotno2, plotno3, plotname, day1, day2, month1, month2, year1, year2, year3, year4,
+ evaluators, propertyowner, tree1bearing1, tree1bearing2, tree1bearing3, tree1distance1, tree1distance2, tree1distance3,
+ BASbutternut, BASother1, BASother2, BASother3, BASother4, BASother5, BASother6, prism1, prism2,
+ "tree1-20", "tree1-21", "tree1-22", "tree1-23", "tree1-24", "tree1-25", "tree1-26", "tree1-27",
+ "tree1-28", "tree1-29", "tree1-30", "tree1-31", "tree1-32", "tree1-33", "tree1-recentdownedbutternut",
+ "midpoint-20", "midpoint-21", "midpoint-22", "midpoint-23", "midpoint-24", "midpoint-25", "midpoint-26", "midpoint-27",
+ "midpoint-28", "midpoint-29", "midpoint-30", "midpoint-31", "midpoint-32", "midpoint-33", "midpoint-recentdownedbutternut",
+ "lasttree-20", "lasttree-21", "lasttree-22", "lasttree-23", "lasttree-24", "lasttree-25", "lasttree-26", "lasttree-27",
+ "lasttree-28", "lasttree-29", "lasttree-30", "lasttree-31", "lasttree-32", "lasttree-33", "lasttree-recentdownedbutternut",
+ "regeneration", "leafsample", "twigcanker", "remarks1", "remarks2", "remarks3")
+values
+(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
+?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+EOT
+
+ my $cursor = $dbh->prepare($SQL);
+ $cursor->execute(map {($_ eq '')?undef:$_} map {$data->{$_}} qw(plotno1 plotno2 plotno3 plotname day1 day2 month1 month2 year1 year2 year3 year4
+ evaluators propertyowner tree1bearing1 tree1bearing2 tree1bearing3 tree1distance1 tree1distance2 tree1distance3
+ BASbutternut BASother1 BASother2 BASother3 BASother4 BASother5 BASother6 prism1 prism2
+ tree1-20 tree1-21 tree1-22 tree1-23 tree1-24 tree1-25 tree1-26 tree1-27
+ tree1-28 tree1-29 tree1-30 tree1-31 tree1-32 tree1-33 tree1-recentdownedbutternut
+ midpoint-20 midpoint-21 midpoint-22 midpoint-23 midpoint-24 midpoint-25 midpoint-26 midpoint-27
+ midpoint-28 midpoint-29 midpoint-30 midpoint-31 midpoint-32 midpoint-33 midpoint-recentdownedbutternut
+ lasttree-20 lasttree-21 lasttree-22 lasttree-23 lasttree-24 lasttree-25 lasttree-26 lasttree-27
+ lasttree-28 lasttree-29 lasttree-30 lasttree-31 lasttree-32 lasttree-33 lasttree-recentdownedbutternut
+ regeneration leafsample twigcanker remarks1 remarks2 remarks3) );
+
+ push @errors, $DBI::errstr if $DBI::errstr;
+
+ }
+ else
+ {
+ push @errors, {message => $member->fileName().": $type: No handler." };
+ unlink($tmp);
+ next;
+ };
+ }
+ elsif ($tab{$type})
+ {
+ $data = tabparse($tmp, $tab{$type});
+ if ($type eq 'appendix4')
+ {
+ my $SQL = <<EOT;
+insert into bnut_appendix4 ( "treebearing1", "treebearing2", "treebearing3", "treedistance1", "treedistance2", "treedistance3",
+ "tree", "UTM1", "UTM2", "easting1", "easting2", "easting3", "easting4", "easting5", "easting6",
+ "northing1", "northing2", "northing3", "northing4", "northing5", "northing6", "northing7", "northing8", "DBH1", "DBH2", "DBH3",
+ "crownclass", "vigor", "dieback1", "dieback2", "dieback3", "terrain")
+values
+(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+EOT
+
+ my $cursor = $dbh->prepare($SQL);
+ foreach my $row (@{$data})
+ {
+ $cursor->execute(map {($_ eq '')?undef:$_} map {$row->{$_}} qw(treebearing1 treebearing2 treebearing3 treedistance1 treedistance2 treedistance3
+ tree UTM1 UTM2 easting1 easting2 easting3 easting4 easting5 easting6
+ northing1 northing2 northing3 northing4 northing5 northing6 northing7 northing8 DBH1 DBH2 DBH3
+ crownclass vigor dieback1 dieback2 dieback3 terrain));
+
+ push @errors, $DBI::errstr if $DBI::errstr;
+ };
+
+ }
+ elsif ($type eq 'appendix5')
+ {
+ my $SQL = <<EOT;
+insert into bnut_appendix5 ( "tree", "root-oozing", "root-perenneal", "root-callus", "under-oozing", "under-perenneal", "under-callus",
+ "over-oozing", "over-perenneal", "over-callus", "crown-young", "crown-oozing", "crown-perenneal", "crown-callus",
+ "healthy", "cankerno", "girdling", "eipcormic-stump", "epicormic-stem", "epicormic-crown", "bark",
+ "pests-P1", "pests-L1", "pests-P2", "pests-L2", remarks)
+values
+(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+EOT
+
+ my $cursor = $dbh->prepare($SQL);
+ foreach my $row (@{$data})
+ {
+ $cursor->execute(map {($_ eq '')?undef:$_} map {$row->{$_}} qw(tree root-oozing root-perenneal root-callus under-oozing under-perenneal under-callus
+over-oozing over-perenneal over-callus crown-young crown-oozing crown-perenneal crown-callus
+healthy cankerno girdling eipcormic-stump epicormic-stem epicormic-crown bark
+pests-P1 pests-L1 pests-P2 pests-L2 remarks));
+
+ push @errors, $DBI::errstr if $DBI::errstr;
+ };
+
+ }
+ else
+ {
+ push @errors, {message => $member->fileName().": $type: No handler." };
+ unlink($tmp);
+ next;
+ };
+ }
+ else
+ {
+ push @errors, {message => $member->fileName().": do not know how to handle." };
+ unlink($tmp);
+ next;
+ };
+ push @messages {message => $member->fileName().": handled." };
unlink($tmp);
};
close $zfh;
- Prev by Date: CVS Update: fgo.ca
- Next by Date: CVS Update: fgo.ca
- Previous by thread: CVS Update: fgo.ca
- Next by thread: CVS Update: fgo.ca
- Index(es):