MSSQL/Result.pm

filter: Statementstmt 52.3% 11 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 53.3% 16 / 30 CC 2 SCAR 10.4
CC
2
Cov
48%
mssql_index
6.0
mssql_indexes
2.0
BEGIN
1.0
CRAP 2.8
« MSSQL/Diff/Index.pm ↑ Summary MSSQL/Diff/ForeignKey.pm »
1 package DBIO::MSSQL::Result;
2 # ABSTRACT: MSSQL-specific Result component for DBIO
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use base 'DBIO::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 __PACKAGE__->mk_classdata('_mssql_indexes' => {});
10  
11  
12  
13 0 ▶sub mssql_index {
Subroutine mssql_index: not called CC=2 SCAR=17.9
Pod documented
14 0 my ($class, $name, $def) = @_;
15 0 ▶ if ($def) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def) 0 0 0
16 0 my $indexes = { %{ $class->_mssql_indexes } };
17 0 $indexes->{$name} = $def;
18 0 $class->_mssql_indexes($indexes);
19 }
20 0 return $class->_mssql_indexes->{$name};
21 }
22  
23  
24 0 ▶sub mssql_indexes {
Subroutine mssql_indexes: not called CC=1 SCAR=6.9
Pod documented
25 0 my ($class) = @_;
26 0 return { %{ $class->_mssql_indexes } };
27 }
28  
29  
30 2 1;
31  
32 __END__
33  
34 =pod
35  
36 =encoding UTF-8
37  
38 =head1 NAME
39  
40 DBIO::MSSQL::Result - MSSQL-specific Result component for DBIO
41  
42 =head1 VERSION
43  
44 version 0.900001
45  
46 =head1 DESCRIPTION
47  
48 C<DBIO::MSSQL::Result> is a DBIO Result component that adds
49 MSSQL-native metadata to a result class: standalone indexes, including
50 clustered/nonclustered hints. It is the counterpart to
51 L<DBIO::MySQL::Result> / L<DBIO::PostgreSQL::Result> and is read by
52 L<DBIO::MSSQL::DDL> when generating install DDL.
53  
54 Load it with:
55  
56 package MyApp::Schema::Result::User;
57 use base 'DBIO::Core';
58 __PACKAGE__->load_components('MSSQL::Result');
59  
60 __PACKAGE__->table('users');
61  
62 __PACKAGE__->mssql_index('idx_users_name' => {
63 columns => ['name'],
64 });
65  
66 __PACKAGE__->mssql_index('idx_users_email' => {
67 unique => 1,
68 kind => 'nonclustered',
69 columns => ['email'],
70 });
71  
72 =head1 METHODS
73  
74 =head2 mssql_index
75  
76 __PACKAGE__->mssql_index('idx_users_email' => {
77 unique => 1,
78 kind => 'nonclustered',
79 columns => ['email'],
80 });
81  
82 Get or set the definition for a named MSSQL index. The definition
83 hashref accepts:
84  
85 =over 4
86  
87 =item C<columns> - ArrayRef of column names
88  
89 =item C<unique> - set to true for a UNIQUE index
90  
91 =item C<kind> - C<clustered> or C<nonclustered>
92  
93 =back
94  
95 =head2 mssql_indexes
96  
97 my $all = $class->mssql_indexes;
98  
99 Returns a copy of all index definitions registered on this result class.
100 Consumed by L<DBIO::MSSQL::DDL>.
101  
102 =seealso
103  
104 =over 4
105  
106 =item * L<DBIO::MSSQL::DDL> - consumes C<mssql_indexes>
107  
108 =item * L<DBIO::MySQL::Result> - the MySQL counterpart
109  
110 =back
111  
112 =head1 AUTHOR
113  
114 DBIO & DBIx::Class Authors
115  
116 =head1 COPYRIGHT AND LICENSE
117  
118 Copyright (C) 2026 DBIO Authors
119 Portions Copyright (C) 2005-2025 DBIx::Class Authors
120 Based on DBIx::Class, heavily modified.
121  
122 This is free software; you can redistribute it and/or modify it under
123 the same terms as the Perl 5 programming language system itself.
124  
125 =cut
« MSSQL/Diff/Index.pm ↑ Summary MSSQL/Diff/ForeignKey.pm »