| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package DBIx::Romani::Query::XML::TTT; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
613
|
use DBIx::Romani::Query::XML::Util; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use DBIx::Romani::Query::XML::Where; |
|
6
|
|
|
|
|
|
|
use DBIx::Romani::Query::XML::SQL; |
|
7
|
|
|
|
|
|
|
use DBIx::Romani::Query::SQL::TTT::Operator; |
|
8
|
|
|
|
|
|
|
use DBIx::Romani::Query::SQL::TTT::Function; |
|
9
|
|
|
|
|
|
|
use DBIx::Romani::Query::SQL::TTT::Keyword; |
|
10
|
|
|
|
|
|
|
use DBIx::Romani::Query::SQL::TTT::Join; |
|
11
|
|
|
|
|
|
|
use XML::DOM; |
|
12
|
|
|
|
|
|
|
use strict; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Data::Dumper; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# NOTE: Copied from DBIx::Romani::Query::Select!! |
|
17
|
|
|
|
|
|
|
sub get_node_type |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
|
|
|
|
|
|
my $ttt_node = shift; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $type; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ( $ttt_node->getAttributeNode( 'op' ) ) |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
|
|
|
|
|
|
$type = 'op'; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
if ( $ttt_node->getAttributeNode( 'func' ) ) |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
|
|
|
|
|
|
if ( $type ) |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
|
|
|
|
|
|
$type = 'invalid'; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
else |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
|
|
|
|
|
|
$type = 'func'; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
if ( $ttt_node->getAttributeNode( 'keyword' ) ) |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
|
|
|
|
|
|
if ( $type ) |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
|
|
|
|
|
|
$type = 'invalid'; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
|
|
|
|
|
|
$type = 'keyword'; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
if ( not defined $type ) |
|
50
|
|
|
|
|
|
|
{ |
|
51
|
|
|
|
|
|
|
$type = 'join'; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
if ( $type eq 'invalid' ) |
|
55
|
|
|
|
|
|
|
{ |
|
56
|
|
|
|
|
|
|
die " can only contain one of the following attributes: op, func, keyword"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return $type; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub create_ttt_from_node |
|
63
|
|
|
|
|
|
|
{ |
|
64
|
|
|
|
|
|
|
my $ttt_node = shift; |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $type = get_node_type( $ttt_node ); |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# first create ourselfs |
|
69
|
|
|
|
|
|
|
my $ttt; |
|
70
|
|
|
|
|
|
|
if ( $type eq 'op' ) |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
|
|
|
|
|
|
$ttt = DBIx::Romani::Query::SQL::TTT::Operator->new( $ttt_node->getAttribute('op') ); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
elsif ( $type eq 'func' ) |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
|
|
|
|
|
|
$ttt = DBIx::Romani::Query::SQL::TTT::Function->new( $ttt_node->getAttribute('func') ); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
elsif ( $type eq 'keyword' ) |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
|
|
|
|
|
|
$ttt = DBIx::Romani::Query::SQL::TTT::Keyword->new( $ttt_node->getAttribute('keyword') ); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
elsif ( $type eq 'join' ) |
|
83
|
|
|
|
|
|
|
{ |
|
84
|
|
|
|
|
|
|
$ttt = DBIx::Romani::Query::SQL::TTT::Join->new(); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# go through our children |
|
88
|
|
|
|
|
|
|
my $node = $ttt_node->getFirstChild(); |
|
89
|
|
|
|
|
|
|
while ( defined $node ) |
|
90
|
|
|
|
|
|
|
{ |
|
91
|
|
|
|
|
|
|
if ( $node->getNodeType() == XML::DOM::ELEMENT_NODE ) |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
|
|
|
|
|
|
# now we recurse using the generic handler! |
|
94
|
|
|
|
|
|
|
$ttt->add( DBIx::Romani::Query::XML::SQL::create_where_from_node($node) ); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
$node = $node->getNextSibling(); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
return $ttt; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
|
104
|
|
|
|
|
|
|
|