[npl] / trunk / NationalProblemLibrary / loadDB2 Repository:
ViewVC logotype

Diff of /trunk/NationalProblemLibrary/loadDB2

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 439 Revision 440
328 \"$pgfile\", 328 \"$pgfile\",
329 \"\" 329 \"\"
330 )" 330 )"
331 ); 331 );
332 dbug "INSERT INTO pgfile VALUES( \"\", \"$DBsection_id\", \"$author_id\", \"$institution_id\", \"$path_id\", \"$pgfile\", \"\" )\n"; 332 dbug "INSERT INTO pgfile VALUES( \"\", \"$DBsection_id\", \"$author_id\", \"$institution_id\", \"$path_id\", \"$pgfile\", \"\" )\n";
333 $query = "SELECT pgfile_id FROM pgfile WHERE filename = \"$pgfile\""; 333 $query = "SELECT pgfile_id FROM pgfile WHERE filename = \"$pgfile\" and path_id=$path_id";
334 $pgfile_id = $dbh->selectrow_array($query); 334 $pgfile_id = $dbh->selectrow_array($query);
335
335 # keyword table, and problem_keyword many-many table 336 # keyword table, and problem_keyword many-many table
336 # 337 #
337 foreach my $keyword (@keyword) 338 foreach my $keyword (@keyword)
338 { 339 {
339 $keyword =~ s/[\'\"]//g; 340 $keyword =~ s/[\'\"]//g;
378 $pg_inst_id = $dbh->selectrow_array($query); 379 $pg_inst_id = $dbh->selectrow_array($query);
379 } 380 }
380 381
381 # textbook table 382 # textbook table
382 # 383 #
384if($text) {
383 $query = "SELECT textbook_id FROM textbook WHERE title = \"$text\" AND edition = \"$edition\" AND author=\"$textauthor\""; 385 $query = "SELECT textbook_id FROM textbook WHERE title = \"$text\" AND edition = \"$edition\" AND author=\"$textauthor\"";
384 my $textbook_id = $dbh->selectrow_array($query); 386 my $textbook_id = $dbh->selectrow_array($query);
385 if(!defined($textbook_id)){ 387 if(!defined($textbook_id)){
386 $dbh->do("INSERT INTO textbook 388 $dbh->do("INSERT INTO textbook
387 VALUES( 389 VALUES(
467 } 469 }
468 } 470 }
469 #reset tag vars, they may not match the next file 471 #reset tag vars, they may not match the next file
470 $chapter=""; $section=""; $date =""; $author=""; $institution=""; $text=""; $edition=""; $textauthor=""; $textsection=""; $textproblem=""; @textproblems=(); 472 $chapter=""; $section=""; $date =""; $author=""; $institution=""; $text=""; $edition=""; $textauthor=""; $textsection=""; $textproblem=""; @textproblems=();
471 } 473 }
474 }
472 close(IN) or die "can not close: $!"; 475 close(IN) or die "can not close: $!";
473 } 476 }
474} 477}
475 478
476 479

Legend:
Removed from v.439  
changed lines
  Added in v.440

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9