| 1 | package DBIO::Sybase::Storage::ASE::IdentityRetrieval; | ||||||||||
| 2 | # ABSTRACT: Identity retrieval for Sybase ASE | ||||||||||
| 3 | |||||||||||
| 4 | 34 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 34 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 34 | our $VERSION = '0.900007'; | |||||||||
| 8 | |||||||||||
| 9 | 34 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | # No requires - these methods expect the consuming class to have: | ||||||||||
| 12 | # _identity, _perform_autoinc_retrieval, sql_maker, next::method | ||||||||||
| 13 | |||||||||||
| 14 | 85 | ▶ | sub _fetch_identity_sql { | ||||||||
|
Subroutine
_fetch_identity_sql: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 85 | my ($self, $source, $col) = @_; | |||||||||
| 16 | |||||||||||
| 17 | return sprintf ("SELECT MAX(%s) FROM %s", | ||||||||||
| 18 | 85 | map { $self->sql_maker->_quote ($_) } ($col, $source->from) | |||||||||
| 19 | ); | ||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | # Called during execute to retrieve identity after insert | ||||||||||
| 23 | 255 | ▶ | sub _execute { | ||||||||
|
Subroutine
_execute: called CC=3 SCAR=11.0
| |||||||||||
| 24 | 255 | my $self = shift; | |||||||||
| 25 | 255 | my ($rv, $sth, @bind) = $self->next::method(@_); | |||||||||
| 26 | |||||||||||
| 27 | 249 | ▶ | $self->_identity( ($sth->fetchall_arrayref)->[0][0] ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | if $self->_perform_autoinc_retrieval; | ||||||||||
| 29 | |||||||||||
| 30 | 249 | ▶ | return wantarray ? ($rv, $sth, @bind) : $rv; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 174 | ▶ | sub last_insert_id { shift->_identity } | ||||||||
|
Subroutine
last_insert_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | 34 | 1; | |||||||||
| 37 | |||||||||||
| 38 | __END__ | ||||||||||