.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DBIx::Class::Storage::DBI::Oracle::Generic 3pm" .TH DBIx::Class::Storage::DBI::Oracle::Generic 3pm "2022-05-21" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DBIx::Class::Storage::DBI::Oracle::Generic \- Oracle Support for DBIx::Class .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& # In your result (table) classes \& use base \*(AqDBIx::Class::Core\*(Aq; \& _\|_PACKAGE_\|_\->add_columns({ id => { sequence => \*(Aqmysequence\*(Aq, auto_nextval => 1 } }); \& _\|_PACKAGE_\|_\->set_primary_key(\*(Aqid\*(Aq); \& \& # Somewhere in your Code \& # add some data to a table with a hierarchical relationship \& $schema\->resultset(\*(AqPerson\*(Aq)\->create ({ \& firstname => \*(Aqfoo\*(Aq, \& lastname => \*(Aqbar\*(Aq, \& children => [ \& { \& firstname => \*(Aqchild1\*(Aq, \& lastname => \*(Aqbar\*(Aq, \& children => [ \& { \& firstname => \*(Aqgrandchild\*(Aq, \& lastname => \*(Aqbar\*(Aq, \& } \& ], \& }, \& { \& firstname => \*(Aqchild2\*(Aq, \& lastname => \*(Aqbar\*(Aq, \& }, \& ], \& }); \& \& # select from the hierarchical relationship \& my $rs = $schema\->resultset(\*(AqPerson\*(Aq)\->search({}, \& { \& \*(Aqstart_with\*(Aq => { \*(Aqfirstname\*(Aq => \*(Aqfoo\*(Aq, \*(Aqlastname\*(Aq => \*(Aqbar\*(Aq }, \& \*(Aqconnect_by\*(Aq => { \*(Aqparentid\*(Aq => { \*(Aq\-prior\*(Aq => { \-ident => \*(Aqpersonid\*(Aq } }, \& \*(Aqorder_siblings_by\*(Aq => { \-asc => \*(Aqname\*(Aq }, \& }; \& ); \& \& # this will select the whole tree starting from person "foo bar", creating \& # following query: \& # SELECT \& # me.persionid me.firstname, me.lastname, me.parentid \& # FROM \& # person me \& # START WITH \& # firstname = \*(Aqfoo\*(Aq and lastname = \*(Aqbar\*(Aq \& # CONNECT BY \& # parentid = prior personid \& # ORDER SIBLINGS BY \& # firstname ASC .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class implements base Oracle support. The subclass DBIx::Class::Storage::DBI::Oracle::WhereJoins is for \f(CW\*(C`(+)\*(C'\fR joins in Oracle versions before 9.0. .SH "METHODS" .IX Header "METHODS" .SS "get_autoinc_seq" .IX Subsection "get_autoinc_seq" Returns the sequence name for an autoincrement column .SS "datetime_parser_type" .IX Subsection "datetime_parser_type" This sets the proper DateTime::Format module for use with DBIx::Class::InflateColumn::DateTime. .SS "connect_call_datetime_setup" .IX Subsection "connect_call_datetime_setup" Used as: .PP .Vb 1 \& on_connect_call => \*(Aqdatetime_setup\*(Aq .Ve .PP In connect_info 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. .PP Maximum allowable precision is used, unless the environment variables have already been set. .PP These are the defaults used: .PP .Vb 3 \& $ENV{NLS_DATE_FORMAT} ||= \*(AqYYYY\-MM\-DD HH24:MI:SS\*(Aq; \& $ENV{NLS_TIMESTAMP_FORMAT} ||= \*(AqYYYY\-MM\-DD HH24:MI:SS.FF\*(Aq; \& $ENV{NLS_TIMESTAMP_TZ_FORMAT} ||= \*(AqYYYY\-MM\-DD HH24:MI:SS.FF TZHTZM\*(Aq; .Ve .PP To get more than second precision with DBIx::Class::InflateColumn::DateTime for your timestamps, use something like this: .PP .Vb 2 \& use Time::HiRes \*(Aqtime\*(Aq; \& my $ts = DateTime\->from_epoch(epoch => time); .Ve .SS "relname_to_table_alias" .IX Subsection "relname_to_table_alias" DBIx::Class uses DBIx::Class::Relationship names as table aliases in queries. .PP 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 \&\s-1MD5\s0 hash. .PP See \*(L"relname_to_table_alias\*(R" in DBIx::Class::Storage::DBI. .SS "with_deferred_fk_checks" .IX Subsection "with_deferred_fk_checks" Runs a coderef between: .PP .Vb 3 \& alter session set constraints = deferred \& ... \& alter session set constraints = immediate .Ve .PP to defer foreign key checks. .PP Constraints must be declared \f(CW\*(C`DEFERRABLE\*(C'\fR for this to work. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" Following additional attributes can be used in resultsets. .SS "connect_by or connect_by_nocycle" .IX Subsection "connect_by or connect_by_nocycle" .IP "Value: \e%connect_by" 4 .IX Item "Value: %connect_by" .PP A hashref of conditions used to specify the relationship between parent rows and child rows of the hierarchy. .PP .Vb 1 \& connect_by => { parentid => \*(Aqprior personid\*(Aq } \& \& # adds a connect by statement to the query: \& # SELECT \& # me.persionid me.firstname, me.lastname, me.parentid \& # FROM \& # person me \& # CONNECT BY \& # parentid = prior persionid \& \& \& connect_by_nocycle => { parentid => \*(Aqprior personid\*(Aq } \& \& # adds a connect by statement to the query: \& # SELECT \& # me.persionid me.firstname, me.lastname, me.parentid \& # FROM \& # person me \& # CONNECT BY NOCYCLE \& # parentid = prior persionid .Ve .SS "start_with" .IX Subsection "start_with" .IP "Value: \e%condition" 4 .IX Item "Value: %condition" .PP A hashref of conditions which specify the root row(s) of the hierarchy. .PP It uses the same syntax as \*(L"search\*(R" in DBIx::Class::ResultSet .PP .Vb 1 \& start_with => { firstname => \*(AqFoo\*(Aq, lastname => \*(AqBar\*(Aq } \& \& # SELECT \& # me.persionid me.firstname, me.lastname, me.parentid \& # FROM \& # person me \& # START WITH \& # firstname = \*(Aqfoo\*(Aq and lastname = \*(Aqbar\*(Aq \& # CONNECT BY \& # parentid = prior persionid .Ve .SS "order_siblings_by" .IX Subsection "order_siblings_by" .IP "Value: ($order_siblings_by | \e@order_siblings_by)" 4 .IX Item "Value: ($order_siblings_by | @order_siblings_by)" .PP Which column(s) to order the siblings by. .PP It uses the same syntax as \*(L"order_by\*(R" in DBIx::Class::ResultSet .PP .Vb 1 \& \*(Aqorder_siblings_by\*(Aq => \*(Aqfirstname ASC\*(Aq \& \& # SELECT \& # me.persionid me.firstname, me.lastname, me.parentid \& # FROM \& # person me \& # CONNECT BY \& # parentid = prior persionid \& # ORDER SIBLINGS BY \& # firstname ASC .Ve .SH "FURTHER QUESTIONS?" .IX Header "FURTHER QUESTIONS?" Check the list of additional \s-1DBIC\s0 resources. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This module is free software copyright by the DBIx::Class (\s-1DBIC\s0) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class library.