1
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
2
# Use is subject to license terms.
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.
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.
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
18
package GenTest::Result;
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;
48
return $class->SUPER::new({
49
'query' => RESULT_QUERY,
50
'status' => RESULT_STATUS,
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
70
return $_[0]->[RESULT_QUERY];
74
return $_[0]->[RESULT_STATUS];
78
return $_[0]->[RESULT_ERR];
82
return $_[0]->[RESULT_ERRSTR];
86
return $_[0]->[RESULT_SQLSTATE];
90
return $_[0]->[RESULT_AFFECTED_ROWS];
94
return $_[0]->[RESULT_MATCHED_ROWS];
98
return $_[0]->[RESULT_CHANGED_ROWS];
102
return $_[0]->[RESULT_INFO];
106
return $_[0]->[RESULT_DATA];
111
if (defined $result->[RESULT_DATA]) {
112
return $#{$result->[RESULT_DATA]} + 1;
119
return $_[0]->[RESULT_END_TIME] - $_[0]->[RESULT_START_TIME];
123
return $_[0]->[RESULT_START_TIME];
127
return $_[0]->[RESULT_END_TIME];
131
return $_[0]->[RESULT_WARNINGS];
135
$_[0]->[RESULT_WARNINGS] = $_[1];
139
return $_[0]->[RESULT_COLUMN_NAMES];
143
return $_[0]->[RESULT_COLUMN_TYPES];
147
return $_[0]->[RESULT_EXPLAIN];
151
return $_[0]->[RESULT_PERFORMANCE];