NAME
DBIO::Oracle::Storage - Oracle Support for DBIO
VERSION
version 0.900000
SYNOPSIS
# In your result (table) classes
use base 'DBIO::Core';
__PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } });
__PACKAGE__->set_primary_key('id');
# Somewhere in your Code
# add some data to a table with a hierarchical relationship
$schema->resultset('Person')->create ({
firstname => 'foo',
lastname => 'bar',
children => [
{
firstname => 'child1',
lastname => 'bar',
children => [
{
firstname => 'grandchild',
lastname => 'bar',
}
],
},
{
firstname => 'child2',
lastname => 'bar',
},
],
});
# select from the hierarchical relationship
my $rs = $schema->resultset('Person')->search({},
{
'start_with' => { 'firstname' => 'foo', 'lastname' => 'bar' },
'connect_by' => { 'parentid' => { '-prior' => { -ident => 'personid' } },
'order_siblings_by' => { -asc => 'name' },
};
);
# 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 = 'foo' and lastname = 'bar'
# CONNECT BY
# parentid = prior personid
# ORDER SIBLINGS BY
# firstname ASC
DESCRIPTION
This class implements base Oracle support. The subclass DBIO::Oracle::Storage::WhereJoins is for (+) joins in Oracle versions before 9.0.
METHODS
relname_to_table_alias
DBIO uses DBIO::Relationship names as table aliases in queries.
Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so the DBIO::Relationship name is shortened and appended with half of an MD5 hash.
See "relname_to_table_alias" in DBIO::Storage::DBI.
connect_by or connect_by_nocycle
A hashref of conditions used to specify the relationship between parent rows and child rows of the hierarchy.
connect_by => { parentid => 'prior personid' }
# 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 => 'prior personid' }
# 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
start_with
A hashref of conditions which specify the root row(s) of the hierarchy.
It uses the same syntax as "search" in DBIO::ResultSet
start_with => { firstname => 'Foo', lastname => 'Bar' }
# SELECT
# me.persionid me.firstname, me.lastname, me.parentid
# FROM
# person me
# START WITH
# firstname = 'foo' and lastname = 'bar'
# CONNECT BY
# parentid = prior persionid
order_siblings_by
Which column(s) to order the siblings by.
It uses the same syntax as "order_by" in DBIO::ResultSet
'order_siblings_by' => 'firstname ASC'
# SELECT
# me.persionid me.firstname, me.lastname, me.parentid
# FROM
# person me
# CONNECT BY
# parentid = prior persionid
# ORDER SIBLINGS BY
# firstname ASC
ATTRIBUTES
Following additional attributes can be used in resultsets.
SEE ALSO
DBIO::Oracle - Oracle schema component
DBIO::Oracle::SQLMaker - Oracle SQL dialect
DBIO::Oracle::Storage::WhereJoins - WHERE-clause join support for Oracle < 9
DBIO::Storage::DBI - Base DBI storage class
AUTHOR
DBIO & DBIx::Class Authors
COPYRIGHT AND LICENSE
Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.