~drizzle-trunk/drizzle/development

0.67.1 by Philip Stoev
initial import from internal tree
1
#!/usr/bin/perl
2
0.67.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
0.67.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";
24
use DBI;
25
use Getopt::Long;
26
use GenTest;
0.67.58 by Bernt M. Johnsen
Small fix to gendata-old.pl
27
use GenTest::Constants;
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
28
use GenTest::App::GendataSimple;
29
30
my ($dsn, $engine, $help, $views);
0.67.1 by Philip Stoev
initial import from internal tree
31
32
my @ARGV_saved = @ARGV;
33
34
my $opt_result = GetOptions(
0.67.10 by Philip Stoev
initial fixes for drizzle
35
	'dsn=s' => \$dsn,
0.67.1 by Philip Stoev
initial import from internal tree
36
	'engine:s' => \$engine,
0.67.10 by Philip Stoev
initial fixes for drizzle
37
	'help' => \$help,
0.67.1 by Philip Stoev
initial import from internal tree
38
	'views' => \$views
39
);
40
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
41
my $default_dsn = GenTest::App::GendataSimple->defaultDsn();
42
0.67.1 by Philip Stoev
initial import from internal tree
43
help() if !$opt_result || $help;
44
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
45
my $app = GenTest::App::GendataSimple->new(dsn => $dsn,
46
                                           engine => $engine,
47
                                           views => $views);
48
0.67.1 by Philip Stoev
initial import from internal tree
49
say("Starting \n# $0 \\ \n# ".join(" \\ \n# ", @ARGV_saved));
50
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
51
my $status = $app->run();
52
0.73.1 by Bernt M. Johnsen
Changed STATUS_OK to 0. Changed default MTR_BUILD_THREAD to 930 for legacy reasons
53
exit $status;
0.67.1 by Philip Stoev
initial import from internal tree
54
55
sub help {
56
print <<EOF
0.67.31 by Bernt M. Johnsen
Updated some help function (more to do here)
57
$0 - Simple data generator. Options:
58
59
    --dsn       : MySQL DBI resource to connect to (default $default_dsn)
60
    --engine    : Table engine to use when creating tables (default: no ENGINE in CREATE TABLE )
61
    --views     : Generate views
62
    --help      : This help message 
0.67.1 by Philip Stoev
initial import from internal tree
63
EOF
64
;
65
	safe_exit(1);
66
}
67