~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
0.67.497 by eve
added --notnull option to all scripts
30
my ($dsn, $engine, $help, $views, $notnull);
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.497 by eve
added --notnull option to all scripts
38
	'views' => \$views,
39
	'notnull' => \$notnull
0.67.1 by Philip Stoev
initial import from internal tree
40
);
41
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
42
my $default_dsn = GenTest::App::GendataSimple->defaultDsn();
43
0.67.1 by Philip Stoev
initial import from internal tree
44
help() if !$opt_result || $help;
45
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
46
my $app = GenTest::App::GendataSimple->new(dsn => $dsn,
47
                                           engine => $engine,
0.67.497 by eve
added --notnull option to all scripts
48
                                           views => $views,
49
					   notnull => $notnull);
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
50
0.67.1 by Philip Stoev
initial import from internal tree
51
say("Starting \n# $0 \\ \n# ".join(" \\ \n# ", @ARGV_saved));
52
0.67.49 by Bernt M. Johnsen
Refactored gendata.pl and gendata-old.pl to modules. The scripts are kept as wrappers
53
my $status = $app->run();
54
0.73.1 by Bernt M. Johnsen
Changed STATUS_OK to 0. Changed default MTR_BUILD_THREAD to 930 for legacy reasons
55
exit $status;
0.67.1 by Philip Stoev
initial import from internal tree
56
57
sub help {
58
print <<EOF
0.67.31 by Bernt M. Johnsen
Updated some help function (more to do here)
59
$0 - Simple data generator. Options:
60
61
    --dsn       : MySQL DBI resource to connect to (default $default_dsn)
62
    --engine    : Table engine to use when creating tables (default: no ENGINE in CREATE TABLE )
63
    --views     : Generate views
0.67.497 by eve
added --notnull option to all scripts
64
    --notnull	: Generate all fields with NOT NULL
0.67.31 by Bernt M. Johnsen
Updated some help function (more to do here)
65
    --help      : This help message 
0.67.1 by Philip Stoev
initial import from internal tree
66
EOF
67
;
68
	safe_exit(1);
69
}
70