| version 1.5, 2005/05/10 08:36:03 |
version 1.6, 2005/05/10 09:19:23 |
|
|
| # Licensed under terms of GNU General Public License. |
# Licensed under terms of GNU General Public License. |
| # All rights reserved. |
# All rights reserved. |
| # |
# |
| # $Platon: scripts/perl/mysql/mysql-table-copy.pl,v 1.4 2005/03/15 23:25:04 rajo Exp $ |
# $Platon: scripts/perl/mysql/mysql-table-copy.pl,v 1.5 2005/05/10 08:36:03 nepto Exp $ |
| |
|
| # TODO: - reconnect on closed connection |
# TODO: - reconnect on closed connection |
| # - managment for tables with multiple KEY columns |
# - managment for tables with multiple KEY columns |
| Line 65 $dbh1 = DBI->connect($db_name1, $user1, |
|
| Line 65 $dbh1 = DBI->connect($db_name1, $user1, |
|
| $dbh2 = DBI->connect($db_name2, $user2, $pass2) or die $DBI::errstr; |
$dbh2 = DBI->connect($db_name2, $user2, $pass2) or die $DBI::errstr; |
| $dbh1->{mysql_auto_reconnect} = 1; |
$dbh1->{mysql_auto_reconnect} = 1; |
| $dbh2->{mysql_auto_reconnect} = 1; |
$dbh2->{mysql_auto_reconnect} = 1; |
| |
$dbh1->{AutoCommit} = 1; |
| |
$dbh2->{AutoCommit} = 1; |
| |
|
| |
# |
| |
# Please, optimize me! |
| |
# |
| |
|
| |
if ($db_name1 =~ m/^DBI:Oracle:/) { |
| |
my $sth = $dbh2->prepare('ALTER SESSION SET NLS_DATE_FORMAT = \'YYYY-MM-DD HH24:MI:SS\'') |
| |
or die "DBI::prepare(): $DBI::errstr"; |
| |
$sth->execute() or die "DBI::execute(): " . $sth->errstr; |
| |
$sth->finish(); |
| |
} |
| |
|
| |
if ($db_name2 =~ m/^DBI:Oracle:/) { |
| |
my $sth = $dbh2->prepare('ALTER SESSION SET NLS_DATE_FORMAT = \'YYYY-MM-DD HH24:MI:SS\'') |
| |
or die "DBI::prepare(): $DBI::errstr"; |
| |
$sth->execute() or die "DBI::execute(): " . $sth->errstr; |
| |
$sth->finish(); |
| |
} |
| |
|
| # }}} |
# }}} |
| |
|