NAME
DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class
SYNOPSIS
# In your result (table) classes
use base 'DBIx::Class::Core';
__PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } });
__PACKAGE__->set_primary_key('id');
__PACKAGE__->sequence('mysequence');
DESCRIPTION
This class implements base Oracle support. The subclass DBIx::Class::Storage::DBI::Oracle::WhereJoins is for (+)
joins in Oracle versions before 9.
METHODS
get_autoinc_seq
Returns the sequence name for an autoincrement column
columns_info_for
This wraps the superclass version of this method to force table names to uppercase
datetime_parser_type
This sets the proper DateTime::Format module for use with DBIx::Class::InflateColumn::DateTime.
connect_call_datetime_setup
Used as:
on_connect_call => 'datetime_setup'
In "connect_info" in DBIx::Class::Storage::DBI to set the session nls date, and timestamp values for use with DBIx::Class::InflateColumn::DateTime and the necessary environment variables for DateTime::Format::Oracle, which is used by it.
Maximum allowable precision is used, unless the environment variables have already been set.
These are the defaults used:
$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';
To get more than second precision with DBIx::Class::InflateColumn::DateTime for your timestamps, use something like this:
use Time::HiRes 'time';
my $ts = DateTime->from_epoch(epoch => time);
source_bind_attributes
Handle LOB types in Oracle. Under a certain size (4k?), you can get away with the driver assuming your input is the deprecated LONG type if you encode it as a hex string. That ain't gonna fly at larger values, where you'll discover you have to do what this does.
This method had to be overridden because we need to set ora_field to the actual column, and that isn't passed to the call (provided by Storage) to bind_attribute_by_data_type.
According to DBD::Oracle, the ora_field isn't always necessary, but adding it doesn't hurt, and will save your bacon if you're modifying a table with more than one LOB column.
relname_to_table_alias
DBIx::Class uses DBIx::Class::Relationship names as table aliases in queries.
Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so the DBIx::Class::Relationship name is shortened and appended with half of an MD5 hash.
See "relname_to_table_alias" in DBIx::Class::Storage.
AUTHOR
See "CONTRIBUTORS" in DBIx::Class.
LICENSE
You may distribute this code under the same terms as Perl itself.