On Sun, Jul 13, 2003 at 12:18:49AM -0700, Hilmar Lapp wrote:
> 
> On Saturday, July 12, 2003, at 03:43  PM, Hilmar Lapp wrote:
> 
> >If I do supply the LOB type and column as suggested in the POD, as in
> >
> >     $sth->bind_param($index, $value, { ora_type => ORA_CLOB, ora_field 
> >     => 'SEQ' });
> >
> >then I receive an
> >
> >ORA-04043: object biosequence does not exist (DBD SUCCESS: 
> >OCIDescribeAny(view)/LOB refetch)
> >
> >biosequence is a (non-public) synonym to the table that contains the 
> >LOB column. The real table is under a different user and also has a 
> >different name.
> 
> Just as an add-on, I've checked the above call without the NVL() wrap 
> around the parameter (i.e., '..., SEQ = ?, ...' instead of '..., SEQ = 
> NVL(?,SEQ), ...') and then it works just fine (BTW then it also works 
> without the parameters in the hash ref).

Good.

> I also tried against the real table (instead of the synonym to it) and 
> then even wrapping the parameter in NVL() works just fine (!).

Good.

> So wrapping the parameter in NVL() *and* issuing the statement against 
> an object that is only a synonym and not the real table makes the whole 
> difference. Apparently then a OCIDescribeAny(view) (whatever that means 
> ...) is triggered, which fails. I'd just be curious whether it is the 
> OCI libs which do this without DBD::Oracle being in control, or whether 
> it is DBD::Oracle, and/or whether DBD::Oracle could have some way of 
> working around it.

DBD::Oracle is doing it as part of it's "lob refetch" logic, which exists
to hide some of the pain of dealing with lobs in the common cases.

If you prepare the statement with the ora_auto_lob attribute false
then that code is disabled and what you get back in the column is
an pure Oracle "LOB Locator". You can't do much with that in the
current version of DBD::Oracle, but in the next you can:

  $data = $dbh->ora_lob_read($lob_locator, $offset, $length);
  $rc = $dbh->ora_lob_write($lob_locator, $offset, $data);
  $rc = $dbh->ora_lob_append($lob_locator, $data);
  $rc = $dbh->ora_lob_trim($lob_locator, $length);
  $length = $dbh->ora_lob_length($lob_locator);

Tim.

> I'm afraid if there is a fix it's not going to be an easy one and hence 
> I'll have to work around it myself in the meantime somehow ...
> 
>       -hilmar
> 
> BTW in case anyone is curious or would like to see the code, the OR 
> mapper I was talking about is bioperl-db (the persistence layer for 
> Bioperl, http://www.bioperl.org) and the schema is BioSQL 
> (http://obda.open-bio.org). Both are available from CVS.
> 
> -- 
> -------------------------------------------------------------
> Hilmar Lapp                            email: lapp at gnf.org
> GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
> -------------------------------------------------------------
> 

Reply via email to