| 1 | package Rose::DB::Oracle; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 16 | ▶ | use Carp(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use SQL::ReservedWords::Oracle(); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 16 | ▶ | use Rose::DB; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 16 | our $Debug = 0; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 16 | our $VERSION = '0.784'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | use Rose::Class::MakeMethods::Generic | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 16 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 16 | inheritable_scalar => | |||||||||||||||||||||||||||||||||||||||||
| 17 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 18 | '_default_post_connect_sql', | ||||||||||||||||||||||||||||||||||||||||||
| 19 | '_booleans_are_numeric', | ||||||||||||||||||||||||||||||||||||||||||
| 20 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 16 | ); | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | __PACKAGE__->_default_post_connect_sql | ||||||||||||||||||||||||||||||||||||||||||
| 24 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 25 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 26 | q(ALTER SESSION SET NLS_DATE_FORMAT = ') . | ||||||||||||||||||||||||||||||||||||||||||
| 27 | ($ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS') . q('), | ||||||||||||||||||||||||||||||||||||||||||
| 28 | q(ALTER SESSION SET NLS_TIMESTAMP_FORMAT = ') . | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ($ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF') . q('), | ||||||||||||||||||||||||||||||||||||||||||
| 30 | q(ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = ') . | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 16 | ▶ | ($ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM') . q('), | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
MC/DC0%0/1
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
$ENV{'NLS_DATE_FORMAT'}
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
$ENV{'NLS_TIMESTAMP_FORMAT'}
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
Truth table50%1/2
A
A= $ENV{'NLS_DATE_FORMAT'}
Truth table50%1/2
A
A= $ENV{'NLS_TIMESTAMP_FORMAT'}
Truth table50%1/2
A
A= $ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 16 | __PACKAGE__->booleans_are_numeric(0); | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # Class methods | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | sub booleans_are_numeric | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
booleans_are_numeric: called CC=4 SCAR=14.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 16 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 16 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 16 | my $arg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 16 | $class->_booleans_are_numeric($arg); | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 16 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 16 | ▶ | if($arg) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | *format_boolean = \&format_boolean_numeric; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | else | ||||||||||||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 16 | *format_boolean = \&format_boolean_char; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 16 | ▶ | return $arg ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return $class->_booleans_are_numeric; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | # | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # Object methods | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | sub default_post_connect_sql | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_post_connect_sql: called CC=4 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 10 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 10 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if(@_ == 1 && ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ == 1 and ref $_[0] eq "ARRAY"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $class->_default_post_connect_sql(@_); | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | else | ||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $class->_default_post_connect_sql([ @_ ]); | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 10 | return $class->_default_post_connect_sql; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | sub post_connect_sql | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_connect_sql: called CC=14 SCAR=43.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 10 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 10 | ▶ | unless(@_) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||||||||||||||
| 96 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | ( @{ $self->default_post_connect_sql || [] }, @{$self->{'post_connect_sql'} || [] } ) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$self->default_post_connect_sql || []
$self->{'post_connect_sql'} || []
MC/DC0%0/1
$self->default_post_connect_sql || []
$self->default_post_connect_sql
MC/DC0%0/1
$self->{'post_connect_sql'} || []
$self->{'post_connect_sql'}
Truth table0%0/2
A
A= $self->default_post_connect_sql
Truth table0%0/2
A
A= $self->{'post_connect_sql'}
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | [ @{ $self->default_post_connect_sql || [] }, @{$self->{'post_connect_sql'} || [] } ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$self->default_post_connect_sql || []
$self->{'post_connect_sql'} || []
MC/DC0%0/1
$self->default_post_connect_sql || []
$self->default_post_connect_sql
MC/DC0%0/1
$self->{'post_connect_sql'} || []
$self->{'post_connect_sql'}
Truth table0%0/2
A
A= $self->default_post_connect_sql
Truth table0%0/2
A
A= $self->{'post_connect_sql'}
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 10 | ▶ | if(@_ == 1 && ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ == 1 and ref $_[0] eq "ARRAY"
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1
ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | { | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 10 | $self->{'post_connect_sql'} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | else | ||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->{'post_connect_sql'} = [ @_ ]; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | return wantarray ? | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | ( @{ $self->default_post_connect_sql || [] }, @{$self->{'post_connect_sql'} || [] } ) : | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$self->default_post_connect_sql || []
$self->{'post_connect_sql'} || []
MC/DC0%0/1
$self->default_post_connect_sql || []
$self->default_post_connect_sql
MC/DC0%0/1
$self->{'post_connect_sql'} || []
$self->{'post_connect_sql'}
Truth table0%0/2
A
A= $self->default_post_connect_sql
Truth table0%0/2
A
A= $self->{'post_connect_sql'}
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 10 | ▶ | [ @{ $self->default_post_connect_sql || [] }, @{$self->{'post_connect_sql'} || [] } ]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$self->default_post_connect_sql || []
$self->{'post_connect_sql'} || []
MC/DC0%0/1
$self->default_post_connect_sql || []
$self->default_post_connect_sql
MC/DC0%0/1
$self->{'post_connect_sql'} || []
$self->{'post_connect_sql'}
Truth table50%1/2
A
A= $self->default_post_connect_sql
Truth table50%1/2
A
A= $self->{'post_connect_sql'}
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | sub schema | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
schema: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | $self->{'schema'} = shift if(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | return $self->{'schema'} || $self->username; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'schema'} || $self->username
MC/DC0%0/2
$self->{'schema'} || $self->username
$self->{'schema'}
$self->username
Truth table0%0/3
A || B
A= $self->{'schema'}B= $self->username
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub use_auto_sequence_name { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
use_auto_sequence_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | sub auto_sequence_name | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto_sequence_name: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my($table) = $args{'table'}; | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | Carp::croak 'Missing table argument' unless(defined $table); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | my($column) = $args{'column'}; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | Carp::croak 'Missing column argument' unless(defined $column); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return uc "${table}_${column}_SEQ"; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | sub build_dsn | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_dsn: called CC=5 SCAR=20.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 9 | my($self_or_class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | ▶ | my $database = $args{'db'} || $args{'database'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args{'db'} || $args{'database'}
MC/DC0%0/2
$args{'db'} || $args{'database'}
$args{'db'}
$args{'database'}
Truth table33%1/3
A || B
A= $args{'db'}B= $args{'database'}
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 9 | ▶ | if($args{'host'} || $args{'port'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"host"} or $args{"port"}
MC/DC0%0/2
$args{"host"} or $args{"port"}
$args{"host"}
$args{"port"}
Truth table33%1/3
A or B
A= $args{"host"}B= $args{"port"}
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 9 | ▶ | if ($args{'service'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $args{'service_name'} = $args{'service'}; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | return 'dbi:Oracle:' . | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | join(';', map { "$_=$args{$_}" } grep { $args{$_} } qw(service_name host port)); | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | else | ||||||||||||||||||||||||||||||||||||||||||
| 153 | { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 9 | $args{'sid'} = $database; | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | return 'dbi:Oracle:' . | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 9 | join(';', map { "$_=$args{$_}" } grep { $args{$_} } qw(sid host port)); | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return "dbi:Oracle:$database"; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub init_date_handler { Rose::DB::Oracle::DateHandler->new } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_date_handler: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | sub database_version | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
database_version: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | return $self->{'database_version'} if (defined $self->{'database_version'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my($version) = $self->dbh->get_info(18); # SQL_DBMS_VER. | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | # Convert to an integer, e.g., 10.02.0100 -> 100020100 | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if($version =~ /^(\d+)\.(\d+)(?:\.(\d+))?/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | { | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $version = sprintf('%d%03d%04d', $1, $2, $3); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return $self->{'database_version'} = $version; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 10 | ▶ | sub dbi_driver { 'Oracle' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dbi_driver: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub likes_uppercase_table_names { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
likes_uppercase_table_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub likes_uppercase_schema_names { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
likes_uppercase_schema_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub likes_uppercase_catalog_names { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
likes_uppercase_catalog_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub likes_uppercase_sequence_names { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
likes_uppercase_sequence_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub insertid_param { '' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insertid_param: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | sub list_tables | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_tables: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | my $types = $args{'include_views'} ? "'TABLE','VIEW'" : 'TABLE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my($error, @tables); | |||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | eval | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | { | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | my($dbh) = $self->dbh or die $self->error; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | local $dbh->{'RaiseError'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | local $dbh->{'FetchHashKeyName'} = 'NAME'; | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $sth = $dbh->table_info($self->catalog, uc $self->schema, '%', $types); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my $info = $sth->fetchall_arrayref({}); # The {} are mandatory. | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | for my $table (@$info) | |||||||||||||||||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | push @tables, $$table{'TABLE_NAME'} if ($$table{'TABLE_NAME'} !~ /^BIN\$.+\$.+/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | Carp::croak 'Could not list tables from ', $self->dsn, " - $error"; | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | return wantarray ? @tables : \@tables; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | sub next_value_in_sequence | ||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_value_in_sequence: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my($self, $sequence_name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | my $dbh = $self->dbh or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my($error, $value); | |||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 241 | { | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | eval | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | { | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | local $dbh->{'PrintError'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | local $dbh->{'RaiseError'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $sth = $dbh->prepare("SELECT $sequence_name.NEXTVAL FROM DUAL"); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $sth->execute; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $value = ${$sth->fetch}[0]; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||
| 252 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | { | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $self->error("Could not get the next value in the sequence $sequence_name - $error"); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | # Tried to execute a CURRVAL command on a sequence before the | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # NEXTVAL command was executed at least once. | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 16 | ▶ | use constant ORA_08002 => 8002; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | sub current_value_in_sequence | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
current_value_in_sequence: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my($self, $sequence_name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $dbh = $self->dbh or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my($error, $value); | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 279 | { | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | eval | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | { | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | local $dbh->{'PrintError'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | local $dbh->{'RaiseError'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my $sth = $dbh->prepare("SELECT $sequence_name.CURRVAL FROM DUAL"); | |||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $sth->execute; | |||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | $value = ${$sth->fetch}[0]; | |||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||
| 293 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | { | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if(DBI->err == ORA_08002) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | { | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | if(defined $self->next_value_in_sequence($sequence_name)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | { | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | return $self->current_value_in_sequence($sequence_name); | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $self->error("Could not get the current value in the sequence $sequence_name - $error"); | |||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | # Sequence does not exist, or the user does not have the required | ||||||||||||||||||||||||||||||||||||||||||
| 316 | # privilege to perform this operation. | ||||||||||||||||||||||||||||||||||||||||||
| 317 | 16 | ▶ | use constant ORA_02289 => 2289; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | sub sequence_exists | ||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sequence_exists: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my($self, $sequence_name) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | my $dbh = $self->dbh or return undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $error; | |||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 328 | { | ||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | eval | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | { | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | local $dbh->{'PrintError'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | local $dbh->{'RaiseError'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $sth = $dbh->prepare("SELECT $sequence_name.CURRVAL FROM DUAL"); | |||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $sth->execute; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | $sth->fetch; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $sth->finish; | |||||||||||||||||||||||||||||||||||||||||
| 339 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | { | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $dbi_error = DBI->err; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if($dbi_error == ORA_08002) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | if(defined $self->next_value_in_sequence($sequence_name)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | { | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return $self->sequence_exists($sequence_name); | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | elsif($dbi_error == ORA_02289) | ||||||||||||||||||||||||||||||||||||||||||
| 356 | { | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $self->error("Could not check if sequence $sequence_name exists - $error"); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | sub parse_dbi_column_info_default | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_dbi_column_info_default: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my($self, $default, $col_info) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | # For some reason, given a default value like this: | ||||||||||||||||||||||||||||||||||||||||||
| 372 | # | ||||||||||||||||||||||||||||||||||||||||||
| 373 | # MYCOLUMN VARCHAR(128) DEFAULT 'foo' NOT NULL | ||||||||||||||||||||||||||||||||||||||||||
| 374 | # | ||||||||||||||||||||||||||||||||||||||||||
| 375 | # DBD::Oracle hands back a COLUMN_DEF value of: | ||||||||||||||||||||||||||||||||||||||||||
| 376 | # | ||||||||||||||||||||||||||||||||||||||||||
| 377 | # $col_info->{'COLUMN_DEF'} = "'foo' "; # WTF? | ||||||||||||||||||||||||||||||||||||||||||
| 378 | # | ||||||||||||||||||||||||||||||||||||||||||
| 379 | # I have no idea why. Anyway, we just want the value between the quotes. | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | return undef unless (defined $default); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $default =~ s/^\s*'(.+)'\s*$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | return $default; | |||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 16 | *is_reserved_word = \&SQL::ReservedWords::Oracle::is_reserved; | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | sub quote_identifier_for_sequence | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_identifier_for_sequence: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my($self, $catalog, $schema, $table) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | return join('.', map { uc } grep { defined } ($schema, $table)); | |||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | # sub auto_quote_column_name | ||||||||||||||||||||||||||||||||||||||||||
| 397 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 398 | # my($self, $name) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 399 | # | ||||||||||||||||||||||||||||||||||||||||||
| 400 | # if($name =~ /[^\w#]/ || $self->is_reserved_word($name)) | ||||||||||||||||||||||||||||||||||||||||||
| 401 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | # return $self->quote_column_name($name, @_); | ||||||||||||||||||||||||||||||||||||||||||
| 403 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | # | ||||||||||||||||||||||||||||||||||||||||||
| 405 | # return $name; | ||||||||||||||||||||||||||||||||||||||||||
| 406 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub supports_schema { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_schema: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | sub max_column_name_length { 30 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_column_name_length: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | sub max_column_alias_length { 30 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_column_alias_length: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | sub quote_column_name | ||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_column_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my $name = uc $_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $name =~ s/"/""/g; | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | return qq("$name"); | |||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | sub quote_table_name | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_table_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my $name = uc $_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $name =~ s/"/""/g; | |||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return qq("$name"); | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | sub quote_identifier { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote_identifier: not called CC=1 SCAR=1.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $method = ref($self)->parent_class . '::quote_identifier'; | |||||||||||||||||||||||||||||||||||||||||
| 430 | 16 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return uc $self->$method(@_); | |||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | sub primary_key_column_names | ||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_key_column_names: not called CC=9 SCAR=41.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | my %args = @_ == 1 ? (table => @_) : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | my $table = $args{'table'} or Carp::croak "Missing table name parameter"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | my $schema = $args{'schema'} || $self->schema; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'schema'} || $self->schema
MC/DC0%0/2
$args{'schema'} || $self->schema
$args{'schema'}
$self->schema
Truth table0%0/3
A || B
A= $args{'schema'}B= $self->schema
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | my $catalog = $args{'catalog'} || $self->catalog; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'catalog'} || $self->catalog
MC/DC0%0/2
$args{'catalog'} || $self->catalog
$args{'catalog'}
$self->catalog
Truth table0%0/3
A || B
A= $args{'catalog'}B= $self->catalog
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 16 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $table = uc $table; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | $schema = uc $schema; | |||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $catalog = uc $catalog; | |||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my $table_unquoted = $self->unquote_table_name($table); | |||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | my($error, $columns); | |||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | TRY: | ||||||||||||||||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | eval | ||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | { | |||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $columns = | |||||||||||||||||||||||||||||||||||||||||
| 460 | $self->_get_primary_key_column_names($catalog, $schema, $table_unquoted); | ||||||||||||||||||||||||||||||||||||||||||
| 461 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if($error || !$columns) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$error or not $columns
MC/DC0%0/2
$error or not $columns
$error
not $columns
Truth table0%0/3
A or not(B)
A= $errorB= not $columns
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | { | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 16 | ▶ | no warnings 'uninitialized'; # undef strings okay | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | ▶ | $error = 'no primary key columns found' unless(defined $error); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | Carp::croak "Could not get primary key columns for catalog '" . | |||||||||||||||||||||||||||||||||||||||||
| 471 | $catalog . "' schema '" . $schema . "' table '" . | ||||||||||||||||||||||||||||||||||||||||||
| 472 | $table_unquoted . "' - " . $error; | ||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | return wantarray ? @$columns : $columns; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | sub format_limit_with_offset | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_limit_with_offset: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my($self, $limit, $offset, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | delete $args->{'limit'}; | |||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | delete $args->{'offset'}; | |||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | if($offset) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | { | ||||||||||||||||||||||||||||||||||||||||||
| 487 | # http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html | ||||||||||||||||||||||||||||||||||||||||||
| 488 | # select * | ||||||||||||||||||||||||||||||||||||||||||
| 489 | # from ( select /*+ FIRST_ROWS(n) */ | ||||||||||||||||||||||||||||||||||||||||||
| 490 | # a.*, ROWNUM rnum | ||||||||||||||||||||||||||||||||||||||||||
| 491 | # from ( your_query_goes_here, | ||||||||||||||||||||||||||||||||||||||||||
| 492 | # with order by ) a | ||||||||||||||||||||||||||||||||||||||||||
| 493 | # where ROWNUM <= | ||||||||||||||||||||||||||||||||||||||||||
| 494 | # :MAX_ROW_TO_FETCH ) | ||||||||||||||||||||||||||||||||||||||||||
| 495 | # where rnum >= :MIN_ROW_TO_FETCH; | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $size = $limit; | |||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $start = $offset + 1; | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $end = $start + $size - 1; | |||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $n = $offset + $limit; | |||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $args->{'limit_prefix'} = | |||||||||||||||||||||||||||||||||||||||||
| 503 | "SELECT * FROM (SELECT /*+ FIRST_ROWS($n) */\na.*, ROWNUM oracle_rownum FROM ("; | ||||||||||||||||||||||||||||||||||||||||||
| 504 | #"SELECT * FROM (SELECT a.*, ROWNUM oracle_rownum FROM ("; | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $args->{'limit_suffix'} = | |||||||||||||||||||||||||||||||||||||||||
| 507 | ") a WHERE ROWNUM <= $end) WHERE oracle_rownum >= $start"; | ||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | else | ||||||||||||||||||||||||||||||||||||||||||
| 510 | { | ||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $args->{'limit_prefix'} = "SELECT /*+ FIRST_ROWS($limit) */ a.* FROM ("; | |||||||||||||||||||||||||||||||||||||||||
| 512 | #$args->{'limit_prefix'} = "SELECT a.* FROM ("; | ||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | $args->{'limit_suffix'} = ") a WHERE ROWNUM <= $limit"; | |||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | sub format_select_lock | ||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_select_lock: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | my($self, $class, $lock, $tables) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | $lock = { type => $lock } unless(ref $lock); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | $lock->{'type'} ||= 'for update' if($lock->{'for_update'}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$lock->{"type"} ||= "for update"
MC/DC0%0/1
$lock->{"type"} ||= "for update"
$lock->{"type"}
Truth table0%0/2
A
A= $lock->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | unless($lock->{'type'} eq 'for update') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | { | ||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | Carp::croak "Invalid lock type: $lock->{'type'}"; | |||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my $sql = 'FOR UPDATE'; | |||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | my @columns; | |||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if(my $on = $lock->{'on'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | { | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | @columns = map { $self->column_sql_from_lock_on_value($class, $_, $tables) } @$on; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | elsif(my $columns = $lock->{'columns'}) | ||||||||||||||||||||||||||||||||||||||||||
| 539 | { | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my %map; | |||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | if($tables) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | { | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | my $tn = 1; | |||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | foreach my $table (@$tables) | |||||||||||||||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | (my $table_key = $table) =~ s/^(["']?)[^.]+\1\.//; | |||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $map{$table_key} = 't' . $tn++; | |||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||||||
| 553 | @columns = map | ||||||||||||||||||||||||||||||||||||||||||
| 554 | { | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ref $_ eq 'SCALAR' ? $$_ : | |||||||||||||||||||||||||||||||||||||||||
| 556 | /^([^.]+)\.([^.]+)$/ ? | ||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | $self->auto_quote_column_with_table($2, defined $map{$1} ? $map{$1} : $1) : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | $self->auto_quote_column_name($_) | ||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | @$columns; | ||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if(@columns) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | { | ||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $sql .= ' OF ' . join(', ', @columns); | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | if($lock->{'nowait'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | { | ||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $sql .= ' NOWAIT'; | |||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||
| 572 | elsif(my $wait = $lock->{'wait'}) | ||||||||||||||||||||||||||||||||||||||||||
| 573 | { | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $sql .= " WAIT $wait"; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | if($lock->{'skip_locked'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | { | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $sql .= ' SKIP LOCKED'; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | return $sql; | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | sub format_boolean_char { $_[1] ? 't' : 'f' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_boolean_char: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | sub format_boolean_numeric { $_[1] ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_boolean_numeric: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 16 | ▶ | BEGIN { *format_boolean = \&format_boolean_char } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | # | ||||||||||||||||||||||||||||||||||||||||||
| 591 | # Date/time keywords and inlining | ||||||||||||||||||||||||||||||||||||||||||
| 592 | # | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | sub validate_date_keyword | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_date_keyword: not called CC=3 SCAR=19.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 596 | 16 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | $_[1] =~ /^(?:CURRENT_|SYS|LOCAL)(?:TIMESTAMP|DATE)$/i || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$_[1] =~ /^(?:CURRENT_|SYS|LOCAL)(?:TIMESTAMP|DATE)$/i || $_[0]->keyword_function_calls && $_[1] =~ /^\w+\(.*\)$/
$_[0]->keyword_function_calls and $_[1] =~ /^\w+\(.*\)$/
MC/DC0%0/3
$_[1] =~ /^(?:CURRENT_|SYS|LOCAL)(?:TIMESTAMP|DATE)$/i || $_[0]->keyword_function_calls && $_[1] =~ /^\w+\(.*\)$/
$_[1] =~ /^(?:CURRENT_|SYS|LOCAL)(?:TIMESTAMP|DATE)$/i
$_[0]->keyword_function_calls
$_[1] =~ /^\w+\(.*\)$/
Truth table0%0/4
A || B and C
A= $_[1] =~ /^(?:CURRENT_|SYS|LOCAL)(?:TIMESTAMP|DATE)$/iB= $_[0]->keyword_function_callsC= $_[1] =~ /^\w+\(.*\)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | ($_[0]->keyword_function_calls && $_[1] =~ /^\w+\(.*\)$/); | ||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 16 | *validate_time_keyword = \&validate_date_keyword; | |||||||||||||||||||||||||||||||||||||||||
| 602 | 16 | *validate_timestamp_keyword = \&validate_date_keyword; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 16 | *validate_datetime_keyword = \&validate_date_keyword; | |||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | sub should_inline_date_keyword { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
should_inline_date_keyword: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | sub should_inline_datetime_keyword { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
should_inline_datetime_keyword: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | sub should_inline_time_keyword { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
should_inline_time_keyword: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | sub should_inline_timestamp_keyword { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
should_inline_timestamp_keyword: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | package Rose::DB::Oracle::DateHandler; | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | 16 | ▶ | use Rose::Object; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 16 | our @ISA = qw(Rose::Object); | |||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | 16 | ▶ | use DateTime::Format::Oracle; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | sub parse_date | ||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_date: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | my($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | local $DateTime::Format::Oracle::nls_date_format = $ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
MC/DC0%0/1
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
$ENV{'NLS_DATE_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_DATE_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | # Add or extend the time to appease DateTime::Format::Oracle | ||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | ▶ | if($value =~ /\d\d:/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 625 | { | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | $value =~ s/( \d\d:\d\d)([^:]|$)/$1:00$2/; | |||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||
| 628 | else | ||||||||||||||||||||||||||||||||||||||||||
| 629 | { | ||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | $value .= ' 00:00:00'; | |||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | return DateTime::Format::Oracle->parse_date($value); | |||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 16 | *parse_datetime = \&parse_date; | |||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | sub parse_timestamp | ||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_timestamp: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | my($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | local $DateTime::Format::Oracle::nls_timestamp_format = | ||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | ▶ | $ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
$ENV{'NLS_TIMESTAMP_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_TIMESTAMP_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | # Add, extend, or truncate fractional seconds to appease DateTime::Format::Oracle | ||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | for($value) | |||||||||||||||||||||||||||||||||||||||||
| 647 | { | ||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ or s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
MC/DC0%0/2
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ or s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/
s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
Truth table0%0/3
A or B
A= s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/B= s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/ "$1$2" . ('0' x (6 - length($2))) . $3/e || | |||||||||||||||||||||||||||||||||||||||||
| 650 | s/( \d\d:\d\d:\d\d\.\d{6})\d+/$1/; | ||||||||||||||||||||||||||||||||||||||||||
| 651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | return DateTime::Format::Oracle->parse_timestamp($value); | |||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | sub parse_timestamp_with_time_zone | ||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_timestamp_with_time_zone: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | my($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | local $DateTime::Format::Oracle::nls_timestamp_tz_format = | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | ▶ | $ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||
| 663 | # Add, extend, or truncate fractional seconds to appease DateTime::Format::Oracle | ||||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | for($value) | |||||||||||||||||||||||||||||||||||||||||
| 665 | { | ||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | ▶ | s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ or s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
MC/DC0%0/2
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/ or s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/
s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
Truth table0%0/3
A or B
A= s/( \d\d:\d\d:\d\d)(?!\.)/$1.000000/B= s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/"$1$2" . 0 x (6 - length($2)) . $3;/e
| |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | s/( \d\d:\d\d:\d\d\.)(\d{1,5})(\D|$)/ "$1$2" . ('0' x (6 - length($2))) . $3/e || | |||||||||||||||||||||||||||||||||||||||||
| 668 | s/( \d\d:\d\d:\d\d\.\d{6})\d+/$1/; | ||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | return DateTime::Format::Oracle->parse_timestamp_with_time_zone($value); | |||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | sub format_date | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_date: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | local $DateTime::Format::Oracle::nls_date_format = | ||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | ▶ | $ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
MC/DC0%0/1
$ENV{'NLS_DATE_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS'
$ENV{'NLS_DATE_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_DATE_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | return DateTime::Format::Oracle->format_date(@_); | |||||||||||||||||||||||||||||||||||||||||
| 682 | } | ||||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||
| 684 | 16 | *format_datetime = \&format_date; | |||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||
| 686 | sub format_timestamp | ||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_timestamp: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | local $DateTime::Format::Oracle::nls_timestamp_format = | ||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | ▶ | $ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF'
$ENV{'NLS_TIMESTAMP_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_TIMESTAMP_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | return DateTime::Format::Oracle->format_timestamp(@_); | |||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | sub format_timestamp_with_time_zone | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format_timestamp_with_time_zone: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | my($self) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||
| 700 | local $DateTime::Format::Oracle::nls_timestamp_tz_format = | ||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | $ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
MC/DC0%0/1
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'} || 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
$ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
Truth table0%0/2
A
A= $ENV{'NLS_TIMESTAMP_TZ_FORMAT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | return DateTime::Format::Oracle->format_timestamp_with_time_zone(@_); | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | 16 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | __END__ | ||||||||||||||||||||||||||||||||||||||||||