use Try::Tiny;
use namespace::clean;
+__PACKAGE__->sql_limit_dialect ('RowNum');
+
=head1 NAME
DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class
my $rs = $schema->resultset('Person')->search({},
{
'start_with' => { 'firstname' => 'foo', 'lastname' => 'bar' },
- 'connect_by' => { 'parentid' => { '-prior' => \'persionid' },
+ 'connect_by' => { 'parentid' => { '-prior' => { -ident => 'personid' } },
'order_siblings_by' => { -asc => 'name' },
};
);
# START WITH
# firstname = 'foo' and lastname = 'bar'
# CONNECT BY
- # parentid = prior persionid
+ # parentid = prior personid
# ORDER SIBLINGS BY
# firstname ASC
use base qw/DBIx::Class::Storage::DBI/;
use mro 'c3';
-__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::Oracle');
+__PACKAGE__->sql_maker_class('DBIx::Class::SQLMaker::Oracle');
sub deployment_statements {
my $self = shift;;
my ( $schema, $table ) = $source_name =~ /(\w+)\.(\w+)/;
my ($sql, @bind) = $sql_maker->select (
'ALL_TRIGGERS',
- ['trigger_body'],
+ ['trigger_body', 'table_owner'],
{
$schema ? (owner => $schema) : (),
table_name => $table || $source_name,
my $sth = $dbh->prepare($sql);
$sth->execute (@bind);
- while (my ($insert_trigger) = $sth->fetchrow_array) {
- return $1 if $insert_trigger =~ m!("?\w+"?)\.nextval!i; # col name goes here???
+ while (my ($insert_trigger, $schema) = $sth->fetchrow_array) {
+ my ($seq_name) = $insert_trigger =~ m/("?[.\w"]+"?)\.nextval .+ into \s+ :new\.$col/xmsi;
+
+ next unless $seq_name;
+
+ if ($seq_name !~ /\./) {
+ $seq_name = join '.' => $schema, $seq_name;
+ }
+
+ return $seq_name;
}
- $self->throw_exception("Unable to find a sequence INSERT trigger on table '$source_name'.");
+ $self->throw_exception("Unable to find a sequence %INSERT% trigger on table '$source_name'.");
}
sub _sequence_fetch {