~ubuntu-branches/ubuntu/vivid/drizzle/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/kewpie/randgen/lib/GenTest/Result.pm

  • Committer: Package Import Robot
  • Author(s): Tobias Frost
  • Date: 2013-08-22 20:18:31 UTC
  • mto: (20.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20130822201831-gn3ozsh7o7wmc5tk
Tags: upstream-7.2.3
ImportĀ upstreamĀ versionĀ 7.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
2
 
# Use is subject to license terms.
3
 
#
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; version 2 of the License.
7
 
#
8
 
# This program is distributed in the hope that it will be useful, but
9
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
 
# General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
16
 
# USA
17
 
 
18
 
package GenTest::Result;
19
 
 
20
 
require Exporter;
21
 
@ISA = qw(GenTest);
22
 
 
23
 
use strict;
24
 
use GenTest;
25
 
 
26
 
use constant RESULT_QUERY               => 0;
27
 
use constant RESULT_STATUS              => 1;
28
 
use constant RESULT_ERR                 => 2;
29
 
use constant RESULT_ERRSTR              => 3;
30
 
use constant RESULT_SQLSTATE            => 4;
31
 
use constant RESULT_AFFECTED_ROWS       => 5;
32
 
use constant RESULT_DATA                => 6;
33
 
use constant RESULT_START_TIME          => 7;
34
 
use constant RESULT_END_TIME            => 8;
35
 
use constant RESULT_WARNINGS            => 9;
36
 
use constant RESULT_COLUMN_NAMES        => 10;
37
 
use constant RESULT_MATCHED_ROWS        => 11;
38
 
use constant RESULT_CHANGED_ROWS        => 12;
39
 
use constant RESULT_INFO                => 13;
40
 
use constant RESULT_COLUMN_TYPES        => 14;
41
 
use constant RESULT_EXPLAIN             => 15;
42
 
use constant RESULT_PERFORMANCE         => 16;
43
 
 
44
 
1;
45
 
 
46
 
sub new {
47
 
        my $class = shift;
48
 
        return $class->SUPER::new({
49
 
                'query'         => RESULT_QUERY,
50
 
                'status'        => RESULT_STATUS,
51
 
                'err'           => RESULT_ERR,
52
 
                'errstr'        => RESULT_ERRSTR,
53
 
                'sqlstate'      => RESULT_SQLSTATE,
54
 
                'affected_rows' => RESULT_AFFECTED_ROWS,
55
 
                'data'          => RESULT_DATA,
56
 
                'start_time'    => RESULT_START_TIME,
57
 
                'end_time'      => RESULT_END_TIME,
58
 
                'warnings'      => RESULT_WARNINGS,
59
 
                'column_names'  => RESULT_COLUMN_NAMES,
60
 
                'matched_rows'  => RESULT_MATCHED_ROWS,
61
 
                'changed_rows'  => RESULT_CHANGED_ROWS,
62
 
                'info'          => RESULT_INFO,
63
 
                'column_types'  => RESULT_COLUMN_TYPES,
64
 
                'explain'       => RESULT_EXPLAIN,
65
 
                'performance'   => RESULT_PERFORMANCE
66
 
        }, @_);
67
 
}
68
 
 
69
 
sub query {
70
 
        return $_[0]->[RESULT_QUERY];
71
 
}
72
 
 
73
 
sub status {
74
 
        return $_[0]->[RESULT_STATUS];
75
 
}
76
 
 
77
 
sub err {
78
 
        return $_[0]->[RESULT_ERR];
79
 
}
80
 
 
81
 
sub errstr {
82
 
        return $_[0]->[RESULT_ERRSTR];
83
 
}
84
 
 
85
 
sub sqlstate {
86
 
        return $_[0]->[RESULT_SQLSTATE];
87
 
}
88
 
 
89
 
sub affectedRows {
90
 
        return $_[0]->[RESULT_AFFECTED_ROWS];
91
 
}
92
 
 
93
 
sub matchedRows {
94
 
        return $_[0]->[RESULT_MATCHED_ROWS];
95
 
}
96
 
 
97
 
sub changedRows {
98
 
        return $_[0]->[RESULT_CHANGED_ROWS];
99
 
}
100
 
 
101
 
sub info {
102
 
        return $_[0]->[RESULT_INFO];
103
 
}
104
 
 
105
 
sub data {
106
 
        return $_[0]->[RESULT_DATA];
107
 
}
108
 
 
109
 
sub rows {
110
 
        my $result = shift;
111
 
        if (defined $result->[RESULT_DATA]) {
112
 
                return $#{$result->[RESULT_DATA]} + 1;
113
 
        } else {
114
 
                return undef;
115
 
        }
116
 
}
117
 
 
118
 
sub duration {
119
 
        return $_[0]->[RESULT_END_TIME] - $_[0]->[RESULT_START_TIME];
120
 
}
121
 
 
122
 
sub startTime {
123
 
        return $_[0]->[RESULT_START_TIME];
124
 
}
125
 
 
126
 
sub endTime {
127
 
        return $_[0]->[RESULT_END_TIME];
128
 
}
129
 
 
130
 
sub warnings {
131
 
        return $_[0]->[RESULT_WARNINGS];
132
 
}
133
 
 
134
 
sub setWarnings {
135
 
        $_[0]->[RESULT_WARNINGS] = $_[1];
136
 
}
137
 
 
138
 
sub columnNames {
139
 
        return $_[0]->[RESULT_COLUMN_NAMES];
140
 
}
141
 
 
142
 
sub columnTypes {
143
 
        return $_[0]->[RESULT_COLUMN_TYPES];
144
 
}
145
 
 
146
 
sub explain {
147
 
        return $_[0]->[RESULT_EXPLAIN];
148
 
}
149
 
 
150
 
sub performance {
151
 
        return $_[0]->[RESULT_PERFORMANCE];
152
 
}
153
 
 
154
 
1;