~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/randgen/gendata-old.pl

  • Committer: patrick crews
  • Date: 2011-10-05 20:40:33 UTC
  • mfrom: (2337.1.24 dbqp_revamp2)
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: gleebix@gmail.com-20111005204033-5m6kvcii1q87yur6
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
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
 
 
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;
 
27
use GenTest::Constants;
 
28
use GenTest::App::GendataSimple;
 
29
 
 
30
my ($dsn, $engine, $help, $views, $notnull);
 
31
 
 
32
my @ARGV_saved = @ARGV;
 
33
 
 
34
my $opt_result = GetOptions(
 
35
        'dsn=s' => \$dsn,
 
36
        'engine:s' => \$engine,
 
37
        'help' => \$help,
 
38
        'views' => \$views,
 
39
        'notnull' => \$notnull
 
40
);
 
41
 
 
42
my $default_dsn = GenTest::App::GendataSimple->defaultDsn();
 
43
 
 
44
help() if !$opt_result || $help;
 
45
 
 
46
my $app = GenTest::App::GendataSimple->new(dsn => $dsn,
 
47
                                           engine => $engine,
 
48
                                           views => $views,
 
49
                                           notnull => $notnull);
 
50
 
 
51
say("Starting \n# $0 \\ \n# ".join(" \\ \n# ", @ARGV_saved));
 
52
 
 
53
my $status = $app->run();
 
54
 
 
55
exit $status;
 
56
 
 
57
sub help {
 
58
print <<EOF
 
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
 
64
    --notnull   : Generate all fields with NOT NULL
 
65
    --help      : This help message 
 
66
EOF
 
67
;
 
68
        safe_exit(1);
 
69
}
 
70