Re: How to call DBD::Oracle's dbms_output_get from within a DBIx



On Thu, Feb 22, 2007 at 09:12:14AM +0000, Martin Evans wrote:
Tim Bunce wrote:
On Wed, Feb 21, 2007 at 04:25:54PM +0000, Martin J. Evans wrote:
Hi,

I have DBIx::Log4perl which is currently connected to a DBD::Oracle. In
DBIx::Log4perl::st::execute I want to call DBD::Oracle's dbms_get_line
which is usually (from applications) called like this:

@lines = $dbh->func('dbms_output_get');

As I'm in st::execute I have a $sth and can get hold of a $dbh.

I'd expect this to work:

$dbh = $sth->FETCH('Database');
@lines = $dbh->func('dbms_output_get');

Thanks Tim, but that does not appear to work. In my
DBIx::Log4perl::execute method I now have (simplified):

sub execute {
my ($sth, @args) = @_;

my $ret = $sth->SUPER::execute(@args);

my $dbh = $sth->FETCH('Database');
my @d = $dbh->func('dbms_output_get');

return $ret;
}

and I still get

Deep recursion on subroutine "DBD::Oracle::db::dbms_output_get"

dbms_output_get does create a new statement, prepare and execute it and
it appears when execute is called it ends up back in my
DBIx::Log4perl::execute method. I don't understand why this happens :-(

Ah. Of course. Why would you except it not to happen? ;-)

dbms_output_get calls execute() on a statement handle created from your
subclassed dbh handle. So your DBIx::Log4perl::st::execute will be
called when dbms_output_get calls the execute method.

You need to either use a separate non-DBIx::Log4perl dbh for the
dbms_output_get call, or try something more hackish like

my @d = $dbh->func('dbms_output_get')
unless $sth->{Statement} =~ /^begin dbms_output.get_line/;

Tim.
.



Relevant Pages

  • Re: Extremely poor execute performance
    ... Copying a table from one tablespace to another tablespace (two $dbh handles). ... Basically, most executes finish in milliseconds, but randomly, the execute holds for 30 seconds, almost dead on. ... If you run apex you can often see the resmgr:wait quantum events with a time under the monitor->wait page. ...
    (perl.dbi.users)
  • Extremely poor execute performance
    ... Copying a table from one tablespace to another tablespace (two $dbh handles). ... commit every 100 rows ... Basically, most executes finish in milliseconds, but randomly, the execute holds for 30 seconds, almost dead on. ...
    (perl.dbi.users)
  • Connecting to a non-localhost Mysql with Ruby-DBI
    ... I'm using DBI 0.0.23 on Slackware 10 and trying to connect to Mysql ... running on another server. ... dbh = DBI.connect( ...
    (comp.lang.ruby)
  • Requested Registry Access is Not Allowed
    ... We have several applications that will be executing on multiple machines. ... will execute the apps. ... There are Permission Sets within the framework configuration tool, ... The app fails on the WriteEntry and the exception that is thrown is ...
    (microsoft.public.dotnet.framework)
  • RE: Requested Registry Access is Not Allowed
    ... > We have several applications that will be executing on multiple machines. ... > will execute the apps. ... > There are Permission Sets within the framework configuration tool, ... > machine that the app will run. ...
    (microsoft.public.dotnet.framework)