Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, October 17, 2026

Diff for scripts/perl/mysql/mysql-table-copy.pl between version 1.2 and 1.3

version 1.2, 2003/12/16 18:16:49 version 1.3, 2003/12/20 09:04:20
Line 10 
Line 10 
 # 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.1 2003/11/07 08:42:49 rajo Exp $  # $Platon: scripts/perl/mysql/mysql-table-copy.pl,v 1.2 2003/12/16 18:16:49 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 37  sub read_input();
Line 37  sub read_input();
 $default_timeout = 10; # 10 seconds  $default_timeout = 10; # 10 seconds
   
 if ($#ARGV < 2) {  if ($#ARGV < 2) {
         print STDERR "Usage: $0 database=DB1,host=localhost database=DB2,host=remotehost Table [<time_interval>]\n";          print STDERR "Usage: $0 database=DB1,host=localhost database=DB2,host=localhost Table [user1] [pass1] [user2] [pass2] [<time_interval>]\n";
         exit 1;          exit 1;
 }  }
   
 ($db_name1, $db_name2, $table, $timeout) = @ARGV;  ($db_name1, $db_name2, $table, $user1, $pass1, $user2, $pass2, $timeout) = @ARGV;
   
 # we are using ',' as separators, because ';' is separator in shell  # we are using ',' as separators, because ';' is separator in shell
 $db_name1 =~ s/,/;/g;  $db_name1 =~ s/,/;/g;
Line 53  if (!defined $timeout or $timeout !~ m/^
Line 53  if (!defined $timeout or $timeout !~ m/^
 }  }
   
 # user, password and connect {{{  # user, password and connect {{{
 print "Enter username for database $db_name1:\n";  print "Enter username for database $db_name1:\n"        and $user1 = read_input() unless defined $user1;
 $user1 = read_input();  print "Enter password for user $user1:\n"                       and $pass1 = read_input() unless defined $pass1;
 print "Enter password for user $user1:\n";  print "Enter username for database $db_name2:\n"        and $user2 = read_input() unless defined $user2;
 $pass1 = read_input();  print "Enter password for user $user2:\n"                       and $pass2 = read_input() unless defined $pass2;
 print "Enter username for database $db_name2:\n";  
 $user2 = read_input();  
 print "Enter password for user $user2:\n";  
 $pass2 = read_input();  
   
 $dbh1 = DBI->connect("DBI:mysql:" . $db_name1, $user1, $pass1) or die $DBI::errstr;  $dbh1 = DBI->connect("DBI:mysql:" . $db_name1, $user1, $pass1) or die $DBI::errstr;
 $dbh2 = DBI->connect("DBI:mysql:" . $db_name2, $user2, $pass2) or die $DBI::errstr;  $dbh2 = DBI->connect("DBI:mysql:" . $db_name2, $user2, $pass2) or die $DBI::errstr;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top