MSSQL/Test/Conformance.pm

filter: Statementstmt 25.0% 41 / 164 Branchbran 6.9% 5 / 72 Conditioncond 18.6% 8 / 43 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 44.4% 12 / 27 Podpod 100% 12 / 12 totaltotal 22.9% 78 / 340 CC 54 SCAR 53.6
CC
54
Cov
19%
conformance_fact
650.0
_server
36.7
conformance_cleanup
20.0
CRAP 212.7
↑ Summary MSSQL/Introspect.pm »
1 package DBIO::MSSQL::Test::Conformance;
2 # ABSTRACT: Answers the shared conformance case table for the SQL Server driver
3  
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 our $VERSION = '0.900007';
8  
9 6 ▶use base 'DBIO::Test::Conformance';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 ▶use DBI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use DBIO::Exception ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use DBIO::MSSQL::Introspect ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use DBIO::MSSQL::Deploy ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16  
17 6 my $SEQ = 0;
18 # schema class => name of the database of its case
19 6 my %DATABASE;
20  
21 # the connection details of the access path in use: [ dsn, user, pass ]
22 7 ▶sub _server {
Subroutine _server: called CC=12 SCAR=36.0
23 7 my @odbc = @ENV{qw(DBIO_TEST_MSSQL_ODBC_DSN DBIO_TEST_MSSQL_ODBC_USER DBIO_TEST_MSSQL_ODBC_PASS)};
24 7 my @sybase = @ENV{qw(DBIO_TEST_MSSQL_DSN DBIO_TEST_MSSQL_USER DBIO_TEST_MSSQL_PASS)};
25 # The Bind list writes and reads text beyond ASCII. Over DBD::ODBC without Unicode
26 # support the storage takes that only with a UTF-8 client character set, which the
27 # FreeTDS ODBC driver reads from the locale of the process; the DSN names it
28 # instead (a DSN that names a ClientCharset keeps it).
29 7 ▶ $odbc[0] .= ($odbc[0] =~ /;\z/ ? '' : ';') . 'ClientCharset=UTF-8'
Branch: 2 branches
BranchTrueFalseTotal
if length($odbc[0] // "") and $odbc[0] =~ /\Adbi:ODBC:/i and not $odbc[0] =~ /ClientCharset=/i 0 7 7
$odbc[0] =~ /;\z/ ? : 0 0 0
Condition37%3/8
length($odbc[0] // "") and $odbc[0] =~ /\Adbi:ODBC:/i and not $odbc[0] =~ /ClientCharset=/i
!ll&&!rl&&r
700
length($odbc[0] // "") and $odbc[0] =~ /\Adbi:ODBC:/i
!ll&&!rl&&r
700
$odbc[0] // ""
l!l
07
MC/DC0%0/3
length($odbc[0] // "") and $odbc[0] =~ /\Adbi:ODBC:/i and not $odbc[0] =~ /ClientCharset=/i
$odbc[0] $odbc[0] =~ /\Adbi:ODBC:/i not $odbc[0] =~ /ClientCharset=/i
Truth table25%1/4
A and B and not(C)
A= $odbc[0]B= $odbc[0] =~ /\Adbi:ODBC:/iC= not $odbc[0] =~ /ClientCharset=/i
ABCresult
0XX0
10X0
1100
1111
30 if length($odbc[0] // '') and $odbc[0] =~ /\Adbi:ODBC:/i and $odbc[0] !~ /ClientCharset=/i;
31 0 ▶ return \@odbc if length($odbc[0] // '') and eval { require DBD::ODBC; 1 };
Branch: 1 branch
BranchTrueFalseTotal
if length($odbc[0] // "") and eval { do { require DBD::ODBC; 1 } } 0 7 7
Condition40%2/5
length($odbc[0] // "") and eval { do { require DBD::ODBC; 1 } }
!ll&&!rl&&r
700
$odbc[0] // ""
l!l
07
MC/DC0%0/2
length($odbc[0] // "") and eval { do { require DBD::ODBC; 1 } }
$odbc[0] eval { do { require DBD::ODBC; 1 } }
Truth table33%1/3
A and B
A= $odbc[0]B= eval { do { require DBD::ODBC; 1 } }
ABresult
0X0
100
111
32 0 ▶ return \@sybase if length($sybase[0] // '') and eval { require DBD::Sybase; 1 };
Branch: 1 branch
BranchTrueFalseTotal
if length($sybase[0] // "") and eval { do { require DBD::Sybase; 1 } } 0 7 7
Condition40%2/5
length($sybase[0] // "") and eval { do { require DBD::Sybase; 1 } }
!ll&&!rl&&r
700
$sybase[0] // ""
l!l
07
MC/DC0%0/2
length($sybase[0] // "") and eval { do { require DBD::Sybase; 1 } }
$sybase[0] eval { do { require DBD::Sybase; 1 } }
Truth table33%1/3
A and B
A= $sybase[0]B= eval { do { require DBD::Sybase; 1 } }
ABresult
0X0
100
111
33 7 return undef;
34 }
35  
36 # the DSN with its database swapped, in the spelling of the DBD (as
37 # DBIO::MSSQL::Deploy::_temp_dsn does)
38 0 ▶sub _dsn_for {
Subroutine _dsn_for: not called CC=3 SCAR=24.8
39 0 my ($class, $dsn, $database) = @_;
40 0 ▶ return $dsn if $dsn =~ s/\b((?:Database|dbname)=)[^;]*/$1$database/i;
Branch: 1 branch
BranchTrueFalseTotal
if $dsn =~ s/\b((?:Database|dbname)=)[^;]*/$1$database/i 0 0 0
41 0 ▶ my $key = $dsn =~ /^dbi:Sybase:/i ? 'database' : 'Database';
Branch: 1 branch
BranchTrueFalseTotal
$dsn =~ /^dbi:Sybase:/i ? : 0 0 0
42 0 $dsn =~ s/;\z//;
43 0 return "$dsn;$key=$database";
44 }
45  
46 0 ▶sub _admin_dbh {
Subroutine _admin_dbh: not called CC=1 SCAR=6.9
47 0 my ($class) = @_;
48 0 my ($dsn, $user, $pass) = @{ $class->_server };
49 0 return DBI->connect($dsn, $user, $pass,
50 { RaiseError => 1, PrintError => 0, PrintWarn => 0, AutoCommit => 1 });
51 }
52  
53  
54 4 ▶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 4 4
55  
56  
57 0 ▶sub conformance_connect {
Subroutine conformance_connect: not called CC=2 SCAR=17.9
Pod documented
58 0 my ($class, $schema_class) = @_;
59 0 ▶ my $server = $class->_server
Branch: 1 branch
BranchTrueFalseTotal
my $server = $class->_server or "DBIO::Exception"->throw("conformance: no SQL Server configured") 0 0 0
60 or DBIO::Exception->throw('conformance: no SQL Server configured');
61 0 my $name = $class->_database_name;
62 0 $DATABASE{$schema_class} = $name;
63  
64 0 $schema_class->load_components('MSSQL');
65 0 my ($dsn, $user, $pass) = @$server;
66 0 return $schema_class->connect($class->_dsn_for($dsn, $name), $user, $pass,
67 { AutoCommit => 1, RaiseError => 1, PrintError => 0, PrintWarn => 0,
68 $class->_long_read_len($dsn) });
69 }
70  
71 # Over DBD::Sybase a value longer than the TEXTSIZE of the session (LongReadLen,
72 # 32768 unless the connect info says otherwise) is refused when it is read, not
73 # cut (karr k47); the Bind list writes and reads 100000 characters, so the
74 # connection names a LongReadLen for them, as the message of that refusal says.
75 # DBD::Sybase also reads a datetime as 'Oct 25 2026 04:02PM' unless the
76 # connection asks for datetime_setup (ISO). DBD::ODBC has 1 GiB by default and
77 # reads ISO; it is left alone.
78 0 ▶sub _long_read_len {
Subroutine _long_read_len: not called CC=2 SCAR=17.9
79 0 my ($class, $dsn) = @_;
80 0 ▶ return $dsn =~ /^dbi:Sybase:/i
Branch: 1 branch
BranchTrueFalseTotal
$dsn =~ /^dbi:Sybase:/i ? : 0 0 0
81 ? (LongReadLen => 1_000_000, on_connect_call => 'datetime_setup')
82 : ();
83 }
84  
85 # The name of the next case's database. A hook for the test of the refusal
86 # (t/89): a subclass answers a name that is taken already.
87 0 ▶sub _database_name { sprintf 'dbio_cf_%d_%d', $$, ++$SEQ }
Subroutine _database_name: not called CC=1 SCAR=6.9
88  
89 0 ▶sub _database_of {
Subroutine _database_of: not called CC=2 SCAR=17.9
90 0 my ($class, $schema) = @_;
91 0 my $name = $DATABASE{ ref $schema };
92 0 ▶ DBIO::Exception->throw('conformance: this schema was not connected through '
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
93 . 'conformance_connect') unless defined $name;
94 0 return $name;
95 }
96  
97  
98 11 ▶sub conformance_quote_ident {
Subroutine conformance_quote_ident: called CC=1 SCAR=0.0
Pod documented
99 11 my ($class, $schema, $name) = @_;
100 11 (my $inner = $name) =~ s/\]/]]/g;
101 11 return "[$inner]";
102 }
103  
104  
105 0 ▶sub conformance_namespace {
Subroutine conformance_namespace: not called CC=3 SCAR=24.8
Pod documented
106 0 my ($class, $schema, $case) = @_;
107 0 my $name = $class->_database_of($schema);
108 0 my $admin = $class->_admin_dbh;
109 0 my $ok = eval {
110 0 my ($id) = $admin->selectrow_array('SELECT DB_ID(?)', undef, $name);
111 0 ▶ DBIO::Exception->throw("conformance: the database $name exists already; "
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 0 0 0
112 . 'refusing to use or drop a database the case did not create')
113 if defined $id;
114 0 $admin->do("CREATE DATABASE [$name]");
115 0 1;
116 };
117 0 my $err = $@;
118 0 $admin->disconnect;
119 0 ▶ die $err unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
120 0 return { name => $name, created => 1 };
121 }
122  
123  
124 0 ▶sub conformance_install {
Subroutine conformance_install: not called CC=1 SCAR=6.9
Pod documented
125 0 my ($class, $schema, $case) = @_;
126 0 $schema->deploy;
127 0 return;
128 }
129  
130  
131 0 ▶sub conformance_cleanup {
Subroutine conformance_cleanup: not called CC=4 SCAR=30.0
Pod documented
132 0 my ($class, $schema, $case, $namespace) = @_;
133 0 delete $DATABASE{ ref $schema };
134 0 eval { $schema->storage->disconnect; 1 };
135 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
136 0 my $name = $namespace->{name};
137  
138 0 my $admin = $class->_admin_dbh;
139 0 my $ok = eval {
140 0 $admin->do("IF DB_ID('$name') IS NOT NULL BEGIN "
141 . "ALTER DATABASE [$name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; "
142 . "DROP DATABASE [$name] END");
143 0 1;
144 };
145 0 my $err = $@;
146 0 $admin->disconnect;
147 0 ▶ DBIO::Exception->throw("conformance: cleanup of database $name failed: $err")
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
148 unless $ok;
149 0 return;
150 }
151  
152  
153 0 ▶sub conformance_diff_is_empty {
Subroutine conformance_diff_is_empty: not called CC=2 SCAR=17.9
Pod documented
154 0 my ($class, $schema, $case) = @_;
155 0 my $diff = DBIO::MSSQL::Deploy->new(schema => $schema)->diff;
156 0 ▶ return $diff->has_changes ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$diff->has_changes ? : 0 0 0
157 }
158  
159  
160 0 ▶sub conformance_upgrade {
Subroutine conformance_upgrade: not called CC=1 SCAR=6.9
Pod documented
161 0 my ($class, $schema, $to_class, $case) = @_;
162 0 my $to = $class->_connect_target($schema, $to_class);
163 0 DBIO::MSSQL::Deploy->new(schema => $to)->upgrade(allow_destructive => 1);
164 0 return $to;
165 }
166  
167  
168 0 ▶sub conformance_deploy {
Subroutine conformance_deploy: not called CC=1 SCAR=6.9
Pod documented
169 0 my ($class, $schema, $to_class, $case) = @_;
170 0 my $to = $class->_connect_target($schema, $to_class);
171 0 return DBIO::MSSQL::Deploy->new(schema => $to);
172 }
173  
174 # The target class, connected to the database of the installed schema.
175 0 ▶sub _connect_target {
Subroutine _connect_target: not called CC=2 SCAR=17.9
176 0 my ($class, $schema, $to_class) = @_;
177 0 ▶ my $server = $class->_server
Branch: 1 branch
BranchTrueFalseTotal
my $server = $class->_server or "DBIO::Exception"->throw("conformance: no SQL Server configured") 0 0 0
178 or DBIO::Exception->throw('conformance: no SQL Server configured');
179 0 my $name = $class->_database_of($schema);
180 0 $to_class->load_components('MSSQL');
181 0 $DATABASE{$to_class} = $name;
182 0 my ($dsn, $user, $pass) = @$server;
183 0 return $to_class->connect($class->_dsn_for($dsn, $name), $user, $pass,
184 { AutoCommit => 1, RaiseError => 1, PrintError => 0, PrintWarn => 0,
185 $class->_long_read_len($dsn) });
186 }
187  
188  
189 6 ▶sub conformance_answered_through { { DDL => 2, Diff => 4, Bind => 1 } }
Subroutine conformance_answered_through: called CC=1 SCAR=0.0
Pod documented
190  
191  
192 3 ▶sub conformance_refusals {
Subroutine conformance_refusals: called CC=3 SCAR=12.3
Pod documented
193 3 my ($class) = @_;
194 3 my $refusals = {
195 'ddl-enum-value-apostrophe' => {
196 kind => 'server',
197 reason => qr/type 'enum'.*is refused: SQL Server has no enum type/s,
198 },
199 'ddl-type-size-bit' => {
200 kind => 'server',
201 reason => qr/size '8' on type 'bit'.*is refused: bit has no length in SQL Server/s,
202 },
203 'ddl-default-digit-string' => {
204 kind => 'deviation',
205 fact => qr/expected '007', read back '007 +'/,
206 reason => 'a char(n) column pads the value with blanks to its length',
207 },
208  
209 # Diff list (karr k81)
210 'diff-column-added-not-null-populated' => {
211 kind => 'server',
212 reason => qr/refuses to add the column base\.code: it is NOT NULL without a default/,
213 },
214 'diff-not-null-over-nulls' => {
215 kind => 'server',
216 reason => qr/refuses to make the column opt\.c NOT NULL: table opt holds rows where it is NULL/,
217 },
218 # Bind list (karr k81)
219 'bind-empty-string' => {
220 kind => 'deviation',
221 fact => qr/the server accepted a row it must reject/,
222 reason => "SQL Server converts the empty string to 0 for an integer column "
223 . "(Transact-SQL data type conversion: '' to int is 0), so n => '' is "
224 . 'stored as 0, not rejected; the empty string itself round-trips '
225 . 'exactly',
226 },
227  
228 };
229  
230 # Over DBD::Sybase a bound string beyond ASCII is refused before it is sent
231 # (karr k49): FreeTDS would send it as a fixed-length CHAR and the server pad
232 # it. The case is a refusal there, a deviation over DBD::ODBC.
233 3 my $server = $class->_server;
234 3 ▶ if ($server and $server->[0] =~ /^dbi:Sybase:/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($server and $server->[0] =~ /^dbi:Sybase:/i) 0 3 3
Condition33%1/3
$server and $server->[0] =~ /^dbi:Sybase:/i
!ll&&!rl&&r
300
MC/DC0%0/2
$server and $server->[0] =~ /^dbi:Sybase:/i
$server $server->[0] =~ /^dbi:Sybase:/i
Truth table33%1/3
A and B
A= $serverB= $server->[0] =~ /^dbi:Sybase:/i
ABresult
0X0
100
111
235 0 $refusals->{'bind-non-ascii'} = {
236 kind => 'server',
237 reason => qr/has a character beyond ASCII.*Connect through DBD::ODBC/s,
238 };
239 }
240 3 return $refusals;
241 }
242  
243  
244 0 ▶sub conformance_fact {
Subroutine conformance_fact: not called CC=25 SCAR=64.8
Pod documented
245 0 my ($class, $schema, $name, $args) = @_;
246 0 my $dbh = $schema->storage->dbh;
247  
248 0 ▶ if ($name eq 'table_in_namespace') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "table_in_namespace") 0 0 0
249 my ($n) = $dbh->selectrow_array(
250 'SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES '
251 . 'WHERE table_schema = ? AND table_name = ?',
252 0 undef, $args->{namespace}, $args->{unqualified});
253 0 ▶ return $n ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$n ? : 0 0 0
254 }
255  
256 # a table "schema.table" is read from that schema (karr k72)
257 0 my $table = $args->{table};
258 0 ▶ my @schemas = defined $table && $table =~ /\A([^.]+)\./ ? ($1) : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $table && $table =~ /\A([^.]+)\./ ? : 0 0 0
Condition0%0/3
defined $table and $table =~ /\A([^.]+)\./
!ll&&!rl&&r
000
MC/DC0%0/2
defined $table and $table =~ /\A([^.]+)\./
defined $table $table =~ /\A([^.]+)\./
Truth table0%0/3
A and B
A= defined $tableB= $table =~ /\A([^.]+)\./
ABresult
0X0
100
111
259 0 my $model = DBIO::MSSQL::Introspect->new(dbh => $dbh, schemas => \@schemas)->model;
260 0 my $entry = $model->{tables}{$table};
261 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
262 0 ▶ my $same = sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
263 0 my ($got) = @_;
264 0 ▶ return 0 unless @$got == @cols;
Branch: 1 branch
BranchTrueFalseTotal
unless @$got == @cols 0 0 0
265 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
266 0 };
267  
268 0 ▶ if ($name eq 'object_kind') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "object_kind") 0 0 0
269 0 ▶ return $entry ? $entry->{kind} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$entry ? : 0 0 0
270 }
271 0 ▶ if ($name eq 'table_name') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "table_name") 0 0 0
272 0 ▶ return $entry ? $entry->{table_name} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$entry ? : 0 0 0
273 }
274  
275 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
276 0 ▶ if ($name eq 'column_names') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_names") 0 0 0
277 0 return [ map { $_->{column_name} } @$columns ];
278 }
279 0 ▶ if ($name eq 'column_size') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_size") 0 0 0
280 0 my ($col) = grep { $_->{column_name} eq $args->{column} } @$columns;
281 0 ▶ return $col ? $col->{size} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$col ? : 0 0 0
282 }
283 0 ▶ if ($name eq 'column_auto_increment') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "column_auto_increment") 0 0 0
284 0 my ($col) = grep { $_->{column_name} eq $args->{column} } @$columns;
285 0 ▶ return $col && $col->{is_identity} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$col && $col->{'is_identity'} ? : 0 0 0
Condition0%0/3
$col and $col->{"is_identity"}
!ll&&!rl&&r
000
MC/DC0%0/2
$col and $col->{"is_identity"}
$col $col->{"is_identity"}
Truth table0%0/3
A and B
A= $colB= $col->{"is_identity"}
ABresult
0X0
100
111
286 }
287 0 ▶ if ($name eq 'primary_key_columns') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "primary_key_columns") 0 0 0
288 0 return [ map { $_->{column_name} }
289 0 sort { $a->{pk_position} <=> $b->{pk_position} }
290 0 grep { $_->{is_pk} } @$columns ];
291 }
292  
293 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
294 0 ▶ if ($name eq 'unique_exists') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "unique_exists") 0 0 0
295 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
296 ? 1 : 0;
297 }
298 0 ▶ if ($name eq 'foreign_key_count') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "foreign_key_count") 0 0 0
299 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
300 }
301 0 ▶ if ($name eq 'index_count') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "index_count") 0 0 0
302 0 return scalar grep { $same->($_->{columns}) } values %$indexes;
303 }
304  
305 0 DBIO::Exception->throw("unknown conformance fact '$name'");
306 }
307  
308 6 1;
309  
310 __END__
↑ Summary MSSQL/Introspect.pm »