MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
have_connectorj.inc
1 --perl
2 use strict;
3 use IO::File;
4 use lib "lib/";
5 use My::Platform;
6 
7 
8 #
9 # Looks for MySQL Connector/J JAR file in MTR_CLASSPATH
10 #
11 
12 my $ok = 0;
13 my $classpath = $ENV{'MTR_CLASSPATH'} || '';
14 my $vardir = $ENV{MYSQLTEST_VARDIR} or die "Need MYSQLTEST_VARDIR";
15 my $jar;
16 my $notfound;
17 my $sep = (IS_WINDOWS) ? ';' : ':';
18 
19 
20 # -- look for the Connctor/J jar file
21 foreach $jar (split $sep, $classpath) {
22  if($jar =~ m/mysql-connector/ && -f $jar) {
23  $ok = 2;
24  last;
25  }
26  elsif($jar =~ m/mysql-connector/) {
27  $ok = 1;
28  $notfound = $jar;
29  }
30 }
31 
32 # -- write the result to the output file
33 my $F = IO::File->new("$vardir/tmp/have_connectorj_result.inc", "w") or die;
34 if($ok == 2) {
35  print $F "--echo Found Connector/J JAR in MTR_CLASSPATH\n";
36 }
37 elsif($ok == 1) {
38  print $F "--skip JAR file not found: \"$notfound\"\n";
39 }
40 else {
41  print $F "--skip Please specify Connector/J JAR file in MTR_CLASSPATH env variable\n";
42 }
43 
44 $F->close();
45 
46 EOF
47 
48 --source $MYSQLTEST_VARDIR/tmp/have_connectorj_result.inc