MSSQL/Util.pm

filter: Statementstmt 100% 132 / 132 Branchbran 88.8% 48 / 54 Conditioncond 85.7% 48 / 56 MC/DCmcdc 73.3% 22 / 30 Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 92.2% 261 / 283 CC 52 SCAR 25.8
CC
52
Cov
94%
_mask_by_number
23.1
_mask_by_number_in_characters
11.1
mask_error_details
9.0
CRAP 13.2
« MSSQL/Diff/PrimaryKey.pm ↑ Summary MSSQL/Storage/ODBC.pm »
1 package DBIO::MSSQL::Util;
2 # ABSTRACT: Shared MSSQL-specific helper functions for DBIO
3  
4 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 26 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 26 our $VERSION = '0.900007';
8  
9 26 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 26 our @EXPORT_OK = qw(mask_error_details);
12  
13 # What stands in for a value in an error text.
14 26 my $MASK = '***';
15  
16 # The shortest bound value that is looked for verbatim in an error text. A
17 # shorter one is a letter or a number, which is part of any text; the server's
18 # sentences that quote a value are known below and catch those.
19 26 my $MIN_BOUND_LENGTH = 4;
20  
21 # A value in single quotes, an apostrophe inside written twice. Possessive, so
22 # a text without the closing quote costs one pass and no backtracking.
23 26 my $QUOTED = qr/'(?:[^']++|'')*+'/;
24  
25 # What stands for the text of a message whose value cannot be told from its
26 # words (see _mask_by_number).
27 26 my $WITHHELD = '(text withheld: the server may quote a value in it)';
28  
29 # The server's message numbers whose text quotes a value, and how. The numbers
30 # do not depend on the language the session reports in; the words around the
31 # value do.
32 26 my %QUOTED_VALUE = map { $_ => 1 } (
33 244, 248, # The conversion of the varchar value 'x' overflowed ...
34 245, # Conversion failed when converting the varchar value 'x' ...
35 102, # Incorrect syntax near 'x' (the keyword form is 156)
36 13607, 13609, # JSON path / text: Unexpected character 'g' ...
37 );
38 26 my %PAREN_VALUE = map { $_ => 1 } (2627, 2601, 1505); # The duplicate key value is (x).
39 26 my %TRUNCATED = (2628 => 1); # ... column 's'. Truncated value: 'x'.
40  
41 # The ODBC SQLSTATE of the forms, where the driver gave no server number.
42 26 my %STATE_NUMBER = ('22018' => 245, 'HY019' => 248, '23000' => 2627);
43  
44 # Pairs of quote marks the server's translations use: ' ' " " << >> and the
45 # typographic ones of de, cs, hu, pl, zh ...
46 26 my %CLOSER = (
47 "'" => qr/['\x{2019}]/,
48 '"' => qr/"/,
49 "\x{AB}" => qr/\x{BB}/,
50 "\x{201E}" => qr/["\x{201C}\x{201D}]/,
51 "\x{201C}" => qr/\x{201D}/,
52 "\x{201D}" => qr/\x{201D}/,
53 "\x{2018}" => qr/\x{2019}/,
54 );
55 26 my $OPENER = qr/(?<![A-Za-z])(['"\x{AB}\x{201E}\x{201C}\x{201D}\x{2018}])/;
56  
57 # The server's messages that carry their own English text are the business of
58 # _mask_sentences, which also knows the cut ones.
59 26 my $ENGLISH = qr/Conversion failed when converting the|The conversion of the \w+ value|Incorrect syntax near|The duplicate key value is|Truncated value:|JSON (?:text|path) is not properly formatted/;
60  
61 # Texts of a message that the Sybase class of this driver builds itself.
62 26 my $GUARD = 'DBIO::MSSQL TEXTSIZE guard: column';
63  
64 # Some text -> the same with the value of one quoted group masked, or undef:
65 # the group is the first quoted one up to the last closing mark of its kind
66 # (the words after the value hold no quote mark, an apostrophe inside the
67 # value is no problem); a message cut by the server has no closing mark and
68 # is masked to its end.
69 76 ▶sub _mask_quoted {
Subroutine _mask_quoted: called CC=6 SCAR=17.9
70 76 my ($body) = @_;
71 76 ▶ return undef unless $body =~ $OPENER;
Branch: 1 branch
BranchTrueFalseTotal
unless $body =~ /$OPENER/ 9 67 76
72 67 my ($open, $at) = ($1, $-[1]);
73 67 my $closer = $CLOSER{$open};
74 67 my $end = length $body;
75 67 ▶ if (length $body < 1500) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $body < 1500) 65 2 67
76 65 my $last;
77 65 ▶ while ($body =~ /$closer/g) { $last = $-[0] if $-[0] > $at }
Branch: 2 branches
BranchTrueFalseTotal
if ($body =~ /$closer/g) 116 65 181
if $-[0] > $at 69 47 116
78 65 ▶ $end = $last if defined $last;
Branch: 1 branch
BranchTrueFalseTotal
if defined $last 65 0 65
79 }
80 67 return substr($body, 0, $at + 1) . $MASK . substr($body, $end);
81 }
82  
83 # (x) in the message: from the first parenthesis to the last one.
84 26 ▶sub _mask_paren {
Subroutine _mask_paren: called CC=4 SCAR=14.0
85 26 my ($body) = @_;
86 26 my $at = index $body, '(';
87 26 ▶ return undef if $at < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $at < 0 0 26 26
88 26 my $last = rindex $body, ')';
89 26 ▶ $last = length $body if $last < $at || length $body >= 1500;
Branch: 1 branch
BranchTrueFalseTotal
if $last < $at or length $body >= 1500 1 25 26
Condition66%2/3
$last < $at or length $body >= 1500
l!l&&r!l&&!r
1025
MC/DC50%1/2
$last < $at or length $body >= 1500
$last < $at length $body >= 1500
Truth table66%2/3
A or B
A= $last < $atB= length $body >= 1500
ABresult
1X1
011
000
90 26 return substr($body, 0, $at + 1) . $MASK . substr($body, $last);
91 }
92  
93 # The names of table and column come first, quoted; what follows them is the
94 # value, in whatever words.
95 14 ▶sub _mask_truncated {
Subroutine _mask_truncated: called CC=4 SCAR=13.9
96 14 my ($body) = @_;
97 14 my ($names, $upto) = (0, 0);
98 14 ▶ while ($names < 2 && $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($names < 2 and $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g) 24 14 38
Condition100%3/3
$names < 2 and $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g
!ll&&!rl&&r
12224
MC/DC100%2/2
$names < 2 and $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g
$names < 2 $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g
Truth table100%3/3
A and B
A= $names < 2B= $body =~ /$OPENER([^'"\x{AB}\x{BB}\x{201E}\x{201C}\x{201D}\x{2018}\x{2019}]*)(['"\x{BB}\x{201C}\x{201D}\x{2019}])/g
ABresult
0X0
100
111
99 24 $names++;
100 24 $upto = pos $body;
101 }
102 14 ▶ return undef unless $names == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless $names == 2 2 12 14
103 12 return substr($body, 0, $upto) . " $MASK";
104 }
105  
106 # Masks the values in the messages of any language, by the number the server
107 # gave the message: DBD::Sybase puts "Server message number=N" in front of
108 # the text; DBD::ODBC gives no number in the text, so the storage hands the
109 # numbers the driver reported ($diag: [ [ number, text ], ... ]), and the
110 # SQLSTATE behind the text is the fallback. A message of such a number is
111 # masked at the marks the server quotes with, or -- when no mark is there to
112 # take hold of -- loses its text. A message that carries English words of
113 # its own is left to _mask_sentences.
114 561 ▶sub _mask_by_number {
Subroutine _mask_by_number: called CC=23 SCAR=31.4
115 561 my ($text, $diag) = @_;
116  
117 561 my @marks;
118 561 ▶ while ($text =~ /(?:Server message number=(\d+)\b[^\n]*?\btext=|(?:\[[^\]\n]+\])*\[SQL Server\])/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ /(?:Server message number=(\d+)\b[^\n]*?\btext=|(?:\[[^\]\n]+\])*\[SQL Server\])/g) 597 561 1158
119 597 push @marks, [ $-[0], $+[0], $1 ];
120 }
121 561 ▶ return $text unless @marks;
Branch: 1 branch
BranchTrueFalseTotal
unless @marks 124 437 561
122  
123 437 my $out = substr $text, 0, $marks[0][0];
124 437 for my $i (0 .. $#marks) {
125 597 my ($from, $to, $number) = @{ $marks[$i] };
126 597 ▶ my $next = $i < $#marks ? $marks[$i + 1][0] : length $text;
Branch: 1 branch
BranchTrueFalseTotal
$i < $#marks ? : 160 437 597
127 597 my $body = substr $text, $to, $next - $to;
128 597 $out .= substr $text, $from, $to - $from;
129  
130 597 my ($core, $tail, $state) = ($body, '', undef);
131 597 ▶ if (not defined $number
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $number and $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s) 296 301 597
Condition66%2/3
not defined $number and $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s
!ll&&!rl&&r
3010296
MC/DC50%1/2
not defined $number and $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s
not defined $number $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s
Truth table66%2/3
not(A) and B
A= not defined $numberB= $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s
ABresult
0X0
100
111
132 and $body =~ /\A(.*)(\s*\(SQL-(\w{5})\)(?:(?!\(SQL-\w{5}\)).)*)\z/s) {
133 296 ($core, $tail, $state) = ($1, $2, $3);
134 }
135  
136 597 my $cmp = $core;
137 597 $cmp =~ s/\s+\z//;
138 597 ▶ if (not defined $number) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $number) 296 301 597
139 296 ▶ for my $d (@{ $diag // [] }) {
Condition50%1/2
$diag // []
l!l
2960
MC/DC0%0/1
$diag // []
$diag
Truth table50%1/2
A
A= $diag
Aresult
11
00
140 45 (my $dt = $d->[1]) =~ s/\A(?:\[[^\]\n]+\])*\[SQL Server\]//;
141 45 $dt =~ s/\s+\z//;
142 45 ▶ if ($dt eq $cmp) { $number = $d->[0]; last }
Branch: 1 branch
BranchTrueFalseTotal
if ($dt eq $cmp) 45 0 45
143 }
144 }
145 597 ▶ $number = $STATE_NUMBER{$state} if not defined $number and defined $state;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $number and defined $state 251 346 597
Condition66%2/3
not defined $number and defined $state
!ll&&!rl&&r
3460251
MC/DC50%1/2
not defined $number and defined $state
not defined $number defined $state
Truth table66%2/3
not(A) and B
A= not defined $numberB= defined $state
ABresult
0X0
100
111
146  
147 597 ▶ if (defined $number
Branch: 1 branch
BranchTrueFalseTotal
if (defined $number and $QUOTED_VALUE{$number} || $PAREN_VALUE{$number} || $TRUNCATED{$number} and not $core =~ /$ENGLISH/ and index($core, $GUARD) == -1) 116 481 597
Condition100%15/15
defined $number and $QUOTED_VALUE{$number} || $PAREN_VALUE{$number} || $TRUNCATED{$number} and not $core =~ /$ENGLISH/ and index($core, $GUARD) == -1
!ll&&!rl&&r
4801116
defined $number and $QUOTED_VALUE{$number} || $PAREN_VALUE{$number} || $TRUNCATED{$number} and not $core =~ /$ENGLISH/
!ll&&!rl&&r
223257117
defined $number and $QUOTED_VALUE{$number} || $PAREN_VALUE{$number} || $TRUNCATED{$number}
!ll&&!rl&&r
109114374
$QUOTED_VALUE{$number} or $PAREN_VALUE{$number} or $TRUNCATED{$number}
l!l&&r!l&&!r
36014114
$QUOTED_VALUE{$number} or $PAREN_VALUE{$number}
l!l&&r!l&&!r
33426128
MC/DC100%6/6
defined $number and $QUOTED_VALUE{$number} || $PAREN_VALUE{$number} || $TRUNCATED{$number} and not $core =~ /$ENGLISH/ and index($core, $GUARD) == -1
defined $number $QUOTED_VALUE{$number} $PAREN_VALUE{$number} $TRUNCATED{$number} not $core =~ /$ENGLISH/ index($core, $GUARD) == -1
Truth table63%7/11
A and B or C or D and not(E) and F
A= defined $numberB= $QUOTED_VALUE{$number}C= $PAREN_VALUE{$number}D= $TRUNCATED{$number}E= not $core =~ /$ENGLISH/F= index($core, $GUARD) == -1
ABCDEFresult
0XXXXX0
1000XX0
11XX0X0
101X0X0
10010X0
11XX100
101X100
1001100
11XX111
101X111
1001111
148 and ($QUOTED_VALUE{$number} or $PAREN_VALUE{$number} or $TRUNCATED{$number})
149 and $core !~ $ENGLISH and index($core, $GUARD) < 0) {
150 my $masked = $QUOTED_VALUE{$number} ? _mask_quoted($core)
151 116 ▶ : $PAREN_VALUE{$number} ? _mask_paren($core)
Branch: 2 branches
BranchTrueFalseTotal
$QUOTED_VALUE{$number} ? : 76 40 116
$PAREN_VALUE{$number} ? : 26 14 40
152 : _mask_truncated($core);
153 # the blank before the text, if there was one, stays
154 116 ▶ if (defined $masked) { $core = $masked }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $masked) { } 105 11 116
155 else {
156 11 my ($lead) = $core =~ /\A(\s*)/;
157 11 ▶ $core = "$lead$WITHHELD" . ($core =~ /(\s*)\z/ ? $1 : '');
Branch: 1 branch
BranchTrueFalseTotal
$core =~ /(\s*)\z/ ? : 11 0 11
158 }
159 }
160 597 $out .= $core . $tail;
161 }
162 437 return $out;
163 }
164  
165 # The DBDs hand the text over as the bytes of its UTF-8 form or as characters;
166 # the marks of the translations are characters.
167 561 ▶sub _mask_by_number_in_characters {
Subroutine _mask_by_number_in_characters: called CC=11 SCAR=24.1
168 561 my ($text, $diag) = @_;
169  
170 561 my $bytes = 0;
171 561 ▶ if (not utf8::is_utf8($text) and $text =~ /[^\x00-\x7F]/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not utf8::is_utf8($text) and $text =~ /[^\x00-\x7F]/) 18 543 561
Condition100%3/3
not utf8::is_utf8($text) and $text =~ /[^\x00-\x7F]/
!ll&&!rl&&r
7846518
MC/DC100%2/2
not utf8::is_utf8($text) and $text =~ /[^\x00-\x7F]/
not utf8::is_utf8($text) $text =~ /[^\x00-\x7F]/
Truth table100%3/3
not(A) and B
A= not utf8::is_utf8($text)B= $text =~ /[^\x00-\x7F]/
ABresult
0X0
100
111
172 18 my $chars = $text;
173 18 ▶ if (utf8::decode($chars)) { $bytes = 1; $text = $chars }
Branch: 1 branch
BranchTrueFalseTotal
if (utf8::decode($chars)) 18 0 18
174 }
175  
176 my @diag = map {
177 45 my $t = $_->[1];
178 45 ▶ if (defined $t and not utf8::is_utf8($t) and $t =~ /[^\x00-\x7F]/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $t and not utf8::is_utf8($t) and $t =~ /[^\x00-\x7F]/) 18 27 45
Condition83%5/6
defined $t and not utf8::is_utf8($t) and $t =~ /[^\x00-\x7F]/
!ll&&!rl&&r
22518
defined $t and not utf8::is_utf8($t)
!ll&&!rl&&r
02223
MC/DC66%2/3
defined $t and not utf8::is_utf8($t) and $t =~ /[^\x00-\x7F]/
defined $t not utf8::is_utf8($t) $t =~ /[^\x00-\x7F]/
Truth table75%3/4
A and not(B) and C
A= defined $tB= not utf8::is_utf8($t)C= $t =~ /[^\x00-\x7F]/
ABCresult
0XX0
10X0
1100
1111
179 18 my $chars = $t;
180 18 ▶ $t = $chars if utf8::decode($chars);
Branch: 1 branch
BranchTrueFalseTotal
if utf8::decode($chars) 18 0 18
181 }
182 45 ▶ [ $_->[0], $t // '' ];
Condition50%1/2
$t // ""
l!l
450
MC/DC0%0/1
$t // ""
$t
Truth table50%1/2
A
A= $t
Aresult
11
00
183 561 ▶ } @{ $diag // [] };
Condition100%2/2
$diag // []
l!l
45516
MC/DC100%1/1
$diag // []
$diag
Truth table100%2/2
A
A= $diag
Aresult
11
00
184  
185 561 $text = _mask_by_number($text, \@diag);
186 561 ▶ utf8::encode($text) if $bytes;
Branch: 1 branch
BranchTrueFalseTotal
if $bytes 18 543 561
187 561 return $text;
188 }
189  
190  
191 # The sentences of the server that hold a value, one rule each. A rule keeps
192 # the words around the value -- the type, the table, the column, the
193 # constraint -- and replaces the value. The rules work on the text of a
194 # server message, so the frame the DBD puts around it (DBD::Sybase: "Server
195 # message number=245 ... text=", DBD::ODBC: "[FreeTDS][SQL Server]" before and
196 # "(SQL-22018)" after) and further messages after it do not matter. Every rule
197 # gives the same text again when it is applied to its own result.
198 561 ▶sub _mask_sentences {
Subroutine _mask_sentences: called CC=1 SCAR=0.0
199 561 my ($text) = @_;
200  
201 # Where a message ends: the end of the text, the "(SQL-nnnnn)" of DBD::ODBC,
202 # the next message.
203 561 my $END = qr/(?=\s*(?:\(SQL-\d+\)|Server message number=|\[FreeTDS\]|\z))/;
204  
205 # The server writes most values as they are, an apostrophe in them too
206 # (value 'a'b' to data type int; near 'it's'); only "Truncated value" doubles
207 # it. So the value is what stands between the opening quote and the words
208 # that close the sentence at the end of the message. A message is cut at about
209 # 2000 characters, so the value is looked for within that. The failing
210 # conversion of the TEXTSIZE guard of the Sybase class (its text names a
211 # column, no value) is left to that class.
212 561 $text =~ s/(\bConversion failed when converting the \w+ value )'(?!DBIO::MSSQL TEXTSIZE guard: column ).{0,2100}?'( to data type [\w ]+(?:\(\d+(?:\s*,\s*\d+)?\))?\.)$END/$1'$MASK'$2/gs;
213 561 $text =~ s/(\bThe conversion of the \w+ value )'.{0,2100}?'( overflowed an \w+ column\.(?: Use a larger integer column\.)?)$END/$1'$MASK'$2/gs;
214 561 $text =~ s/(\bIncorrect syntax near )'.{0,2100}?'(\.)$END/$1'$MASK'$2/gs;
215  
216 # Conversion failed when converting the varchar value 'x' to data type int.
217 561 $text =~ s/(\bConversion failed when converting the \w+ value )$QUOTED( to data type )/$1'$MASK'$2/g;
218  
219 # The conversion of the varchar value '3000000000' overflowed an INT2 column.
220 561 $text =~ s/(\bThe conversion of the \w+ value )$QUOTED( overflowed an )/$1'$MASK'$2/g;
221  
222 # ... The duplicate key value is (11, 22). The text has no column names and
223 # a value may hold ", " and ")", so all up to the last ")." is the value.
224 561 $text =~ s/(\bThe duplicate key value is \().*(\)\.)/$1$MASK$2/s;
225  
226 # String or binary data would be truncated in table 't', column 's'. Truncated value: 'x'.
227 561 $text =~ s/(\bTruncated value: )$QUOTED/$1'$MASK'/g;
228  
229 # Incorrect syntax near 'GARBAGE'. (the form with a keyword has no quotes
230 # right after "near" and is not touched)
231 561 $text =~ s/(\bIncorrect syntax near )$QUOTED/$1'$MASK'/g;
232  
233 # JSON text is not properly formatted. Unexpected character 'g' is found at position 1.
234 # The character may be a quote itself, so it is not read as a quoted value.
235 561 $text =~ s/(\bUnexpected character )'.{1,8}?'( is found at position )/$1'$MASK'$2/gs;
236  
237 # The server cuts a message at about 2000 characters. A long value then runs
238 # to the end of the message, without the closing quote and without the words
239 # behind it, and the rules above do not match. The value is what is left of
240 # the message up to its end.
241 561 $text =~ s/(\bConversion failed when converting the \w+ value )'(?:[^']|'')*?$END/$1'$MASK'/g;
242 561 $text =~ s/(\bThe conversion of the \w+ value )'(?:[^']|'')*?$END/$1'$MASK'/g;
243 561 $text =~ s/(\bTruncated value: )'(?:[^']|'')*?$END/$1'$MASK'/g;
244 561 $text =~ s/(\bThe duplicate key value is \()(?!\Q$MASK\E\)\.)(?:(?!\)\.).)*?$END/$1$MASK/gs;
245  
246 561 return $text;
247 }
248  
249  
250 563 ▶sub mask_error_details {
Subroutine mask_error_details: called CC=9 SCAR=22.0
Pod documented
251 563 my ($message, $binds, $statement, $diag) = @_;
252 563 ▶ return $message unless defined $message && length $message;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $message and length $message 2 561 563
Condition100%3/3
defined $message and length $message
!ll&&!rl&&r
11561
MC/DC100%2/2
defined $message and length $message
defined $message length $message
Truth table100%3/3
A and B
A= defined $messageB= length $message
ABresult
0X0
100
111
253  
254 561 $message = _mask_by_number_in_characters($message, $diag);
255 561 $message = _mask_sentences($message);
256  
257 561 my %bound;
258 561 ▶ for my $value (grep { defined && !ref && length >= $MIN_BOUND_LENGTH } @{ $binds // [] }) {
Condition100%8/8
defined $_ && !ref($_) && length $_ >= $MIN_BOUND_LENGTH
!ll&&!rl&&r
21535
defined $_ and not ref $_
!ll&&!rl&&r
1150
$binds // []
l!l
62499
MC/DC100%3/3
defined $_ && !ref($_) && length $_ >= $MIN_BOUND_LENGTH
defined $_ not ref $_ length $_ >= $MIN_BOUND_LENGTH
MC/DC100%1/1
$binds // []
$binds
Truth table100%4/4
A and not(B) && C
A= defined $_B= not ref $_C= length $_ >= $MIN_BOUND_LENGTH
ABCresult
0XX0
10X0
1100
1111
Truth table100%2/2
A
A= $binds
Aresult
11
00
259 35 $bound{$value} = 1;
260 35 (my $literal = $value) =~ s/'/''/g;
261 35 $bound{$literal} = 1;
262 }
263 561 ▶ for my $value (sort { length $b <=> length $a || $a cmp $b } keys %bound) {
Condition33%1/3
length $b <=> length $a || $a cmp $b
l!l&&r!l&&!r
200
MC/DC0%0/2
length $b <=> length $a || $a cmp $b
length $b <=> length $a $a cmp $b
Truth table33%1/3
A || B
A= length $b <=> length $aB= $a cmp $b
ABresult
1X1
011
000
264 36 $message =~ s/\Q$value\E/$MASK/g;
265 }
266  
267 561 return $message;
268 }
269  
270  
271 26 1;
272  
273 __END__
« MSSQL/Diff/PrimaryKey.pm ↑ Summary MSSQL/Storage/ODBC.pm »