#!/usr/bin/perl print "Content-type: text/html\n\n"; BEGIN { use lib '/usr/home/cfg' ; require push_inc ; } require cfg ; &today ; #------------------------------------------------------------------------------------------ use DBI; use CGI::Carp qw(fatalsToBrowser); &create_db_other_service_table ; exit ; #------------------------------------------------------------------------------------------ sub create_db_other_service_table { &db_open_ro ; my $sql = qq(SELECT OthSvc1,otherservice1id,OthSvc2,otherservice2id FROM ffwaypls_filmfreight.waybills WHERE OthSvc1 <> '') ; my $sth = $dbh->prepare($sql) ; $sth -> execute() or die "Could not execute SQL statement $sql ... maybe invalid? $!"; my $waybill_array_ref = $sth->fetchall_arrayref(); $sth->finish(); &db_close_conn ; foreach $row (@$waybill_array_ref) { $wb_othsvc1 = @$row[0] ; $wb_otherservice1id = @$row[1] ; $wb_othsvc2 = @$row[2] ; $wb_otherservice2id = @$row[3] ; $service{$wb_otherservice1id} = $wb_othsvc1 ; # $service{$wb_otherservice2id} = $wb_othsvc2 ; } foreach my $id (keys %service) { # print "
*** $id -> $service{$id}" ; &insert_other_service($id,$service{$id}) ; } } #------------------------------------------------------------------------------------------ sub insert_other_service { my ($id,$name) = @_ ; # &db_open_upd ; $sql = qq(INSERT INTO ffwaypls_filmfreight.other_services (ID,OthServiceName) VALUES ('$id','$name'); ) ; &common_debug($sql) ; # $sth = $dbh -> do ($sql) or die "could not execute :
$sql
$!" ; # &db_close_conn ; } #------------------------------------------------------------------------------------------ use db ; use today ; use common ; 1;