Bug #592 Accept --socket as option
Submitted: 5 Jun 2003 5:54 Modified: 11 Jun 2003 4:42
Reporter: Dennis Haney Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:NA
Assigned to: Lenz Grimmer CPU Architecture:Any

[5 Jun 2003 5:54] Dennis Haney
Description:
Patch mysql_explain_log to accept --socket option

How to repeat:
NA

Suggested fix:
===== mysql_explain_log.sh 1.2 vs edited =====
--- 1.2/scripts/mysql_explain_log.sh    Tue Sep 17 22:46:51 2002
+++ edited/mysql_explain_log.sh Thu Jun  5 14:51:40 2003
@@ -14,12 +14,14 @@
 $Param->{user}='';
 $Param->{password}='';
 $Param->{PrintError}=0;
+$Param->{socket}='';

 if (!GetOptions ('date|d:i' => \$Param->{ViewDate},
                 'host|h:s' => \$Param->{host},
                 'user|u:s' => \$Param->{user},
                 'password|p:s' => \$Param->{password},
                 'printerror|e:s' => \$Param->{PrintError},
+                'socket|s:s' => \$Param->{socket},
                )) {
   ShowOptions();
 }
@@ -50,7 +52,7 @@

   #print "Date=$Param->{ViewDate}, host=$Param->{host}, user=$Param->{user}, password=$Param->{password}\n";

-  $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}",$Param->{user},$Param->{password},{PrintError=>0});
+  $Param->{dbh}=DBI->connect("DBI:mysql:host=$Param->{host}".($Param->{socket}?";mysql_socket=$Param->{socket}":""),$Param->{user},$Param->{password},{PrintError=>0});
   if (DBI::err()) {
     print "Error: " . DBI::errstr() . "\n";
   }
@@ -313,6 +315,8 @@
 -u=USERNAME
 --password=PASSWORD password of db-user
 -p=PASSWORD
+--socket=/path/to/socket change path to the socket
+-s=/path/to/socket

 Read logfile from STDIN an try to EXPLAIN all SELECT statements. All UPDATE statements are rewritten to an EXPLAIN SELECT statement. The results of the EXPLAIN statement are collected and counted. All results with type=ALL are collected in an separete list. Results are printed to STDOUT.

@@ -344,7 +348,7 @@

 =head1 USAGE

-explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] < logfile
+explain_log.pl [--date=YYMMDD] --host=dbhost] [--user=dbuser] [--password=dbpw] [--socket=/path/to/socket] < logfile

 --date=YYMMDD       select only entrys of date

@@ -361,6 +365,10 @@
 --password=PASSWORD password of db-user

 -p=PASSWORD
+
+--socket=/path/to/socket change path to the socket
+
+-s=/path/to/socket

 =head1 EXAMPLE
[11 Jun 2003 4:42] Lenz Grimmer
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

Thanks, applied in 4.0 (will be propagated to 4.1 as well)