6 my $s_datasrc = 'DBI:mysql:host=ns1.enetonline.net;port=3307;user=ivan;dbname=freeside';
10 my $d_datasrc = 'DBI:Pg:dbname=freeside';
11 my $d_dbuser = 'freeside';
44 #h_cust_bill_pkg_detail
123 my $s_dbh = DBI->connect($s_datasrc, $s_dbuser, $s_dbpass) or die $DBI::errstr;
124 my $d_dbh = DBI->connect($d_datasrc, $d_dbuser, $d_dbpass) or die $DBI::errstr;
126 foreach my $table ( @tables ) {
127 $d_dbh->do("delete from $table");
129 my $s_sth = $s_dbh->prepare("select * from $table");
130 $s_sth->execute or die $s_sth->errstr;
133 while ( $row = $s_sth->fetchrow_arrayref ) {
134 my $d_sth = $d_dbh->prepare(
135 "insert into $table ( ".
136 join(', ', @{$s_sth->{NAME}} ).
138 join(', ', map { '?' } @{$s_sth->{NAME}} ).
140 ) or die $d_dbh->errstr;
142 $d_sth->execute(@$row) or die $d_sth->errstr;