Sybase/Storage/ASE/IdentityRetrieval.pm

filter: Statementstmt 55.5% 10 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 1 / 1 totaltotal 48.2% 14 / 29 CC 3 SCAR 16.8
CC
3
Cov
45%
_execute
12.0
_fetch_identity_sql
2.0
last_insert_id
2.0
CRAP 5.4
« Sybase/Diff/Column.pm ↑ Summary Sybase/Storage/FreeTDS.pm »
1 package DBIO::Sybase::Storage::ASE::IdentityRetrieval;
2 # ABSTRACT: Identity retrieval for Sybase ASE
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 4 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # No requires - these methods expect the consuming class to have:
9 # _identity, _perform_autoinc_retrieval, sql_maker, next::method
10  
11 0 ▶sub _fetch_identity_sql {
Subroutine _fetch_identity_sql: not called CC=1 SCAR=6.9
12 0 my ($self, $source, $col) = @_;
13  
14 return sprintf ("SELECT MAX(%s) FROM %s",
15 0 map { $self->sql_maker->_quote ($_) } ($col, $source->from)
16 );
17 }
18  
19 # Called during execute to retrieve identity after insert
20 0 ▶sub _execute {
Subroutine _execute: not called CC=3 SCAR=24.8
21 0 my $self = shift;
22 0 my ($rv, $sth, @bind) = $self->next::method(@_);
23  
24 0 ▶ $self->_identity( ($sth->fetchall_arrayref)->[0][0] )
Branch: 1 branch
BranchTrueFalseTotal
if $self->_perform_autoinc_retrieval 0 0 0
25 if $self->_perform_autoinc_retrieval;
26  
27 0 ▶ return wantarray ? ($rv, $sth, @bind) : $rv;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
28 }
29  
30 0 ▶sub last_insert_id { shift->_identity }
Subroutine last_insert_id: not called CC=1 SCAR=6.9
Pod documented
31  
32  
33 4 1;
34  
35 __END__
36  
37 =pod
38  
39 =encoding UTF-8
40  
41 =head1 NAME
42  
43 DBIO::Sybase::Storage::ASE::IdentityRetrieval - Identity retrieval for Sybase ASE
44  
45 =head1 VERSION
46  
47 version 0.900001
48  
49 =head1 METHODS
50  
51 =head2 last_insert_id
52  
53 Returns the last autoincrement identity value, retrieved via
54 C<SELECT MAX(col)> from the most recently inserted row.
55  
56 =head1 AUTHOR
57  
58 DBIO & DBIx::Class Authors
59  
60 =head1 COPYRIGHT AND LICENSE
61  
62 Copyright (C) 2026 DBIO Authors
63 Portions Copyright (C) 2005-2025 DBIx::Class Authors
64 Based on DBIx::Class, heavily modified.
65  
66 This is free software; you can redistribute it and/or modify it under
67 the same terms as the Perl 5 programming language system itself.
68  
69 =cut
« Sybase/Diff/Column.pm ↑ Summary Sybase/Storage/FreeTDS.pm »