| 1 | 4 | ▶ | use MooseX::Declare; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 4 | ▶ | class TSQL::AST::SQLWhileStatement extends TSQL::AST::SQLStatement { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 4 | ▶ | use TSQL::AST::Factory; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 4 | ▶ | use TSQL::AST::SQLConditionalExpression; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use TSQL::AST::SQLStatement; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 4 | ▶ | use TSQL::AST::SQLStatementBlock; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 4 | ▶ | use TSQL::AST::SQLTryCatchBlock; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | #use TSQL::AST::SQLStatementBlock; | ||||||||||||||||||||
| 12 | 4 | ▶ | use TSQL::AST::SQLIfStatement; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | TSQL::AST::SQLWhileStatement - Represents a TSQL While Statement. | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =head1 VERSION | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | Version 0.02 | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | #our \$VERSION = '0.02'; | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 4 | ▶ | use feature "switch"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 4 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 4 | has 'condition' => ( | |||||||||||||||||||
| 33 | is => 'rw', | ||||||||||||||||||||
| 34 | isa => 'TSQL::AST::SQLConditionalExpression', | ||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 4 | has 'body' => ( | |||||||||||||||||||
| 39 | is => 'rw', | ||||||||||||||||||||
| 40 | isa => 'TSQL::AST::SQLStatement', | ||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 4 | ▶ | override parse ( ScalarRef[Int] $index, ArrayRef[Str] $input) { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=7 SCAR=20.8
| |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | # while ( $$index <= $#{$input} ) { | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 12 | my $ln = $$input[$$index]; | |||||||||||||||||||
| 50 | 12 | my $t = TSQL::AST::Factory->makeToken($ln); | |||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | #warn Dumper 'WHILE', $ln, $$index; | ||||||||||||||||||||
| 53 | #warn Dumper 'WHILE', $t; | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 12 | given ($t) { | |||||||||||||||||||
| 56 | 12 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::Begin') ) { | ||||||||||||||||||
|
Condition100%3/3
defined $_ && $_->isa('TSQL::AST::Token::Begin')
MC/DC100%2/2
defined $_ && $_->isa('TSQL::AST::Token::Begin')
defined $_
$_->isa('TSQL::AST::Token::Begin')
Truth table100%3/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::Begin')
| |||||||||||||||||||||
| 57 | 4 | $$index++; | |||||||||||||||||||
| 58 | 4 | my $block = TSQL::AST::SQLStatementBlock->new( statements => [] ) ; | |||||||||||||||||||
| 59 | 4 | $block->parse($index,$input); | |||||||||||||||||||
| 60 | 4 | $self->body($block); | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | 8 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::BeginTry') ) { | ||||||||||||||||||
|
Condition66%2/3
defined $_ && $_->isa('TSQL::AST::Token::BeginTry')
MC/DC0%0/2
defined $_ && $_->isa('TSQL::AST::Token::BeginTry')
defined $_
$_->isa('TSQL::AST::Token::BeginTry')
Truth table66%2/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::BeginTry')
| |||||||||||||||||||||
| 63 | 0 | $$index++; | |||||||||||||||||||
| 64 | 0 | my $block = TSQL::AST::SQLTryCatchBlock->new( tryBlock => [],catchBlock => [] ) ; | |||||||||||||||||||
| 65 | 0 | $block->parse($index,$input); | |||||||||||||||||||
| 66 | 0 | $self->body($block); | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | 8 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::Begin') ) { | ||||||||||||||||||
|
Condition66%2/3
defined $_ && $_->isa('TSQL::AST::Token::Begin')
MC/DC0%0/2
defined $_ && $_->isa('TSQL::AST::Token::Begin')
defined $_
$_->isa('TSQL::AST::Token::Begin')
Truth table66%2/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::Begin')
| |||||||||||||||||||||
| 69 | 0 | $$index++; | |||||||||||||||||||
| 70 | 0 | my $block = TSQL::AST::SQLStatementBlock->new( statements => [] ) ; | |||||||||||||||||||
| 71 | 0 | $block->parse($index,$input); | |||||||||||||||||||
| 72 | 0 | $self->body($block); | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | 8 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::BeginTry') ) { | ||||||||||||||||||
|
Condition66%2/3
defined $_ && $_->isa('TSQL::AST::Token::BeginTry')
MC/DC0%0/2
defined $_ && $_->isa('TSQL::AST::Token::BeginTry')
defined $_
$_->isa('TSQL::AST::Token::BeginTry')
Truth table66%2/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::BeginTry')
| |||||||||||||||||||||
| 75 | 0 | $$index++; | |||||||||||||||||||
| 76 | 0 | my $block = TSQL::AST::SQLTryCatchBlock->new( tryBlock => [],catchBlock => [] ) ; | |||||||||||||||||||
| 77 | 0 | $block->parse($index,$input); | |||||||||||||||||||
| 78 | 0 | $self->body($block); | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | 8 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::If') ) { | ||||||||||||||||||
|
Condition100%3/3
defined $_ && $_->isa('TSQL::AST::Token::If')
MC/DC100%2/2
defined $_ && $_->isa('TSQL::AST::Token::If')
defined $_
$_->isa('TSQL::AST::Token::If')
Truth table100%3/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::If')
| |||||||||||||||||||||
| 81 | 2 | $$index++; | |||||||||||||||||||
| 82 | 2 | my $block = TSQL::AST::Factory->makeIfStatement($ln); | |||||||||||||||||||
| 83 | 2 | $block->parse($index,$input); | |||||||||||||||||||
| 84 | 2 | $self->body($block); | |||||||||||||||||||
| 85 | } | ||||||||||||||||||||
| 86 | 6 | ▶ | when ( defined $_ && $_->isa('TSQL::AST::Token::While') ) { | ||||||||||||||||||
|
Condition66%2/3
defined $_ && $_->isa('TSQL::AST::Token::While')
MC/DC50%1/2
defined $_ && $_->isa('TSQL::AST::Token::While')
defined $_
$_->isa('TSQL::AST::Token::While')
Truth table66%2/3
A && B
A= defined $_B= $_->isa('TSQL::AST::Token::While')
| |||||||||||||||||||||
| 87 | 1 | $$index++; | |||||||||||||||||||
| 88 | 1 | my $block = TSQL::AST::Factory->makeWhileStatement($ln); | |||||||||||||||||||
| 89 | 1 | $block->parse($index,$input); | |||||||||||||||||||
| 90 | 1 | $self->body($block); | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 5 | default { | |||||||||||||||||||
| 94 | 5 | my $statement = TSQL::AST::Factory->makeStatement($ln); | |||||||||||||||||||
| 95 | #warn Dumper $ln; | ||||||||||||||||||||
| 96 | #warn Dumper $statement; | ||||||||||||||||||||
| 97 | 5 | $self->body($statement); | |||||||||||||||||||
| 98 | 5 | $$index++; | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | } | ||||||||||||||||||||
| 101 | # } | ||||||||||||||||||||
| 102 | #warn Dumper "WHILE end", $$index; | ||||||||||||||||||||
| 103 | 4 | return $self ;} | |||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 4 | ▶ | } | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | 4 | 1; | |||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | =head1 SYNOPSIS | ||||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | Represents the parsed version/AST of a TSQL While Statement. | ||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | =head1 DESCRIPTION | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | See TSQL::AST. | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | =head1 DEPENDENCIES | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | See TSQL::AST. | ||||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | =head1 AUTHOR | ||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | Ded MedVed, C<< <dedmedved at cpan.org> >> | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | =head1 BUGS | ||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | See TSQL::AST. | ||||||||||||||||||||
| 133 | |||||||||||||||||||||
| 134 | =head1 METHODS | ||||||||||||||||||||
| 135 | |||||||||||||||||||||
| 136 | =head2 C<new> | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | =over 4 | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | =item * C<< TSQL::AST::SQLWhileStatement->new() >> | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | =back | ||||||||||||||||||||
| 143 | |||||||||||||||||||||
| 144 | It creates and returns a new TSQL::AST::SQLWhileStatement object. | ||||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | =head2 C<parse> | ||||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | =over 4 | ||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | =item * C<< $while->parse( integer index into array, array of sqlfragments ) >> | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | This is the method which parses the split up SQL code. | ||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | =back | ||||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | =head2 C<condition> | ||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | =over 4 | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | =item * C<< $while->condition() >> | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | TSQL::AST::SQLConditionalExpression representing the condition clause of the While statement. | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | =back | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | |||||||||||||||||||||
| 168 | =head2 C<body> | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | =over 4 | ||||||||||||||||||||
| 171 | |||||||||||||||||||||
| 172 | =item * C<< $while->body() >> | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | TSQL::AST::SQLStatement representing the body of the While statement. | ||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | =back | ||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | =head1 LIMITATIONS | ||||||||||||||||||||
| 179 | |||||||||||||||||||||
| 180 | No limitations are currently known, as far as the intended usage is concerned. | ||||||||||||||||||||
| 181 | You *are* bound to uncover a large number of problems. | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | Please report any problematic cases. | ||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | =head1 SUPPORT | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | perldoc TSQL::AST::SQLWhileStatement | ||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | You can also look for information at: | ||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | =over 4 | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=TSQL::AST> | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | L<http://annocpan.org/dist/TSQL::AST> | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | =item * CPAN Ratings | ||||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | L<http://cpanratings.perl.org/d/TSQL::AST> | ||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | =item * Search CPAN | ||||||||||||||||||||
| 210 | |||||||||||||||||||||
| 211 | L<http://search.cpan.org/dist/TSQL::AST/> | ||||||||||||||||||||
| 212 | |||||||||||||||||||||
| 213 | =back | ||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | |||||||||||||||||||||
| 216 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | =over 4 | ||||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | None yet. | ||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | =back | ||||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | =head1 SEE ALSO | ||||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | |||||||||||||||||||||
| 228 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||
| 229 | |||||||||||||||||||||
| 230 | Copyright 2012 Ded MedVed. | ||||||||||||||||||||
| 231 | |||||||||||||||||||||
| 232 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||
| 233 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||
| 234 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||
| 235 | |||||||||||||||||||||
| 236 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||
| 237 | |||||||||||||||||||||
| 238 | |||||||||||||||||||||
| 239 | =cut | ||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | 4 | 1; # End of TSQL::AST::SQLWhileStatement | |||||||||||||||||||
| 242 | |||||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | |||||||||||||||||||||