in reply to Re^5: latency and round-trips
in thread DBI Queries take half an hour

Thanks for that insight. Refering back to my post above, "will fetchall_arrayref affect clobs?".... I have tried the following code:
sub get_all_data{ my $max_rows = 5000; while (my $aref = $sth2->fetchall_arrayref(undef, $max_rows)) { $struct = $dbh_ideas->ora_lob_read(@$aref[1],1,65536); push @$raResults, [ $aref[0],$struct ]; }; return $raResults; }

Then later:

$p = Project->new_project($id); $cursor = $p->get_all_data; foreach my $row (@$cursor){ print OUTPUT do{ local $" = qq{\t}; qq{$row->[1]\$\$\$\$\n}; } if defined $row->[1]; }

My output file doesnt get written, but equally doesnt die either. I get a "locator is not of type OCILobLocatorPtr at Project.pm line 146." error message. It is something to do with ora_lob_read - does anyone know the syntax for this situation? Thanks

Replies are listed 'Best First'.
Re^7: latency and round-trips
by Corion (Patriarch) on Dec 17, 2008 at 15:42 UTC

    Curiously enough, this exact error message is mentioned in DBD::Oracle. As I don't have Oracle myself, I can't be of much more assistance, but maybe Google can help you better, if the documentation doesn't.

Re^7: latency and round-trips
by techcode (Hermit) on Dec 18, 2008 at 12:35 UTC
    While I do lack knowledge with Oracle and obviously your system/implementation - I don't get it why don't you just do something like:
    sub get_all_data{ return $sth2->fetchall_arrayref(); } $p = Project->new_project($id); $cursor = $p->get_all_data(); $| = 1; # to turn on autoflush (turn off print/output cashing) foreach my $row (@$cursor){ print OUTPUT do{ local $" = qq{\t}; qq{$row->[1]\$\$\$\$\n}; } if defined $row->[1]; }

    The part inside do{} is something I see for the first time, so I'm not sure if you are trying to output a TAB separated file? In particular I'm not sure what does "qq{$row->[1]\$\$\$\$\n};" do?

    Also speaking in general - mixing OOP (Project.pm ...etc) and non-OOP (global $sth2 value) is usually not a good thing. IMHO you should keep consistency - pick one and stick with it.


    Have you tried freelancing/outsourcing? Check out Scriptlance - I work there since 2003. For more info about Scriptlance and freelancing in general check out my home node.