| 1 | package DBIx::dbMan::Extension::DescribeCompleteOracle; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base 'DBIx::dbMan::Extension'; | ||
| 5 | |||
| 6 | our $VERSION = '0.04'; | ||
| 7 | |||
| 8 | 1; | ||
| 9 | |||
| 10 | sub IDENTIFICATION { return "000001-000049-000004"; } | ||
| 11 | |||
| 12 | sub preference { return 1000; } | ||
| 13 | |||
| 14 | sub known_actions { return [ qw/DESCRIBE/ ]; } | ||
| 15 | |||
| 16 | sub handle_action { | ||
| 17 | my ($obj,%action) = @_; | ||
| 18 | |||
| 19 | if ($action{action} eq 'DESCRIBE' and $action{oper} eq 'complete' and $obj->{-dbi}->driver eq 'Oracle') { | ||
| 20 | $action{action} = 'CACHE'; | ||
| 21 | $action{cache_type} = 'describe_ora'; | ||
| 22 | |||
| 23 | unless ($obj->{-dbi}->current) { | ||
| 24 | $obj->{-interface}->error("No current connection selected."); | ||
| 25 | return %action; | ||
| 26 | } | ||
| 27 | my $sth = $obj->{-dbi}->prepare(q!SELECT object_name FROM user_objects WHERE object_type IN ('TABLE','VIEW')!); | ||
| 28 | $sth->execute(); | ||
| 29 | my $ret = $sth->fetchall_arrayref(); | ||
| 30 | my @all = (); | ||
| 31 | @all = map { $_->[0] } @$ret if defined $ret; | ||
| 32 | $sth->finish; | ||
| 33 | $action{list} = \@all; | ||
| 34 | $action{what} = 'list'; | ||
| 35 | $action{processed} = 1; | ||
| 36 | return %action; | ||
| 37 | } | ||
| 38 | |||
| 39 | $action{processed} = 1; | ||
| 40 | return %action; | ||
| 41 | } |