List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:April 9 2001 3:25pm
Subject:[PATCH] mysql_convert_table_format.sh
View as plain text  
Hi!

>>>>> "Jeremy" == Jeremy Zawodny <jzawodn@stripped> writes:

Jeremy> This following patch (against the latest 3.x bitkeeper tree) adds a
Jeremy> `--socket' command-line option to mysql_convert_table_format.sh.

Jeremy> Without having this, it's difficult to do table conversions on a
Jeremy> machine where one is running multiple MySQL servers. It might also be
Jeremy> good to also add a `--port' option, but this was sufficeint for what I
Jeremy> needed. (I needed with a --socket or --port option.)

Jeremy> I really didn't want to convert lots of tables to Gemini tables by
Jeremy> hand. :-)

I took the liberty to modified the patch slightly:

===== scripts/mysql_convert_table_format.sh 1.4 vs edited =====
*** /tmp/mysql_convert_table_format.sh-1.4-17845	Thu Sep 14 12:49:24 2000
--- edited/scripts/mysql_convert_table_format.sh	Mon Apr  9 18:24:06 2001
***************
*** 8,17 ****
  $opt_help=$opt_version=$opt_verbose=$opt_force=0;
  $opt_user=$opt_database=$opt_password=undef;
  $opt_host="localhost";
  $opt_type="MYISAM";
  $exit_status=0;
  
! GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version")
|| 
    usage(0);
  usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
  $opt_database=shift(@ARGV);
--- 8,19 ----
  $opt_help=$opt_version=$opt_verbose=$opt_force=0;
  $opt_user=$opt_database=$opt_password=undef;
  $opt_host="localhost";
+ $opt_socket="";
  $opt_type="MYISAM";
+ $opt_port=0;
  $exit_status=0;
  
!
GetOptions("force","help","host=s","password=s","user=s","type=s","verbose","version","socket=s",
"port=i") || 
    usage(0);
  usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
  $opt_database=shift(@ARGV);
***************
*** 22,28 ****
    exit(1);
  }
  
! $dbh = DBI->connect("DBI:mysql:$opt_database:$opt_host",
  		    $opt_user,
  		    $opt_password,
  		    { PrintError => 0})
--- 24,40 ----
    exit(1);
  }
  
! $connect_opt="";
! if ($opt_port)
! {
!   $connect_opt.= ";port=$opt_port";
! }
! if (length($opt_socket))
! {
!   $connect_opt.=";mysql_socket=$opt_socket";
! }
! 
! $dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
  		    $opt_user,
  		    $opt_password,
  		    { PrintError => 0})
***************
*** 95,100 ****
--- 107,118 ----
  
  --password='password'
    Password for the current user.
+ 
+ --port=port
+   TCP/IP port to connect to if host is not "localhost".
+ 
+ --socket='/path/to/socket'
+   Socket to connect with.
  
  --type='table-type'
    Converts tables to the given table type (Default: $opt_type)

Regards,
Monty
Thread
[PATCH] mysql_convert_table_format.shJeremy Zawodny9 Apr
  • [PATCH] mysql_convert_table_format.shMichael Widenius9 Apr