Re: Oraperl and Oracle 7.1

From: Tim Bunce <Tim.Bunce_at_ig.co.uk>
Date: Thu, 2 Mar 1995 18:51:47 +0000
Message-ID: <D4ttqB.L33_at_ig.co.uk>


In article <199503011400.PAA00207_at_nova.auspex.fr>, Kevin Stock <kstock_at_auspex.fr> wrote:
>Hello Bill,
>
>>A quickie (I hope): Has oraperl been successfully built against Oracle
>>7.1.x, specifically on HP-UX 9.04 by anyone out there?
>
>I know that Oraperl has been built with Oracle 7.1, but I'm getting reports
>of a 'fetch out of sequence' error that I don't understand, and unfortunately
>can't work on unless I manage to get Oracle access back again.
>

The DBperl archive on ftp.demon.co.uk contains the file

  /pub/perl/db/perl4/oraperl/oracle7.note10.oracle71.fetch_seq

which describes a fix worked out by Mike Grapevine <grape_at_suned1.nswses.navy.mil>

In essence just change:

      || (osql3(csr->csr, stmt, -1) != 0) to:

      || (oparse(csr->csr, stmt, -1, 1, 2) != 0)

in orafns.c (but you might want to change the last two parameters).

>>[...]
>>Thanks!
>>
>>(BTW, we're chomping at the bit to use Perl 5/DBI against Oracle [...]
>
>Please be aware that the DBI/DBD that Tim is talking about, although it
>will allow Perl 5 to use Oracle DBs, is not Oraperl. The interface is
>not the same and scripts written for Oraperl will have to be re-written.
>I was involved in the early stages of defining the DBI and I don't think
>that the rewrite will be too difficult (in fact, someone will probably
>come up with a Perl script to do a lot of it) but it will have to be done.
>

Not so.

Kevin, you're a little out of date. I presume you're not on the perldb mailing list (perldb-interest-REQUEST_at_vix.com for anyone who wants to join).

The following code works _now_ with oraperl _and_ DBD::Oracle via a thin oraperl emulation layer called DBD::Oraperl.pm:

eval 'use DBD::Oraperl' if $] >= 5; # <--- The *ONLY* change required !!!

$lda = &ora_login('crgs', 'devadam/devadam', '')

                    || die "ora_login: $ora_errno: $ora_errstr\n";
&ora_commit($lda) || warn "ora_commit($lda): $ora_errno: $ora_errstr\n"; &ora_rollback($lda) || warn "ora_rollback($lda): $ora_errno: $ora_errstr\n"; $csr = &ora_open($lda, "select 11*7.2 num_t,
        SYSDATE date_t, USER    char_t from dual")
                    || die "ora_open: $ora_errno: $ora_errstr\n";
print "Names:   '",join("', '", &ora_titles($csr)),"'\n";
print "Lengths: '",join("', '", &ora_lengths($csr)),"'\n"; print "Types: '",join("', '", &ora_types($csr)),"'\n"; &ora_close($csr) || warn "ora_close($csr): $ora_errno: $ora_errstr\n"; &ora_logoff($lda) || warn "ora_logoff($lda): $ora_errno: $ora_errstr\n";

I hope that's to your liking :-)

Note that the code above does not fetch any data. That's because I've not implemented that bit yet! I have placed some *VERY* *EARLY* *ALPHA* code onto ftp.demon.co.uk:/pub/perl/db/ in the DBI and DBD subdirectories. Only the brave or foolhardy should bother to fetch this stuff now!

> Kevin
>

Regards,
Tim Bunce. Received on Thu Mar 02 1995 - 19:51:47 CET

Original text of this message