| version 1.4, 2005/03/15 23:25:04 |
version 1.5, 2005/05/10 08:36:03 |
|
|
| # 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.3 2003/12/20 09:04:20 rajo Exp $ |
# $Platon: scripts/perl/mysql/mysql-table-copy.pl,v 1.4 2005/03/15 23:25:04 rajo 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 47 if ($#ARGV < 2) { |
|
| Line 47 if ($#ARGV < 2) { |
|
| $db_name1 =~ s/,/;/g; |
$db_name1 =~ s/,/;/g; |
| $db_name2 =~ s/,/;/g; |
$db_name2 =~ s/,/;/g; |
| |
|
| |
$db_name1 =~ m/^DBI:/ or $db_name1 = "DBI:mysql:$db_name1"; |
| |
$db_name2 =~ m/^DBI:/ or $db_name2 = "DBI:mysql:$db_name2"; |
| |
|
| if (!defined $timeout or $timeout !~ m/^[0-9]+$/) { |
if (!defined $timeout or $timeout !~ m/^[0-9]+$/) { |
| print STDERR "Using default timeout $default_timeout seconds\n"; |
print STDERR "Using default timeout $default_timeout seconds\n"; |
| $timeout = $default_timeout; |
$timeout = $default_timeout; |
| Line 58 print "Enter password for user $user1:\n |
|
| Line 61 print "Enter password for user $user1:\n |
|
| print "Enter username for database $db_name2:\n" and $user2 = read_input() unless defined $user2; |
print "Enter username for database $db_name2:\n" and $user2 = read_input() unless defined $user2; |
| print "Enter password for user $user2:\n" and $pass2 = read_input() unless defined $pass2; |
print "Enter password for user $user2:\n" and $pass2 = read_input() unless defined $pass2; |
| |
|
| $dbh1 = DBI->connect("DBI:mysql:" . $db_name1, $user1, $pass1) or die $DBI::errstr; |
$dbh1 = DBI->connect($db_name1, $user1, $pass1) or die $DBI::errstr; |
| $dbh2 = DBI->connect("DBI:mysql:" . $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; |
| |
|