| 1 | package DBIO::Oracle::Storage::ConnectSetup; | ||||||||||||
| 2 | # ABSTRACT: Oracle session NLS setup on connect | ||||||||||||
| 3 | |||||||||||||
| 4 | 23 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 23 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 23 | our $VERSION = '0.900007'; | |||||||||||
| 8 | |||||||||||||
| 9 | |||||||||||||
| 10 | # The seam: core runs _apply_connection_schema first on every new connection, | ||||||||||||
| 11 | # the synchronous one (_run_connection_actions) and the pool connection | ||||||||||||
| 12 | # (_run_pool_connect_actions) alike, before the user's on_connect_call and | ||||||||||||
| 13 | # on_connect_do. Their own ALTER SESSION therefore wins over this default. | ||||||||||||
| 14 | 3 | ▶ | sub _apply_connection_schema { | ||||||||||
|
Subroutine
_apply_connection_schema: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 3 | my $self = shift; | |||||||||||
| 16 | 3 | $self->connect_call_datetime_setup; | |||||||||||
| 17 | 3 | return $self->next::method(@_); | |||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 5 | ▶ | sub connect_call_datetime_setup { | ||||||||||
|
Subroutine
connect_call_datetime_setup: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 21 | 5 | my $self = shift; | |||||||||||
| 22 | 5 | ▶ | my $date_format = $ENV{NLS_DATE_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS'; | ||||||||||
|
Condition100%2/2
$ENV{"NLS_DATE_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS"
MC/DC100%1/1
$ENV{"NLS_DATE_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS"
$ENV{"NLS_DATE_FORMAT"}
Truth table100%2/2
A
A= $ENV{"NLS_DATE_FORMAT"}
| |||||||||||||
| 23 | 5 | ▶ | my $timestamp_format = $ENV{NLS_TIMESTAMP_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS.FF'; | ||||||||||
|
Condition100%2/2
$ENV{"NLS_TIMESTAMP_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS.FF"
MC/DC100%1/1
$ENV{"NLS_TIMESTAMP_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS.FF"
$ENV{"NLS_TIMESTAMP_FORMAT"}
Truth table100%2/2
A
A= $ENV{"NLS_TIMESTAMP_FORMAT"}
| |||||||||||||
| 24 | 5 | ▶ | my $timestamp_tz_format = $ENV{NLS_TIMESTAMP_TZ_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'; | ||||||||||
|
Condition100%2/2
$ENV{"NLS_TIMESTAMP_TZ_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS.FF TZHTZM"
MC/DC100%1/1
$ENV{"NLS_TIMESTAMP_TZ_FORMAT"} ||= "YYYY-MM-DD HH24:MI:SS.FF TZHTZM"
$ENV{"NLS_TIMESTAMP_TZ_FORMAT"}
Truth table100%2/2
A
A= $ENV{"NLS_TIMESTAMP_TZ_FORMAT"}
| |||||||||||||
| 25 | 5 | $self->_do_query("alter session set nls_date_format = '$date_format'"); | |||||||||||
| 26 | 5 | $self->_do_query("alter session set nls_timestamp_format = '$timestamp_format'"); | |||||||||||
| 27 | 5 | $self->_do_query("alter session set nls_timestamp_tz_format='$timestamp_tz_format'"); | |||||||||||
| 28 | 5 | $self->_do_query(q{alter session set nls_numeric_characters = '.,'}); | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 23 | 1; | |||||||||||
| 32 | |||||||||||||
| 33 | __END__ | ||||||||||||