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 = FS::DBI->connect($s_datasrc, $s_dbuser, $s_dbpass)
124 or die $FS::DBI::errstr;
125 my $d_dbh = FS::DBI->connect($d_datasrc, $d_dbuser, $d_dbpass)
126 or die $FS::DBI::errstr;
128 foreach my $table ( @tables ) {
129 $d_dbh->do("delete from $table");
131 my $s_sth = $s_dbh->prepare("select * from $table");
132 $s_sth->execute or die $s_sth->errstr;
135 while ( $row = $s_sth->fetchrow_arrayref ) {
136 my $d_sth = $d_dbh->prepare(
137 "insert into $table ( ".
138 join(', ', @{$s_sth->{NAME}} ).
140 join(', ', map { '?' } @{$s_sth->{NAME}} ).
142 ) or die $d_dbh->errstr;
144 $d_sth->execute(@$row) or die $d_sth->errstr;