1
by Philip Stoev
initial import from internal tree |
1 |
#!/usr/bin/perl
|
2 |
||
305
by Bernt M. Johnsen
Copyright headres and license added |
3 |
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
|
4 |
# Use is subject to license terms.
|
|
5 |
#
|
|
6 |
# This program is free software; you can redistribute it and/or modify
|
|
7 |
# it under the terms of the GNU General Public License as published by
|
|
8 |
# the Free Software Foundation; version 2 of the License.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful, but
|
|
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 |
# General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
|
18 |
# USA
|
|
19 |
||
1
by Philip Stoev
initial import from internal tree |
20 |
$| = 1; |
21 |
use strict; |
|
22 |
use lib 'lib'; |
|
23 |
use lib "$ENV{RQG_HOME}/lib"; |
|
160
by Bernt M. Johnsen
Changes + merge |
24 |
use Carp; |
1
by Philip Stoev
initial import from internal tree |
25 |
use GenTest; |
13.1.7
by lbieber
put if statement around SET SQL MODE which is MySQL only |
26 |
use GenTest::Constants; |
49
by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers |
27 |
use GenTest::App::Gendata; |
28 |
use Getopt::Long; |
|
29 |
||
160
by Bernt M. Johnsen
Changes + merge |
30 |
my ($spec_file, $config_file, $debug, $engine, $help, $dsn, $rows, $varchar_len, |
49
by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers |
31 |
$views, $server_id, $seed); |
1
by Philip Stoev
initial import from internal tree |
32 |
|
33 |
my $opt_result = GetOptions( |
|
34 |
'help' => \$help, |
|
160
by Bernt M. Johnsen
Changes + merge |
35 |
'config:s' => \$config_file, ## Kept for backward compatability. |
36 |
'spec:s' => \$spec_file, |
|
13.1.4
by lbieber
add debug information in gendata.pl |
37 |
'debug' => \$debug, |
1
by Philip Stoev
initial import from internal tree |
38 |
'dsn:s' => \$dsn, |
39 |
'seed=s' => \$seed, |
|
40 |
'engine:s' => \$engine, |
|
41 |
'rows=i' => \$rows, |
|
9
by Philip Stoev
merge from internal tree |
42 |
'views' => \$views, |
43 |
'varchar-length=i' => \$varchar_len, |
|
44 |
'server-id=i' > \$server_id |
|
1
by Philip Stoev
initial import from internal tree |
45 |
);
|
46 |
||
160
by Bernt M. Johnsen
Changes + merge |
47 |
if (defined $config_file) { |
48 |
carp("--config is deprecated. Use --spec"); |
|
49 |
$spec_file = $config_file if not defined $spec_file; |
|
50 |
}
|
|
51 |
||
52 |
help() if !$opt_result || $help || not defined $spec_file; |
|
31
by Bernt M. Johnsen
Updated some help function (more to do here) |
53 |
|
1
by Philip Stoev
initial import from internal tree |
54 |
exit(1) if !$opt_result; |
55 |
||
49
by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers |
56 |
|
160
by Bernt M. Johnsen
Changes + merge |
57 |
my $app = GenTest::App::Gendata->new(spec_file => $spec_file, |
49
by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers |
58 |
debug => $debug, |
59 |
dsn => $dsn, |
|
60 |
seed => $seed, |
|
61 |
engine => $engine, |
|
62 |
rows => $rows, |
|
63 |
views => $views, |
|
64 |
varchar_length => $varchar_len, |
|
65 |
server_id => $server_id); |
|
66 |
||
67 |
||
68 |
my $status = $app->run(); |
|
69 |
||
60.1.1
by Bernt M. Johnsen
Changed STATUS_OK to 0. Changed default MTR_BUILD_THREAD to 930 for legacy reasons |
70 |
exit $status; |
1
by Philip Stoev
initial import from internal tree |
71 |
|
72 |
sub help { |
|
73 |
||
74 |
print <<EOF |
|
31
by Bernt M. Johnsen
Updated some help function (more to do here) |
75 |
$0 - Random Data Generator. Options:
|
1
by Philip Stoev
initial import from internal tree |
76 |
|
13.1.4
by lbieber
add debug information in gendata.pl |
77 |
--debug : Turn on debugging for additional output
|
149.1.10
by Bernt M. Johnsen
Added print mode for Dummy executor |
78 |
--dsn : DBI resource to connect to
|
1
by Philip Stoev
initial import from internal tree |
79 |
--engine : Table engine to use when creating tables with gendata (default: no ENGINE for CREATE TABLE)
|
160
by Bernt M. Johnsen
Changes + merge |
80 |
--spec : Specification ZZ file describing the data (see RandomDataGenerator in MySQL Wiki)
|
31
by Bernt M. Johnsen
Updated some help function (more to do here) |
81 |
--rows : Number of rows to generate for each table, unless specified in the ZZ file
|
82 |
--seed : Seed to PRNG. if --seed=time the current time will be used. (default 1)
|
|
83 |
--views : Generate views
|
|
84 |
--varchar-length: maximum length of strings (deault 1)
|
|
1
by Philip Stoev
initial import from internal tree |
85 |
--help : This help message
|
86 |
EOF
|
|
87 |
;
|
|
88 |
exit(1); |
|
89 |
}
|