Benchmark/Query/common.pm

filter: Statementstmt 11.1% 17 / 152 Branchbran 0.0% 0 / 34 Conditioncond 0.0% 0 / 16 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 11.4% 4 / 35 Podpod 0.0% 0 / 29 totaltotal 7.6% 21 / 274 CC 27 SCAR 35.2
CC
27
Cov
8%
create_where_clause
132.0
create_period_check
56.0
select_data_values_for_subsume
12.0
CRAP 33.8
« Benchmark.pm ↑ Summary Benchmark/Query.pm »
1 package Tapper::Benchmark::Query::common;
2 3 our $AUTHORITY = 'cpan:TAPPER';
3 # ABSTRACT: Tapper::Benchmark - querying - backend base class
4 3 $Tapper::Benchmark::Query::common::VERSION = '5.0.0';
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use base 'Tapper::Benchmark::Query';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use List::MoreUtils qw( any );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 my %h_used_selects;
12 3 my %h_default_columns = (
13 'NAME' => 'b.bench',
14 'UNIT' => 'bu.bench_unit',
15 'VALUE' => 'bv.bench_value',
16 'VALUE_ID' => 'bv.bench_value_id',
17 'CREATED' => 'bv.created_at',
18 );
19  
20 0 ▶sub _NOW { "CURRENT_TIMESTAMP" }
Subroutine _NOW: not called CC=1 SCAR=6.9
21  
22 0 ▶sub _FOR_UPDATE { "FOR UPDATE" }
Subroutine _FOR_UPDATE: not called CC=1 SCAR=6.9
23  
24 0 ▶sub default_columns {
Subroutine default_columns: not called CC=1 SCAR=6.9
Pod undocumented
25 0 return %h_default_columns;
26 }
27  
28 0 ▶sub benchmark_operators {
Subroutine benchmark_operators: not called CC=1 SCAR=6.9
Pod undocumented
29 0 return ( '=', '!=', 'like', 'not like', '<', '>', '<=', '>=' );
30 }
31  
32 0 ▶sub create_where_clause {
Subroutine create_where_clause: not called CC=11 SCAR=48.8
Pod undocumented
33  
34 0 my ( $or_self, $s_column_name, $ar_value ) = @_;
35  
36 0 my $s_where_clause = q##;
37 0 ▶ if ( $ar_value->[0] eq 'not like' ) {
Branch: 5 branches
BranchTrueFalseTotal
if ($ar_value->[0] eq 'not like') { } 0 0 0
elsif ($ar_value->[0] eq 'like') { } 0 0 0
elsif ($ar_value->[0] eq '<' or $ar_value->[0] eq '>' or $ar_value->[0] eq '<=' or $ar_value->[0] eq '>=') { } 0 0 0
elsif ($ar_value->[0] eq '=') { } 0 0 0
elsif ($ar_value->[0] eq '!=') { } 0 0 0
38 0 $s_where_clause = "$s_column_name NOT LIKE ?";
39 }
40 elsif ( $ar_value->[0] eq 'like' ) {
41 0 $s_where_clause = "$s_column_name LIKE ?";
42 }
43 ▶ elsif (
Condition0%0/9
$ar_value->[0] eq "<" or $ar_value->[0] eq ">" or $ar_value->[0] eq "<=" or $ar_value->[0] eq ">="
l!l&&r!l&&!r
000
$ar_value->[0] eq "<" or $ar_value->[0] eq ">" or $ar_value->[0] eq "<="
l!l&&r!l&&!r
000
$ar_value->[0] eq "<" or $ar_value->[0] eq ">"
l!l&&r!l&&!r
000
MC/DC0%0/4
$ar_value->[0] eq "<" or $ar_value->[0] eq ">" or $ar_value->[0] eq "<=" or $ar_value->[0] eq ">="
$ar_value->[0] eq "<" $ar_value->[0] eq ">" $ar_value->[0] eq "<=" $ar_value->[0] eq ">="
Truth table0%0/5
A or B or C or D
A= $ar_value->[0] eq "<"B= $ar_value->[0] eq ">"C= $ar_value->[0] eq "<="D= $ar_value->[0] eq ">="
ABCDresult
1XXX1
01XX1
001X1
00011
00000
44 $ar_value->[0] eq '<'
45 || $ar_value->[0] eq '>'
46 || $ar_value->[0] eq '<='
47 || $ar_value->[0] eq '>='
48 ) {
49 0 $s_where_clause = "$s_column_name $ar_value->[0] ?";
50 }
51 elsif ( $ar_value->[0] eq '=' ) {
52 0 ▶ if ( $#{$ar_value} > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$ar_value;} > 1) { } 0 0 0
53 0 $s_where_clause = "$s_column_name IN (" . (join ',', map {'?'} 2..@{$ar_value}) . ')';
54 }
55 else {
56 0 $s_where_clause = "$s_column_name = ?";
57 }
58 }
59 elsif ( $ar_value->[0] eq '!=' ) {
60 0 ▶ if ( $#{$ar_value} > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$ar_value;} > 1) { } 0 0 0
61 0 $s_where_clause = "$s_column_name NOT IN (" . (join ',', map {'?'} 2..@{$ar_value}) . ')';
62 }
63 else {
64 0 $s_where_clause = "$s_column_name != ?";
65 }
66 }
67 else {
68 0 require Carp;
69 0 Carp::confess("unknown operator '$ar_value->[0]'");
70 0 return;
71 }
72  
73 0 return $s_where_clause;
74  
75 }
76  
77 0 ▶sub create_period_check {
Subroutine create_period_check: not called CC=7 SCAR=40.3
Pod undocumented
78  
79 0 my ( $or_self, $s_column, $dt_from, $dt_to ) = @_;
80  
81 0 my @a_vals;
82 my $s_where;
83 0 ▶ if ( $dt_from ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dt_from) 0 0 0
84 0 ▶ if ( my ( $s_date, $s_time ) = $dt_from =~ /(\d{4}-\d{2}-\d{2})( \d{2}:\d{2}:\d{2})?/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $dt_from =~ /(\d{4}-\d{2}-\d{2})( \d{2}:\d{2}:\d{2})?/) { } 0 0 0
85 0 $s_where .= "\nAND $s_column > ?";
86 0 ▶ push @a_vals, $s_date . ( $s_time || ' 00:00:00' );
Condition0%0/2
$s_time || ' 00:00:00'
l!l
00
MC/DC0%0/1
$s_time || ' 00:00:00'
$s_time
Truth table0%0/2
A
A= $s_time
Aresult
11
00
87 }
88 else {
89 0 require Carp;
90 0 Carp::confess(q#unknown date format for 'date_from'#);
91 0 return;
92 }
93 }
94 0 ▶ if ( $dt_to ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dt_to) 0 0 0
95 0 ▶ if ( my ( $s_date, $s_time ) = $dt_to =~ /(\d{4}-\d{2}-\d{2})( \d{2}:\d{2}:\d{2})?/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $dt_to =~ /(\d{4}-\d{2}-\d{2})( \d{2}:\d{2}:\d{2})?/) { } 0 0 0
96 0 $s_where .= "\nAND $s_column < ?";
97 0 ▶ push @a_vals, $s_date . ( $s_time || ' 23:59:59' );
Condition0%0/2
$s_time || ' 23:59:59'
l!l
00
MC/DC0%0/1
$s_time || ' 23:59:59'
$s_time
Truth table0%0/2
A
A= $s_time
Aresult
11
00
98 }
99 else {
100 0 require Carp;
101 0 Carp::confess(q#unknown date format for 'date_to'#);
102 0 return;
103 }
104 }
105  
106 return {
107 0 vals => \@a_vals,
108 where => $s_where,
109 };
110  
111 }
112  
113 0 ▶sub select_benchmark_point_essentials {
Subroutine select_benchmark_point_essentials: not called CC=1 SCAR=6.9
Pod undocumented
114  
115 0 my ( $or_self, @a_vals ) = @_;
116  
117 0 return $or_self->execute_query( "
118 SELECT
119 b.bench,
120 bv.bench_value,
121 bu.bench_unit
122 FROM
123 $or_self->{config}{tables}{benchmark_table} b
124 JOIN
125 $or_self->{config}{tables}{benchmark_value_table} bv
126 ON
127 b.bench_id = bv.bench_id
128 LEFT JOIN
129 $or_self->{config}{tables}{unit_table} bu
130 ON
131 b.bench_unit_id = bu.bench_unit_id
132 WHERE
133 bv.bench_value_id = ?
134 ;
135 ", @a_vals );
136  
137 }
138  
139 0 ▶sub select_complete_benchmark_point {
Subroutine select_complete_benchmark_point: not called CC=1 SCAR=6.9
Pod undocumented
140  
141 0 my ( $or_self, @a_vals ) = @_;
142  
143 0 my $query = "
144 SELECT
145 bat.bench_additional_type,
146 bav.bench_additional_value
147 FROM
148 benchs b
149 JOIN
150 bench_values bv
151 ON
152 b.bench_id = bv.bench_id
153 JOIN
154 bench_additional_type_relations batr
155 ON
156 bv.bench_id = batr.bench_id
157 JOIN
158 bench_additional_types bat
159 ON
160 batr.bench_additional_type_id = bat.bench_additional_type_id
161 JOIN
162 bench_additional_relations bar
163 ON
164 bv.bench_value_id = bar.bench_value_id
165 JOIN
166 bench_additional_values bav
167 ON
168 bar.bench_additional_value_id = bav.bench_additional_value_id AND
169 bat.bench_additional_type_id = bav.bench_additional_type_id
170 WHERE
171 bv.bench_value_id = ?
172 ORDER BY
173 bat.bench_additional_type";
174 0 return $or_self->execute_query( $query, @a_vals );
175 }
176  
177 0 ▶sub select_addtype_by_name {
Subroutine select_addtype_by_name: not called CC=1 SCAR=6.9
Pod undocumented
178  
179 0 my ( $or_self, @a_vals ) = @_;
180  
181 0 return $or_self->execute_query( "
182 SELECT bench_additional_type_id
183 FROM $or_self->{config}{tables}{additional_type_table}
184 WHERE bench_additional_type = ?
185 ", @a_vals );
186  
187 }
188  
189 0 ▶sub select_min_subsume_type {
Subroutine select_min_subsume_type: not called CC=1 SCAR=6.9
Pod undocumented
190  
191 0 my ( $or_self, @a_vals ) = @_;
192  
193 0 return $or_self->execute_query( "
194 SELECT bench_subsume_type_id
195 FROM $or_self->{config}{tables}{subsume_type_table}
196 ORDER BY bench_subsume_type_rank ASC
197 LIMIT 1
198 " );
199  
200 }
201  
202 0 ▶sub select_subsume_type {
Subroutine select_subsume_type: not called CC=1 SCAR=6.9
Pod undocumented
203  
204 0 my ( $or_self, @a_vals ) = @_;
205  
206 0 return $or_self->execute_query( "
207 SELECT
208 bench_subsume_type_id,
209 bench_subsume_type_rank,
210 datetime_strftime_pattern
211 FROM
212 $or_self->{config}{tables}{subsume_type_table}
213 WHERE
214 bench_subsume_type = ?
215 ", @a_vals );
216  
217 }
218  
219 0 ▶sub select_check_subsumed_values {
Subroutine select_check_subsumed_values: not called CC=2 SCAR=17.9
Pod undocumented
220  
221 0 my ( $or_self, $hr_vals ) = @_;
222  
223 0 ▶ if (! $hr_vals->{subsume_type_id} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_vals->{"subsume_type_id"}) 0 0 0
224 0 require Carp;
225 0 Carp::confess(q#required parameter 'subsume_type_id' is missing#);
226 0 return;
227 }
228  
229 my $hr_period_check = $or_self->create_period_check(
230 'bv.created_at', $hr_vals->{date_from}, $hr_vals->{date_to}
231 0 );
232  
233 return $or_self->execute_query(
234 "
235 SELECT
236 bv.bench_value_id
237 FROM
238 bench_values bv
239 JOIN bench_subsume_types bet
240 ON ( bv.bench_subsume_type_id = bet.bench_subsume_type_id )
241 WHERE
242 bet.bench_subsume_type_rank > (
243 SELECT beti.bench_subsume_type_rank
244 FROM bench_subsume_types beti
245 WHERE bench_subsume_type_id = ?
246 )
247 $hr_period_check->{where}
248 LIMIT
249 1
250 ",
251 $hr_vals->{subsume_type_id},
252 0 @{$hr_period_check->{vals}},
253 );
254  
255 }
256  
257 0 ▶sub select_data_values_for_subsume {
Subroutine select_data_values_for_subsume: not called CC=3 SCAR=24.8
Pod undocumented
258  
259 0 my ( $or_self, $hr_vals ) = @_;
260  
261 my $hr_period_check = $or_self->create_period_check(
262 'bv.created_at', $hr_vals->{date_from}, $hr_vals->{date_to}
263 0 );
264  
265 0 my @a_addexclude_vals;
266 0 my $s_addexclude_where = q##;
267 0 ▶ if ( $hr_vals->{exclude_additionals} && @{$hr_vals->{exclude_additionals}} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hr_vals->{"exclude_additionals"} and @{$hr_vals->{"exclude_additionals"};}) 0 0 0
Condition0%0/3
$hr_vals->{"exclude_additionals"} and @{$hr_vals->{"exclude_additionals"};}
!ll&&!rl&&r
000
MC/DC0%0/2
$hr_vals->{"exclude_additionals"} and @{$hr_vals->{"exclude_additionals"};}
$hr_vals->{"exclude_additionals"} @{$hr_vals->{"exclude_additionals"};}
Truth table0%0/3
A and B
A= $hr_vals->{"exclude_additionals"}B= @{$hr_vals->{"exclude_additionals"};}
ABresult
0X0
100
111
268 0 $s_addexclude_where = 'AND bav.bench_additional_type_id NOT IN (' . (join ',', map {'?'} @{$hr_vals->{exclude_additionals}}) . ')';
269 0 push @a_addexclude_vals, @{$hr_vals->{exclude_additionals}};
270 }
271  
272 return $or_self->execute_query(
273 "
274 SELECT
275 b.bench_id,
276 bv.bench_value_id,
277 bv.created_at,
278 bv.bench_value,
279 bet.bench_subsume_type_rank,
280 GROUP_CONCAT(
281 bav.bench_additional_type_id,
282 '|',
283 bav.bench_additional_value_id
284 ORDER BY
285 bav.bench_additional_type_id,
286 bav.bench_additional_value_id
287 SEPARATOR
288 '-'
289 ) AS additionals
290 FROM
291 benchs b
292 JOIN bench_values bv
293 ON ( bv.bench_id = b.bench_id )
294 JOIN bench_subsume_types bet
295 ON ( bet.bench_subsume_type_id = bv.bench_subsume_type_id )
296 LEFT JOIN (
297 bench_additional_relations bar
298 JOIN bench_additional_values bav
299 ON ( bav.bench_additional_value_id = bar.bench_additional_value_id )
300 )
301 ON (
302 bar.active = 1
303 AND bar.bench_value_id = bv.bench_value_id
304 $s_addexclude_where
305 )
306 WHERE
307 b.active = 1
308 AND bv.active = 1
309 $hr_period_check->{where}
310 GROUP BY
311 bet.bench_subsume_type_rank,
312 b.bench_id,
313 bv.created_at,
314 bv.bench_value,
315 bv.bench_value_id
316 ORDER BY
317 b.bench_id,
318 additionals,
319 bv.created_at
320 ",
321 @a_addexclude_vals,
322 0 @{$hr_period_check->{vals}},
323 );
324 }
325  
326 0 ▶sub select_benchmark {
Subroutine select_benchmark: not called CC=1 SCAR=6.9
Pod undocumented
327  
328 0 my ( $or_self, @a_vals ) = @_;
329  
330 0 return $or_self->execute_query( "
331 SELECT bench_id
332 FROM $or_self->{config}{tables}{benchmark_table}
333 WHERE bench = ?
334 ", @a_vals );
335  
336 }
337  
338 0 ▶sub select_benchmark_names {
Subroutine select_benchmark_names: not called CC=2 SCAR=17.9
Pod undocumented
339  
340 0 my ( $or_self, @a_vals ) = @_;
341  
342 0 my $query = "
343 SELECT DISTINCT bench
344 FROM $or_self->{config}{tables}{benchmark_table}";
345 0 ▶ $query .= "
Branch: 1 branch
BranchTrueFalseTotal
if @a_vals 0 0 0
346 WHERE bench LIKE ? " if @a_vals;
347 0 return $or_self->execute_query( $query, @a_vals );
348  
349 }
350  
351 0 ▶sub select_unit {
Subroutine select_unit: not called CC=1 SCAR=6.9
Pod undocumented
352  
353 0 my ( $or_self, @a_vals ) = @_;
354  
355 0 return $or_self->execute_query( "
356 SELECT bench_unit_id
357 FROM $or_self->{config}{tables}{unit_table}
358 WHERE bench_unit = ?
359 ", @a_vals );
360  
361 }
362  
363 0 ▶sub select_addtype {
Subroutine select_addtype: not called CC=1 SCAR=6.9
Pod undocumented
364  
365 0 my ( $or_self, @a_vals ) = @_;
366  
367 0 return $or_self->execute_query( "
368 SELECT bench_additional_type_id
369 FROM $or_self->{config}{tables}{additional_type_table}
370 WHERE bench_additional_type = ?
371 ", @a_vals );
372  
373 }
374  
375 0 ▶sub select_addvalue {
Subroutine select_addvalue: not called CC=1 SCAR=6.9
Pod undocumented
376  
377 0 my ( $or_self, @a_vals ) = @_;
378  
379 0 return $or_self->execute_query( "
380 SELECT bench_additional_value_id
381 FROM $or_self->{config}{tables}{additional_value_table}
382 WHERE bench_additional_type_id = ? AND bench_additional_value = ?
383 ", @a_vals );
384  
385 }
386  
387 0 ▶sub select_addtyperelation {
Subroutine select_addtyperelation: not called CC=1 SCAR=6.9
Pod undocumented
388  
389 0 my ( $or_self, @a_vals ) = @_;
390  
391 0 return $or_self->execute_query( "
392 SELECT bench_id, bench_additional_type_id, created_at
393 FROM $or_self->{config}{tables}{additional_type_relation_table}
394 WHERE bench_id = ? AND bench_additional_type_id = ?
395 ", @a_vals );
396  
397 }
398  
399 0 ▶sub insert_raw_bench_bundle {
Subroutine insert_raw_bench_bundle: not called CC=1 SCAR=6.9
Pod undocumented
400  
401 0 my ( $or_self, @a_vals ) = @_;
402  
403 0 return $or_self->execute_query( "
404 INSERT INTO raw_bench_bundles
405 (raw_bench_bundle_serialized)
406 VALUES ( ? )
407 ", @a_vals );
408  
409 }
410  
411 0 ▶sub copy_benchmark_backup_value {
Subroutine copy_benchmark_backup_value: not called CC=3 SCAR=24.8
Pod undocumented
412  
413 0 my ( $or_self, $hr_vals ) = @_;
414  
415 0 for my $s_param (qw/ new_bench_value_id old_bench_value_id /) {
416 0 ▶ if (! $hr_vals->{$s_param} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_vals->{$s_param}) 0 0 0
417 0 require Carp;
418 0 Carp::confess("missing parameter '$s_param'");
419 0 return;
420 }
421 }
422  
423 return $or_self->execute_query( "
424 INSERT INTO $or_self->{config}{tables}{benchmark_backup_value_table}
425 ( bench_value_id, bench_id, bench_subsume_type_id, bench_value, active, created_at )
426 SELECT
427 ?, bench_id, bench_subsume_type_id, bench_value, active, created_at
428 FROM
429 $or_self->{config}{tables}{benchmark_value_table}
430 WHERE
431 bench_value_id = ?
432 0 ", @{$hr_vals}{qw/ new_bench_value_id old_bench_value_id /} );
433  
434 }
435  
436 0 ▶sub copy_benchmark_backup_additional_relations {
Subroutine copy_benchmark_backup_additional_relations: not called CC=3 SCAR=24.8
Pod undocumented
437  
438 0 my ( $or_self, $hr_vals ) = @_;
439  
440 0 for my $s_param (qw/ new_bench_value_id old_bench_value_id /) {
441 0 ▶ if (! $hr_vals->{$s_param} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_vals->{$s_param}) 0 0 0
442 0 require Carp;
443 0 Carp::confess("missing parameter '$s_param'");
444 0 return;
445 }
446 }
447  
448 return $or_self->execute_query( "
449 INSERT INTO $or_self->{config}{tables}{backup_additional_relation_table}
450 ( bench_backup_value_id, bench_additional_value_id, active, created_at )
451 SELECT
452 ?, bench_additional_value_id, active, created_at
453 FROM
454 $or_self->{config}{tables}{additional_relation_table}
455 WHERE
456 bench_value_id = ?
457 0 ", @{$hr_vals}{qw/ new_bench_value_id old_bench_value_id /} );
458  
459 }
460  
461 0 ▶sub update_benchmark_backup_value {
Subroutine update_benchmark_backup_value: not called CC=1 SCAR=6.9
Pod undocumented
462  
463 0 my ( $or_self, $hr_vals ) = @_;
464  
465 return $or_self->execute_query( "
466 UPDATE $or_self->{config}{tables}{benchmark_backup_value_table}
467 SET bench_value_id = ?
468 WHERE bench_value_id = ?
469 0 ", @{$hr_vals}{qw/
470 new_bench_value_id
471 old_bench_value_id
472 /} );
473  
474 }
475  
476 0 ▶sub start_processing_raw_bench_bundle {
Subroutine start_processing_raw_bench_bundle: not called CC=1 SCAR=6.9
Pod undocumented
477  
478 0 my ( $or_self, @a_vals ) = @_;
479  
480 0 return $or_self->execute_query( "
481 UPDATE raw_bench_bundles
482 SET processing = 1
483 WHERE raw_bench_bundle_id = ?
484 ", @a_vals );
485  
486 }
487  
488 0 ▶sub update_raw_bench_bundle_set_processed {
Subroutine update_raw_bench_bundle_set_processed: not called CC=1 SCAR=6.9
Pod undocumented
489  
490 0 my ( $or_self, @a_vals ) = @_;
491  
492 0 return $or_self->execute_query( "
493 UPDATE raw_bench_bundles
494 SET processed=1,
495 processing=0
496 WHERE raw_bench_bundle_id = ?
497 ", @a_vals );
498  
499 }
500  
501 0 ▶sub delete_benchmark_additional_relations {
Subroutine delete_benchmark_additional_relations: not called CC=1 SCAR=6.9
Pod undocumented
502  
503 0 my ( $or_self, @a_vals ) = @_;
504  
505 0 return $or_self->execute_query( "
506 DELETE FROM $or_self->{config}{tables}{additional_relation_table}
507 WHERE bench_value_id = ?
508 ", @a_vals );
509  
510 }
511  
512 0 ▶sub delete_benchmark_value {
Subroutine delete_benchmark_value: not called CC=1 SCAR=6.9
Pod undocumented
513  
514 0 my ( $or_self, @a_vals ) = @_;
515  
516 0 return $or_self->execute_query( "
517 DELETE FROM $or_self->{config}{tables}{benchmark_value_table}
518 WHERE bench_value_id = ?
519 ", @a_vals );
520  
521 }
522  
523 # Garbage Collection
524 0 ▶sub delete_processed_raw_bench_bundles {
Subroutine delete_processed_raw_bench_bundles: not called CC=1 SCAR=6.9
Pod undocumented
525  
526 0 my ( $or_self, @a_vals ) = @_;
527  
528 0 return $or_self->execute_query( "
529 DELETE FROM raw_bench_bundles
530 WHERE processed=1 AND
531 processing=0
532 ", @a_vals );
533  
534 }
535  
536 0 ▶sub copy_additional_values {
Subroutine copy_additional_values: not called CC=3 SCAR=24.8
Pod undocumented
537  
538 0 my ( $or_self, $hr_vals ) = @_;
539  
540 0 for my $s_param (qw/ new_bench_value_id old_bench_value_id /) {
541 0 ▶ if (! $hr_vals->{$s_param} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hr_vals->{$s_param}) 0 0 0
542 0 require Carp;
543 0 Carp::confess("missing parameter '$s_param'");
544 0 return;
545 }
546 }
547  
548 return $or_self->execute_query( "
549 INSERT INTO $or_self->{config}{tables}{additional_relation_table}
550 ( bench_value_id, bench_additional_value_id, active, created_at )
551 SELECT
552 0 ?, bench_additional_value_id, 1, @{[$or_self->_NOW]}
553 FROM
554 $or_self->{config}{tables}{additional_relation_table}
555 WHERE
556 bench_value_id = ?
557 0 ", @{$hr_vals}{qw/ new_bench_value_id old_bench_value_id /} );
558  
559 }
560  
561 0 ▶sub select_raw_bench_bundle_for_lock {
Subroutine select_raw_bench_bundle_for_lock: not called CC=1 SCAR=6.9
Pod undocumented
562  
563 0 my ( $or_self, @a_vals ) = @_;
564  
565 0 return $or_self->execute_query( "
566 SELECT raw_bench_bundle_id
567 FROM raw_bench_bundles
568 WHERE processed=0 AND
569 processing=0
570 ORDER BY raw_bench_bundle_id ASC
571 LIMIT 1
572 0 @{[$or_self->_FOR_UPDATE]}
573 ", @a_vals );
574 }
575  
576 0 ▶sub select_raw_bench_bundle_for_processing {
Subroutine select_raw_bench_bundle_for_processing: not called CC=1 SCAR=6.9
Pod undocumented
577  
578 0 my ( $or_self, @a_vals ) = @_;
579  
580 0 return $or_self->execute_query( "
581 SELECT raw_bench_bundle_serialized
582 FROM raw_bench_bundles
583 WHERE raw_bench_bundle_id = ?
584 LIMIT 1
585 0 @{[$or_self->_FOR_UPDATE]}
586 ", @a_vals );
587 }
588  
589 3 1;
590  
591 __END__
« Benchmark.pm ↑ Summary Benchmark/Query.pm »