| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*-perl-*- |
|
2
|
|
|
|
|
|
|
# Creation date: 2003-03-30 16:26:50 |
|
3
|
|
|
|
|
|
|
# Authors: Don |
|
4
|
|
|
|
|
|
|
# Change log: |
|
5
|
|
|
|
|
|
|
# $Revision: 1963 $ |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Copyright (c) 2003-2012 Don Owens |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# All rights reserved. This program is free software; you can |
|
10
|
|
|
|
|
|
|
# redistribute it and/or modify it under the same terms as Perl |
|
11
|
|
|
|
|
|
|
# itself. |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
83
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ package DBIx::Wrapper::SQLCommand; |
|
16
|
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
10
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
854
|
|
|
18
|
|
|
|
|
|
|
$VERSION = do { my @r=(q$Revision: 1963 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r }; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
|
21
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
|
22
|
0
|
|
|
|
|
|
my $str = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
|
my $self = bless { _str => $str }, ref($proto) || $proto; |
|
25
|
0
|
|
|
|
|
|
return $self; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new_cond { |
|
29
|
0
|
|
|
0
|
0
|
|
my ($proto, $dbh, $cond, $val) = @_; |
|
30
|
0
|
|
0
|
|
|
|
my $self = bless { _cond => $cond, _dbh => $dbh, _val => $val }, ref($proto) || $proto; |
|
31
|
0
|
|
|
|
|
|
return $self; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub asString { |
|
36
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
37
|
0
|
|
|
|
|
|
my $str = $self->{_str}; |
|
38
|
0
|
|
|
|
|
|
return $str; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
*as_string = \&asString; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_condition { |
|
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
44
|
0
|
|
|
|
|
|
my $bind = shift; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $cond_str = $self->{_cond}; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
unless (defined($cond_str)) { |
|
49
|
0
|
|
|
|
|
|
return; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $val = $self->{_val}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $cond = ''; |
|
55
|
0
|
0
|
|
|
|
|
if ($cond_str eq 'not') { |
|
56
|
0
|
0
|
|
|
|
|
if (defined($val)) { |
|
57
|
0
|
|
|
|
|
|
$cond = '!='; |
|
58
|
0
|
0
|
|
|
|
|
if ($bind) { |
|
59
|
0
|
0
|
|
|
|
|
return wantarray ? ($cond, '?') : $cond; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
|
my $rv = $self->{_dbh}->quote($val); |
|
63
|
0
|
0
|
|
|
|
|
return wantarray ? ($cond, $rv) : $cond; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
else { |
|
68
|
0
|
|
|
|
|
|
$cond = 'IS NOT NULL'; |
|
69
|
0
|
0
|
|
|
|
|
return wantarray ? ($cond, undef) : $cond; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub has_condition { |
|
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
77
|
0
|
|
|
|
|
|
return defined($self->{_cond}); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub get_val { |
|
81
|
0
|
|
|
0
|
0
|
|
return shift()->{_val}; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|