| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CGI::OptimalQuery; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
6681
|
use strict; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
223
|
|
|
4
|
8
|
|
|
8
|
|
32
|
use warnings; |
|
|
8
|
|
|
|
|
12
|
|
|
|
8
|
|
|
|
|
207
|
|
|
5
|
8
|
|
|
8
|
|
32
|
no warnings qw( uninitialized redefine ); |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
283
|
|
|
6
|
8
|
|
|
8
|
|
5246
|
use CGI(); |
|
|
8
|
|
|
|
|
188703
|
|
|
|
8
|
|
|
|
|
274
|
|
|
7
|
8
|
|
|
8
|
|
3502
|
use CGI::OptimalQuery::SavedSearches(); |
|
|
8
|
|
|
|
|
22
|
|
|
|
8
|
|
|
|
|
216
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
|
10
|
8
|
|
|
8
|
|
50
|
use Exporter (); |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
186
|
|
|
11
|
8
|
|
|
8
|
|
37
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
712
|
|
|
12
|
8
|
|
|
8
|
|
26
|
$VERSION = '0.30'; |
|
13
|
8
|
|
|
|
|
188
|
@ISA = qw(Exporter); |
|
14
|
|
|
|
|
|
|
#Give a hoot don't pollute, do not export more than needed by default |
|
15
|
8
|
|
|
|
|
31
|
@EXPORT = qw(); |
|
16
|
8
|
|
|
|
|
13
|
@EXPORT_OK = qw(); |
|
17
|
8
|
|
|
|
|
3928
|
%EXPORT_TAGS = (); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# module registry - when loading a sub module, the module CGI param is |
|
22
|
|
|
|
|
|
|
# consulted, and the value is loaded as a module. |
|
23
|
|
|
|
|
|
|
our $DEFAULT_MODULE = 'InteractiveQuery2'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our %DEFAULT_MODULES = ( |
|
26
|
|
|
|
|
|
|
'SimpleQuery' => 'CGI::OptimalQuery::SimpleQuery', |
|
27
|
|
|
|
|
|
|
'CustomOutput' => 'CGI::OptimalQuery::CustomOutput', |
|
28
|
|
|
|
|
|
|
'PrinterFriendly' => 'CGI::OptimalQuery::PrinterFriendly', |
|
29
|
|
|
|
|
|
|
'CSV' => 'CGI::OptimalQuery::CSV', |
|
30
|
|
|
|
|
|
|
'InteractiveFilter' => 'CGI::OptimalQuery::InteractiveFilter', |
|
31
|
|
|
|
|
|
|
'InteractiveQuery' => 'CGI::OptimalQuery::InteractiveQuery', |
|
32
|
|
|
|
|
|
|
'XML' => 'CGI::OptimalQuery::XML', |
|
33
|
|
|
|
|
|
|
'JSON' => 'CGI::OptimalQuery::JSON', |
|
34
|
|
|
|
|
|
|
'InteractiveQuery2' => 'CGI::OptimalQuery::InteractiveQuery2', |
|
35
|
|
|
|
|
|
|
'InteractiveFilter2' => 'CGI::OptimalQuery::InteractiveFilter2', |
|
36
|
|
|
|
|
|
|
'ShowColumns' => 'CGI::OptimalQuery::ShowColumns', |
|
37
|
|
|
|
|
|
|
'InteractiveQuery2Tools' => 'CGI::OptimalQuery::InteractiveQuery2Tools' |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub default_output_handler { |
|
41
|
0
|
|
|
0
|
0
|
|
print STDOUT @_; |
|
42
|
0
|
|
|
|
|
|
return undef; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
sub default_error_handler { |
|
45
|
0
|
|
|
0
|
0
|
|
print STDERR @_; |
|
46
|
0
|
|
|
|
|
|
return undef; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Constructor |
|
51
|
|
|
|
|
|
|
# my $recset = CGI::OptimalQuery->new(\%schema ) |
|
52
|
|
|
|
|
|
|
# This constructor instantiates the correct class based on the module param. |
|
53
|
|
|
|
|
|
|
sub new { |
|
54
|
0
|
|
|
0
|
1
|
|
my $pack = shift; |
|
55
|
0
|
|
|
|
|
|
my $schema = $_[0]; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ($CGI::OptimalQuery::q) { |
|
58
|
0
|
|
|
|
|
|
$$schema{q} = $CGI::OptimalQuery::q; |
|
59
|
|
|
|
|
|
|
} else { |
|
60
|
0
|
|
0
|
|
|
|
$$schema{q} ||= new CGI(); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# if this is a mod_perl query object, turn it into a CGI object |
|
64
|
0
|
0
|
|
|
|
|
if (! $$schema{q}->isa('CGI')) { |
|
65
|
0
|
|
|
|
|
|
my @names = $$schema{q}->param(); |
|
66
|
0
|
|
|
|
|
|
my %params; |
|
67
|
0
|
|
|
|
|
|
foreach my $p (@names) { |
|
68
|
0
|
|
|
|
|
|
my @v = $$schema{q}->param($p); |
|
69
|
0
|
|
|
|
|
|
$params{$p} = \@v; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
0
|
|
|
|
|
|
$$schema{q} = new CGI(\%params); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# set default handlers |
|
75
|
0
|
|
0
|
|
|
|
$$schema{output_handler} ||= \&default_output_handler; |
|
76
|
0
|
|
0
|
|
|
|
$$schema{error_handler} ||= \&default_error_handler; |
|
77
|
0
|
|
0
|
|
|
|
$$schema{httpHeader} ||= \&CGI::header; |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# find module & class |
|
80
|
0
|
|
0
|
|
|
|
my $module = $$schema{q}->param('module') || $$schema{module} || $DEFAULT_MODULE; |
|
81
|
0
|
|
0
|
|
|
|
my $class = $$schema{modules}{$module} || $DEFAULT_MODULES{$module}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# dynamically load class |
|
84
|
0
|
|
|
|
|
|
my $rv = eval "require $class"; |
|
85
|
0
|
0
|
|
|
|
|
if ($@ =~ /Not\ Found/) { die "Could not find class $class"; } |
|
|
0
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
elsif ($@) { die "Compile Error in class $class: $@"; } |
|
87
|
0
|
|
|
|
|
|
elsif ($rv != 1) { die "Initialization error in class $class, should return 1"; } |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# call appropriate constructor |
|
90
|
0
|
|
|
|
|
|
return $class->new(@_); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
0
|
|
sub escape_js { CGI::OptimalQuery::Base::escape_js(@_); } |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub get_saved_search_list { |
|
97
|
0
|
|
|
0
|
0
|
|
my ($q, $dbh, $userid) = @_; |
|
98
|
0
|
|
|
|
|
|
return CGI::OptimalQuery::SavedSearches::get_html($q, $dbh, $userid); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
|
103
|
|
|
|
|
|
|
__END__ |