| 1 | package DBIO::Storage::DBI::IdentityInsert; | ||||||||||
| 2 | # ABSTRACT: Storage Component for Sybase ASE and MSSQL for Identity Inserts / Updates | ||||||||||
| 3 | |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | our $VERSION = '0.900007'; | |||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | use base 'DBIO::Storage::DBI'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use mro 'c3'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | # SET IDENTITY_X only works as part of a statement scope. We can not | ||||||||||
| 15 | # $dbh->do the $sql and the wrapping set()s individually. Hence the | ||||||||||
| 16 | # sql mangling. The newlines are important. | ||||||||||
| 17 | 0 | ▶ | sub _prep_for_execute { | ||||||||
|
Subroutine
_prep_for_execute: not called CC=2 SCAR=17.9
| |||||||||||
| 18 | 0 | my $self = shift; | |||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | return $self->next::method(@_) unless $self->_autoinc_supplied_for_op; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | |||||||||||
| 22 | 0 | my ($op, $ident) = @_; | |||||||||
| 23 | |||||||||||
| 24 | 0 | my $table = $self->sql_maker->_quote($ident->name); | |||||||||
| 25 | 0 | $op = uc $op; | |||||||||
| 26 | |||||||||||
| 27 | 0 | my ($sql, $bind) = $self->next::method(@_); | |||||||||
| 28 | |||||||||||
| 29 | 0 | return (<<EOS, $bind); | |||||||||
| 30 | SET IDENTITY_$op $table ON | ||||||||||
| 31 | $sql | ||||||||||
| 32 | SET IDENTITY_$op $table OFF | ||||||||||
| 33 | EOS | ||||||||||
| 34 | |||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 3 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||