Drop Table
Support Forum for database administrators and web based access to important newsgroups related to databasesAuthor: byterock Date: Fri Apr 7 10:15:14 2006 New Revision: 5872 Modified: dbd-oracle/trunk/Changes dbd-oracle/trunk/Oracle.pm dbd-oracle/trunk/README.win32.txt dbd-oracle/trunk/oci8.c Log: Latest changes for lobs and fix for typo README.win32.txt Modified: dbd-oracle/trunk/Changes ==================== ==================== ==================== ================ == --- dbd-oracle/trunk/Changes (original) +++ dbd-oracle/trunk/Changes Fri Apr 7 10:15:14 2006 @@ -1,8 +1,13 @@ -=head1 Changes in DBD-Oracle 1.17 (svn rev 3725) 31th March 2006 - Added expanded support for Lobs from Jeffrey.Klein@priority-health.com - Changed the following dbdimp.c, oci8.c, ocitrace.h, t/31log.t +=head1 Changes in DBD-Oracle 1.17 (scn rev 3726) + Updated README.win32.txt fixed some typos + Fixed expanded support for Lobs support from Jeffrey Klein + Added notes on expanded support for Lobs to Oracle.pm + +=head1 Changes in DBD-Oracle 1.17 (svn rev 3725) + Added expanded support for Lobs from Jeffrey Klein + =head1 Changes in DBD-Oracle 1.17 (svn rev 2487) 7th February 2006 NOTE: With this release of DBD::Oracle pythian.com (http://www.pythian.com) Modified: dbd-oracle/trunk/Oracle.pm ==================== ==================== ==================== ================ == --- dbd-oracle/trunk/Oracle.pm (original) +++ dbd-oracle/trunk/Oracle.pm Fri Apr 7 10:15:14 2006 @@ -2163,7 +2163,6 @@ There are some limitations inherent in the way DBD::Oracle makes typical LOB operations simple by hiding the LOB Locator processing: - - Can't pass LOBs to/from PL/SQL (except as strings less than 32KB) - Can't read/write LOBs in chunks (except via DBMS_LOB.WRITEAPPEND in PL/SQL ) - To INSERT a LOB, you need UPDATE privilege. @@ -2172,6 +2171,50 @@ do all the work yourself using the ora_lob_*() methods and/or Oracle::OCI. See the L</LOB Methods> section below. +=head2 LOB support in PL/SQL + +LOB Locators can be passed to PL/SQL calls by binding them to placeholders +with the proper C<ora_type>. If L</ora_auto_lob> is true, output LOB +parameters will be automatically returned as strings. + +If the Oracle driver has support for temporary LOBs (Oracle 9i and higher), +strings can be bound to input LOB placeholders and will be automatically +converted to LOBs. + +Example: + # Build a large XML document, bind it as a CLOB, + # extract elements through PL/SQL and return as a CLOB + + # $dbh is a connected database handle + # output will be large + + local $dbh->{LongReadLen} = 1_000_000; + + my $in_clob = "<document>\n"; + $in_clob .= " <value>$_</value>\n" for 1 .. 10_000; + $in_clob .= "</document>\n"; + + my $out_clob; + + + my $sth = $dbh->prepare(<<PLSQL_END); + -- extract 'value' nodes + DECLARE + x XMLTYPE := XMLTYPE(:in); + BEGIN + :out := x.extract('/document/value').getClobVal(); + END; + + PLSQL_END + + # :in param will be converted to a temp lob + # :out parameter will be returned as a string. + + $sth->bind_param( ':in', $in_clob, { ora_type => ORA_CLOB } ); + $sth->bind_param_inout( ':out', \$out_clob, 0, { ora_type => ORA_ CLOB } ); + $sth->execute; + + =head2 LOB Locator Methods The following driver-specific methods let you manipulate "LOB Locators". @@ -2183,6 +2226,10 @@ RaiseError etc, and so it's important to check $dbh->err after each call. It's recommended that you upgrade to DBI 1.38 or later.) +Note that LOB locators are only valid while the statement handle that +created them is valid. When all references to the original statement +handle are lost, the handle is destroyed and the locators are freed. + B<Warning:> Currently multi-byte character set issues have not been fully worked out. So these methods may not do what you expect if either the perl data is utf8 or the CLOB is a multi-byte character set Modified: dbd-oracle/trunk/README.win32.txt ==================== ==================== ==================== ================ == --- dbd-oracle/trunk/README.win32.txt (original) +++ dbd-oracle/trunk/README.win32.txt Fri Apr 7 10:15:14 2006 @@ -12,7 +12,7 @@ The preferred method of getting DBD::Oracle is to use a pre-built version fr om the ActiveState repository, which can be installed with PPM. -Compiling and installing DBD::Oracle 1.06 on a windows 2000 professional OS for use +Compiling and installing DBD::Oracle 1.17 on a windows 2000 professional OS for use with Oracle instantClient ver 10.2.0.1 & 10.1.0.4 requires only a few downlo ads and a minimal number of environment setting. The procedures below were tested o n a clean Windows 2000 professional platform having no Oracle or other development env ironment installed. Modified: dbd-oracle/trunk/oci8.c ==================== ==================== ==================== ================ == --- dbd-oracle/trunk/oci8.c (original) +++ dbd-oracle/trunk/oci8.c Fri Apr 7 10:15:14 2006 @@ -729,7 +729,8 @@ phs->out_prepost_exec = lob_phs_post_execute ; /* accept input LOBs */ - if (SvOK(phs->sv) && sv_derived_from(phs->sv, "OCILobLocatorPtr")) 3; +if (sv_isobject(phs->sv) && sv_derived_from(phs->sv, "OCILobLocatorPtr")) & #123; + OCILobLocator *src; OCILobLocator **dest; src = INT2PTR(OCILobLocato r *, SvIV(SvRV(phs->sv))); @@ -745,7 +746,7 @@ #if !defined(ORA_OCI_8) /* create temporary LOB for PL/SQL placeholder */ - else if (imp_sth->auto_lob && (imp_sth->stmt_type == OCI_STMT_BEGIN || + else if (imp_sth->stmt_type == OCI_STMT_BEGIN || imp_sth->stmt_type == OCI_STMT_DECLARE)) { ub4 amtp;
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread