Sybase/Test/Conformance.pm

filter: Statementstmt 23.1% 46 / 199 Branchbran 10.4% 9 / 86 Conditioncond 6.9% 3 / 43 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 50.0% 15 / 30 Podpod 100% 12 / 12 totaltotal 21.6% 85 / 392 CC 63 SCAR 52.5
CC
63
Cov
18%
conformance_fact
650.0
conformance_namespace
72.0
conformance_cleanup
42.0
CRAP 191.4
↑ Summary Sybase/Storage/ASE/BulkInsert.pm »
1 package DBIO::Sybase::Test::Conformance;
2 # ABSTRACT: Answers the shared conformance case table for the Sybase ASE driver
3  
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 our $VERSION = '0.900007';
8  
9 4 ▶use base 'DBIO::Test::Conformance';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use DBI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use DBIO::Exception ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use DBIO::Sybase::Introspect ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use DBIO::Sybase::Deploy ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use DBIO::Sybase::Quote ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 4 my $SEQ = 0;
19 # schema class => name of the database of its case
20 4 my %DATABASE;
21 # database name => the schema the upgrade started from. It stays connected to
22 # the database, which ASE then refuses to drop (Msg 3702), until the cleanup
23 # of the upgraded schema closes it.
24 my %FROM;
25  
26 # [ dsn, user, pass ]
27 4 ▶sub _server {
Subroutine _server: called CC=6 SCAR=28.1
28 4 my @s = @ENV{qw(DBIO_TEST_SYBASE_DSN DBIO_TEST_SYBASE_USER DBIO_TEST_SYBASE_PASS)};
29 4 ▶ return undef unless length($s[0] // '') and defined $s[1] and defined $s[2];
Branch: 1 branch
BranchTrueFalseTotal
unless length($s[0] // "") and defined $s[1] and defined $s[2] 4 0 4
Condition37%3/8
length($s[0] // "") and defined $s[1] and defined $s[2]
!ll&&!rl&&r
400
length($s[0] // "") and defined $s[1]
!ll&&!rl&&r
400
$s[0] // ""
l!l
04
MC/DC0%0/3
length($s[0] // "") and defined $s[1] and defined $s[2]
$s[0] defined $s[1] defined $s[2]
Truth table25%1/4
A and B and C
A= $s[0]B= defined $s[1]C= defined $s[2]
ABCresult
0XX0
10X0
1100
1111
30 0 ▶ return undef unless eval { require DBD::Sybase; 1 };
Branch: 1 branch
BranchTrueFalseTotal
unless eval { do { require DBD::Sybase; 1 } } 0 0 0
31 0 return \@s;
32 }
33  
34 # the DSN with its database swapped (as DBIO::Sybase::Deploy::_temp_dsn does)
35 2 ▶sub _dsn_for {
Subroutine _dsn_for: called CC=3 SCAR=11.1
36 2 my ($class, $dsn, $database) = @_;
37 2 ▶ return $dsn if $dsn =~ s/\bdatabase=[^;]*/database=$database/i;
Branch: 1 branch
BranchTrueFalseTotal
if $dsn =~ s/\bdatabase=[^;]*/database=$database/i 1 1 2
38 1 ▶ return $dsn =~ /[:;]\z/ ? "${dsn}database=$database" : "$dsn;database=$database";
Branch: 1 branch
BranchTrueFalseTotal
$dsn =~ /[:;]\z/ ? : 0 1 1
39 }
40  
41 0 ▶sub _admin_dbh {
Subroutine _admin_dbh: not called CC=1 SCAR=6.9
42 0 my ($class) = @_;
43 0 my ($dsn, $user, $pass) = @{ $class->_server };
44 0 my $dbh = DBI->connect($dsn, $user, $pass,
45 { RaiseError => 1, PrintError => 0, PrintWarn => 0, AutoCommit => 1 });
46 0 $dbh->do('USE master'); # CREATE/DROP DATABASE run from master only (Msg 1809)
47 0 return $dbh;
48 }
49  
50 # True when DBD::Sybase was built against FreeTDS (asked of a connection of its
51 # own, once).
52 4 my $FREETDS;
53 3 ▶sub _freetds {
Subroutine _freetds: called CC=7 SCAR=32.5
54 3 my ($class) = @_;
55 3 ▶ return $FREETDS if defined $FREETDS;
Branch: 1 branch
BranchTrueFalseTotal
if defined $FREETDS 2 1 3
56 1 ▶ return $FREETDS = 0 unless $class->_server;
Branch: 1 branch
BranchTrueFalseTotal
unless $class->_server 1 0 1
57 0 my $dbh = eval { $class->_admin_dbh };
58 0 ▶ $FREETDS = ($dbh && ($dbh->{syb_oc_version} // '') =~ /freetds/i) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$dbh && ($dbh->{'syb_oc_version'} // '') =~ /freetds/i ? : 0 0 0
Condition0%0/5
$dbh and ($dbh->{"syb_oc_version"} // "") =~ /freetds/i
!ll&&!rl&&r
000
$dbh->{"syb_oc_version"} // ""
l!l
00
MC/DC0%0/2
$dbh and ($dbh->{"syb_oc_version"} // "") =~ /freetds/i
$dbh $dbh->{"syb_oc_version"}
Truth table0%0/3
A and B
A= $dbhB= $dbh->{"syb_oc_version"}
ABresult
0X0
100
111
59 0 ▶ eval { $dbh->disconnect } if $dbh;
Branch: 1 branch
BranchTrueFalseTotal
if $dbh 0 0 0
60 0 return $FREETDS;
61 }
62  
63  
64 3 ▶sub conformance_live_available { $_[0]->_server ? 1 : 0 }
Subroutine conformance_live_available: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->_server ? : 0 3 3
65  
66  
67 0 ▶sub conformance_connect {
Subroutine conformance_connect: not called CC=2 SCAR=17.9
Pod documented
68 0 my ($class, $schema_class) = @_;
69 0 ▶ my $server = $class->_server
Branch: 1 branch
BranchTrueFalseTotal
my $server = $class->_server or "DBIO::Exception"->throw("conformance: no Sybase ASE server configured") 0 0 0
70 or DBIO::Exception->throw('conformance: no Sybase ASE server configured');
71 0 my $name = $class->_database_name;
72 0 $DATABASE{$schema_class} = $name;
73  
74 0 $schema_class->load_components('Sybase');
75 0 my ($dsn, $user, $pass) = @$server;
76 0 return $schema_class->connect($class->_dsn_for($dsn, $name), $user, $pass,
77 { AutoCommit => 1, RaiseError => 1, PrintError => 0, PrintWarn => 0,
78 on_connect_call => 'datetime_setup' });
79 }
80  
81 # The database the connection is in must be the case's own. DBD::Sybase cannot
82 # change into a database that is not there yet and then goes on in the login's
83 # default database (master or the test database), with only a warning: a
84 # connection made before L</conformance_namespace> created the database would
85 # put the case's tables there. So no statement of a case goes out before this
86 # has looked.
87 0 ▶sub _assert_database {
Subroutine _assert_database: not called CC=4 SCAR=30.0
88 0 my ($class, $schema) = @_;
89 0 my $want = $class->_database_of($schema);
90 0 my ($got) = $schema->storage->dbh->selectrow_array('SELECT db_name()');
91 0 ▶ DBIO::Exception->throw("conformance: the connection is in database "
Branch: 2 branches
BranchTrueFalseTotal
unless defined $got and $got eq $want 0 0 0
defined $got ? : 0 0 0
Condition0%0/3
defined $got and $got eq $want
!ll&&!rl&&r
000
MC/DC0%0/2
defined $got and $got eq $want
defined $got $got eq $want
Truth table0%0/3
A and B
A= defined $gotB= $got eq $want
ABresult
0X0
100
111
92 . (defined $got ? "'$got'" : '(unknown)') . ", not in '$want' of the case; "
93 . 'refusing to write into it')
94 unless defined $got and $got eq $want;
95 0 return;
96 }
97  
98  
99 2 ▶sub conformance_quote_ident {
Subroutine conformance_quote_ident: called CC=1 SCAR=0.0
Pod documented
100 2 my ($class, $schema, $name) = @_;
101 2 return DBIO::Sybase::Quote::quote_ident($name);
102 }
103  
104 # The name of the next case's database. A hook for the test of the refusal: a
105 # subclass answers a name that is taken already.
106 0 ▶sub _database_name { sprintf 'dbio_cf_%d_%d', $$, ++$SEQ }
Subroutine _database_name: not called CC=1 SCAR=6.9
107  
108 0 ▶sub _database_of {
Subroutine _database_of: not called CC=2 SCAR=17.9
109 0 my ($class, $schema) = @_;
110 0 my $name = $DATABASE{ ref $schema };
111 0 ▶ DBIO::Exception->throw('conformance: this schema was not connected through '
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
112 . 'conformance_connect') unless defined $name;
113 0 return $name;
114 }
115  
116  
117 0 ▶sub conformance_namespace {
Subroutine conformance_namespace: not called CC=8 SCAR=42.8
Pod documented
118 0 my ($class, $schema, $case) = @_;
119 0 my $name = $class->_database_of($schema);
120 0 my $admin = $class->_admin_dbh;
121 0 my $ok = eval {
122 0 my ($there) = $admin->selectrow_array(
123 'SELECT COUNT(*) FROM master..sysdatabases WHERE name = ?', undef, $name);
124 0 ▶ DBIO::Exception->throw("conformance: the database $name exists already; "
Branch: 1 branch
BranchTrueFalseTotal
if $there 0 0 0
125 . 'refusing to use or drop a database the case did not create')
126 if $there;
127 0 $admin->do("CREATE DATABASE $name");
128 # from here the database is ours; if the options fail it is dropped again
129 0 my $set = eval {
130 0 ▶ local $admin->{syb_err_handler} = sub { $_[1] > 10 ? 1 : 0 };
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] > 10 ? : 0 0 0
131 0 for my $option ('abort tran on log full', 'select into/bulkcopy/pllsort') {
132 0 my $sth = $admin->prepare("exec sp_dboption '$name', '$option', true");
133 0 $sth->execute;
134 0 ▶ do { 1 while $sth->fetchrow_arrayref } while $sth->{syb_more_results};
Branch: 2 branches
BranchTrueFalseTotal
$sth->{"syb_more_results"} and do { do { '???' while $sth->fetchrow_arrayref } } 0 0 0
$sth->fetchrow_arrayref and do { '???' } 0 0 0
135 }
136 0 1;
137 };
138 0 ▶ unless ($set) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($set) 0 0 0
139 0 my $err = $@;
140 0 ▶ eval { DBIO::Sybase::Deploy->new(schema => $schema)->_drop_temp_db($admin, $name); 1 }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { "DBIO::Sybase::Deploy"->new("schema", $schema)->_drop_temp_db($admin, $name); 1 } } or $err .= "\nthe database $name was left on the server: $@" 0 0 0
141 or $err .= "\nthe database $name was left on the server: $@";
142 0 die $err;
143 }
144 0 1;
145 };
146 0 my $err = $@;
147 0 $admin->disconnect;
148 0 ▶ die $err unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
149 0 return { name => $name, created => 1 };
150 }
151  
152  
153 0 ▶sub conformance_install {
Subroutine conformance_install: not called CC=1 SCAR=6.9
Pod documented
154 0 my ($class, $schema, $case) = @_;
155 0 $class->_assert_database($schema);
156 0 $schema->deploy;
157 0 return;
158 }
159  
160  
161 0 ▶sub conformance_upgrade {
Subroutine conformance_upgrade: not called CC=1 SCAR=6.9
Pod documented
162 0 my ($class, $schema, $to_class, $case) = @_;
163 0 my $to = $class->_connect_target($schema, $to_class);
164 0 DBIO::Sybase::Deploy->new(schema => $to)->upgrade(allow_destructive => 1);
165 0 return $to;
166 }
167  
168  
169 0 ▶sub conformance_deploy {
Subroutine conformance_deploy: not called CC=1 SCAR=6.9
Pod documented
170 0 my ($class, $schema, $to_class, $case) = @_;
171 0 my $to = $class->_connect_target($schema, $to_class);
172 0 return DBIO::Sybase::Deploy->new(schema => $to);
173 }
174  
175 # The target declaration connected to the database of the case.
176 0 ▶sub _connect_target {
Subroutine _connect_target: not called CC=1 SCAR=6.9
177 0 my ($class, $schema, $to_class) = @_;
178 0 my $name = $class->_database_of($schema);
179 0 $DATABASE{$to_class} = $name;
180 0 $FROM{$name} = $schema;
181 0 my ($dsn, $user, $pass) = @{ $class->_server };
182 0 $to_class->load_components('Sybase');
183 0 my $to = $to_class->connect($class->_dsn_for($dsn, $name), $user, $pass,
184 { AutoCommit => 1, RaiseError => 1, PrintError => 0, PrintWarn => 0,
185 on_connect_call => 'datetime_setup' });
186 0 $class->_assert_database($to);
187 0 return $to;
188 }
189  
190  
191 0 ▶sub conformance_cleanup {
Subroutine conformance_cleanup: not called CC=6 SCAR=37.4
Pod documented
192 0 my ($class, $schema, $case, $namespace) = @_;
193 0 my $name = delete $DATABASE{ ref $schema };
194 0 eval { $schema->storage->disconnect; 1 };
195 0 ▶ if (defined $name and my $from = delete $FROM{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name and my $from = delete $FROM{$name}) 0 0 0
Condition0%0/3
defined $name and my $from = delete $FROM{$name}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and my $from = delete $FROM{$name}
defined $name my $from = delete $FROM{$name}
Truth table0%0/3
A and B
A= defined $nameB= my $from = delete $FROM{$name}
ABresult
0X0
100
111
196 0 eval { $from->storage->disconnect; 1 };
197 }
198 0 ▶ return unless ref $namespace eq 'HASH' and $namespace->{created};
Branch: 1 branch
BranchTrueFalseTotal
unless ref $namespace eq "HASH" and $namespace->{"created"} 0 0 0
Condition0%0/3
ref $namespace eq "HASH" and $namespace->{"created"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $namespace eq "HASH" and $namespace->{"created"}
ref $namespace eq "HASH" $namespace->{"created"}
Truth table0%0/3
A and B
A= ref $namespace eq "HASH"B= $namespace->{"created"}
ABresult
0X0
100
111
199 0 $name = $namespace->{name};
200  
201 0 my $admin = $class->_admin_dbh;
202 0 my $ok = eval {
203 0 DBIO::Sybase::Deploy->new(schema => $schema)->_drop_temp_db($admin, $name);
204 0 1;
205 };
206 0 my $err = $@;
207 0 $admin->disconnect;
208 0 ▶ DBIO::Exception->throw("conformance: cleanup of database $name failed: $err")
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
209 unless $ok;
210 0 return;
211 }
212  
213  
214 0 ▶sub conformance_diff_is_empty {
Subroutine conformance_diff_is_empty: not called CC=2 SCAR=17.9
Pod documented
215 0 my ($class, $schema, $case) = @_;
216 0 my $diff = DBIO::Sybase::Deploy->new(schema => $schema)->diff;
217 0 ▶ return $diff->has_changes ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$diff->has_changes ? : 0 0 0
218 }
219  
220  
221 6 ▶sub conformance_answered_through { { DDL => 2, Diff => 4, Bind => 1 } }
Subroutine conformance_answered_through: called CC=1 SCAR=0.0
Pod documented
222  
223  
224 3 ▶sub conformance_refusals {
Subroutine conformance_refusals: called CC=3 SCAR=12.7
Pod documented
225 3 my ($class) = @_;
226 3 my $refusals = {
227 'ddl-default-digit-string' => {
228 kind => 'deviation',
229 fact => qr/expected '007', read back '007 +'/,
230 reason => 'a char(n) column pads the value with blanks to its length',
231 },
232 'ddl-enum-value-apostrophe' => {
233 kind => 'server',
234 reason => qr/type 'enum'.*is refused: ASE has no enum type/s,
235 },
236 'ddl-type-size-bit' => {
237 kind => 'server',
238 reason => qr/size '8' on type 'bit'.*is refused: bit has no length in ASE/s,
239 },
240 'ddl-base-types-roundtrip' => {
241 kind => 'server',
242 reason => qr/NULL in a bit column is refused: ASE cannot hold NULL in a BIT column/,
243 },
244 'ddl-fk-actions' => {
245 kind => 'server',
246 reason => qr/ASE has no referential actions/,
247 },
248 # Diff list (karr k97)
249 'diff-table-added-complete' => {
250 kind => 'server',
251 reason => qr/ASE has no referential actions/,
252 },
253 'diff-fk-action-changed' => {
254 kind => 'server',
255 reason => qr/ASE has no referential actions/,
256 },
257 'diff-column-added-not-null-populated' => {
258 kind => 'server',
259 reason => qr/table base, column code: .*the add is refused: ASE requires a default clause/s,
260 },
261 'diff-column-added-expression-default' => {
262 kind => 'server',
263 reason => qr/table base, column created: .*expression default is refused/s,
264 },
265 'diff-not-null-over-nulls' => {
266 kind => 'server',
267 reason => qr/table opt, column c: making the column NOT NULL is refused/,
268 },
269 'ddl-qualified-source-name' => {
270 kind => 'server',
271 reason => qr/a name with a dot is refused/,
272 },
273 };
274  
275 # Bind list (karr k97). ASE keeps the empty string as one space in a
276 # char/varchar column, and converts '' to 0 for an integer one.
277 3 $refusals->{'bind-empty-string'} = {
278 kind => 'deviation',
279 fact => qr/Val\.s create: expected '', read back ' '.*Val: the server accepted a row it must reject/s,
280 reason => "ASE has no empty string: '' is stored as a single space in a "
281 . "varchar column (Transact-SQL Users Guide: the empty string literal is a "
282 . "single space), so it reads back as ' ', and for an integer column it "
283 . 'is converted to 0, so n => \'\' is accepted instead of rejected '
284 . '(measured, ASE 16.0 SP02, datalength 1)',
285 };
286  
287 # Over FreeTDS the content of a TEXT or IMAGE column
288 # cannot be written (ct_data_info), and the writer refuses it before it
289 # sends anything. Seven cases write LOB content, the base type text being
290 # one. Not over Open Client libraries: nothing is declared there, as nothing
291 # was measured there.
292 3 ▶ if ($class->_freetds) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->_freetds) 0 3 3
293 0 my $reason = qr/column .*is refused: FreeTDS cannot write the content of a TEXT or IMAGE column/s;
294 0 $refusals->{$_} = { kind => 'server', reason => $reason } for qw(
295 bind-long-string bind-binary bind-lob-empty-and-large
296 bind-lob-row-operations
297 );
298 # its column is a TEXT: the LOB refusal comes first; a character beyond
299 # ASCII for a varchar is refused by _refuse_non_ascii_binds (t/114)
300 0 $refusals->{'bind-non-ascii'} = { kind => 'server', reason => qr/(?:column .*is refused: FreeTDS cannot write the content of a TEXT or IMAGE column|has a character beyond ASCII and is refused)/s };
301 }
302 3 return $refusals;
303 }
304  
305  
306 0 ▶sub conformance_fact {
Subroutine conformance_fact: not called CC=25 SCAR=64.8
Pod documented
307 0 my ($class, $schema, $name, $args) = @_;
308 0 my $dbh = $schema->storage->dbh;
309  
310 0 ▶ if ($name eq 'table_in_namespace') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "table_in_namespace") 0 0 0
311 my ($n) = $dbh->selectrow_array(
312 q{SELECT COUNT(*) FROM sysobjects o JOIN sysusers u ON u.uid = o.uid }
313 . q{WHERE o.type IN ('U','V') AND u.name = ? AND o.name = ?},
314 0 undef, $args->{namespace}, $args->{unqualified});
315 0 ▶ return $n ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$n ? : 0 0 0
316 }
317  
318 0 my $table = $args->{table};
319 0 my $model = DBIO::Sybase::Introspect->new(dbh => $dbh)->model;
320 0 my $entry = $model->{tables}{$table};
321 0 ▶ my @cols = @{ $args->{columns} || [] };
Condition0%0/2
$args->{'columns'} || []
l!l
00
MC/DC0%0/1
$args->{'columns'} || []
$args->{'columns'}
Truth table0%0/2
A
A= $args->{'columns'}
Aresult
11
00
322 0 ▶ my $same = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
323 0 my ($got) = @_;
324 0 ▶ return 0 unless @$got == @cols;
Branch: 1 branch
BranchTrueFalseTotal
unless @$got == @cols 0 0 0
325 0 ▶ return (join("\0", map { $_ // '' } @$got) eq join("\0", @cols)) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
join("\000", map({$_ // '';} @$got)) eq join("\000", @cols) ? : 0 0 0
Condition0%0/2
$_ // ""
l!l
00
MC/DC0%0/1
$_ // ""
$_
Truth table0%0/2
A
A= $_
Aresult
11
00
326 0 };
327  
328 0 ▶ if ($name eq 'object_kind') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "object_kind") 0 0 0
329 0 ▶ return $entry ? $entry->{kind} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$entry ? : 0 0 0
330 }
331 0 ▶ if ($name eq 'table_name') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "table_name") 0 0 0
332 0 ▶ return $entry ? $entry->{table_name} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$entry ? : 0 0 0
333 }
334  
335 0 ▶ my $columns = $model->{columns}{$table} || [];
Condition0%0/2
$model->{'columns'}{$table} || []
l!l
00
MC/DC0%0/1
$model->{'columns'}{$table} || []
$model->{'columns'}{$table}
Truth table0%0/2
A
A= $model->{'columns'}{$table}
Aresult
11
00
336 0 ▶ if ($name eq 'column_names') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_names") 0 0 0
337 0 return [ map { $_->{column_name} } @$columns ];
338 }
339 0 ▶ if ($name eq 'column_size') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_size") 0 0 0
340 0 my ($col) = grep { $_->{column_name} eq $args->{column} } @$columns;
341 0 ▶ return $col ? $col->{size} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$col ? : 0 0 0
342 }
343 0 ▶ if ($name eq 'column_auto_increment') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_auto_increment") 0 0 0
344 0 my ($col) = grep { $_->{column_name} eq $args->{column} } @$columns;
345 0 ▶ return $col && $col->{is_auto_increment} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$col && $col->{'is_auto_increment'} ? : 0 0 0
Condition0%0/3
$col and $col->{"is_auto_increment"}
!ll&&!rl&&r
000
MC/DC0%0/2
$col and $col->{"is_auto_increment"}
$col $col->{"is_auto_increment"}
Truth table0%0/3
A and B
A= $colB= $col->{"is_auto_increment"}
ABresult
0X0
100
111
346 }
347 0 ▶ if ($name eq 'primary_key_columns') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "primary_key_columns") 0 0 0
348 0 return [ map { $_->{column_name} }
349 0 sort { $a->{pk_position} <=> $b->{pk_position} }
350 0 grep { $_->{is_pk} } @$columns ];
351 }
352  
353 0 ▶ my $indexes = $model->{indexes}{$table} || {};
Condition0%0/2
$model->{'indexes'}{$table} || {}
l!l
00
MC/DC0%0/1
$model->{'indexes'}{$table} || {}
$model->{'indexes'}{$table}
Truth table0%0/2
A
A= $model->{'indexes'}{$table}
Aresult
11
00
354 0 ▶ if ($name eq 'unique_exists') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "unique_exists") 0 0 0
355 0 ▶ return (grep { $_->{is_unique} and $same->($_->{columns}) } values %$indexes)
Branch: 1 branch
BranchTrueFalseTotal
grep({$_->{'is_unique'} and &$same($_->{'columns'});} values %$indexes) ? : 0 0 0
Condition0%0/3
$_->{'is_unique'} && &$same($_->{'columns'})
!ll&&!rl&&r
000
MC/DC0%0/2
$_->{'is_unique'} && &$same($_->{'columns'})
$_->{'is_unique'} &$same($_->{'columns'})
Truth table0%0/3
A && B
A= $_->{'is_unique'}B= &$same($_->{'columns'})
ABresult
0X0
100
111
356 ? 1 : 0;
357 }
358 0 ▶ if ($name eq 'foreign_key_count') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "foreign_key_count") 0 0 0
359 0 ▶ return scalar @{ $model->{foreign_keys}{$table} || [] };
Condition0%0/2
$model->{'foreign_keys'}{$table} || []
l!l
00
MC/DC0%0/1
$model->{'foreign_keys'}{$table} || []
$model->{'foreign_keys'}{$table}
Truth table0%0/2
A
A= $model->{'foreign_keys'}{$table}
Aresult
11
00
360 }
361 0 ▶ if ($name eq 'index_count') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "index_count") 0 0 0
362 0 ▶ return scalar grep { ($_->{origin} // '') ne 'pk' and $same->($_->{columns}) }
Condition0%0/5
($_->{'origin'} // '') ne 'pk' && &$same($_->{'columns'})
!ll&&!rl&&r
000
$_->{"origin"} // ""
l!l
00
MC/DC0%0/2
($_->{'origin'} // '') ne 'pk' && &$same($_->{'columns'})
$_->{"origin"} &$same($_->{'columns'})
Truth table0%0/3
A && B
A= $_->{"origin"}B= &$same($_->{'columns'})
ABresult
0X0
100
111
363 values %$indexes;
364 }
365  
366 0 DBIO::Exception->throw("unknown conformance fact '$name'");
367 }
368  
369 4 1;
370  
371 __END__
↑ Summary Sybase/Storage/ASE/BulkInsert.pm »