[svn:dbd-oracle] r14834 - dbd-oracle/branches/by_by_auto_lob
[email protected] Fri, 8 Apr 2011 08:28:17 -0700 (PDT)
| Newsgroups | perl.dbd.oracle.changes |
|---|---|
| Message-ID | <[email protected]> |
Author: byterock
Date: Fri Apr 8 08:28:16 2011
New Revision: 14834
Modified:
dbd-oracle/branches/by_by_auto_lob/Makefile.PL
dbd-oracle/branches/by_by_auto_lob/Oracle.pm
dbd-oracle/branches/by_by_auto_lob/dbdimp.c
dbd-oracle/branches/by_by_auto_lob/oci8.c
Log:
Now it supports ora_auto_lob=>0 so only the locator is inserted
Modified: dbd-oracle/branches/by_by_auto_lob/Makefile.PL
==============================================================================
--- dbd-oracle/branches/by_by_auto_lob/Makefile.PL (original)
+++ dbd-oracle/branches/by_by_auto_lob/Makefile.PL Fri Apr 8 08:28:16 2011
@@ -175,6 +175,10 @@
die "DBD::Oracle no longer supports Oracle client versions before 9.2 \n Try a version before 1.25 for 9 and 1.18 for 8!"
if $client_version < 9;
+$opts{DEFINE} .= " -DORA_OCI_9"
+ if ($client_version >= 10.0);#< 10.0); # do not use Persistent LOBs interface
+
+
# Check for symbol table problem in libclntsh.dylib.9.0 on MacOS X
if ($os eq 'darwin' and -f (my $oracle_lib = "$OH/lib/libclntsh.dylib")) {
Modified: dbd-oracle/branches/by_by_auto_lob/Oracle.pm
==============================================================================
--- dbd-oracle/branches/by_by_auto_lob/Oracle.pm (original)
+++ dbd-oracle/branches/by_by_auto_lob/Oracle.pm Fri Apr 8 08:28:16 2011
@@ -2036,6 +2036,9 @@
BLOB column in most circumstances. If false, fetching retrieves the
Oracle "LOB Locator" of the CLOB or BLOB value.
+The same is true for inserts, if turn the contents of the CLOB or BLOB are
+inserted. If false only the "LOB Locator" of the CLOB or BLOB is saved.
+
See L</LOBs and LONGs> for more details.
See also the LOB tests in 05dbi.t of Oracle::OCI for examples
of how to use LOB Locators.
Modified: dbd-oracle/branches/by_by_auto_lob/dbdimp.c
==============================================================================
--- dbd-oracle/branches/by_by_auto_lob/dbdimp.c (original)
+++ dbd-oracle/branches/by_by_auto_lob/dbdimp.c Fri Apr 8 08:28:16 2011
@@ -2819,8 +2819,8 @@
int trace_level = DBIS->debug;
ub1 csform;
ub2 csid;
-
- if (trace_level >= 5 || dbd_verbose <= 5 )
+PerlIO_printf(DBILOGFP, " imp_sth->auto_lob=%d\n",imp_sth->auto_lob);
+ if (trace_level >= 5 || dbd_verbose >= 5 )
PerlIO_printf(DBILOGFP, "dbd_rebind_ph() (1): rebinding %s as %s (%s, ftype %d (%s), csid %d, csform %d(%s), inout %d)\n",
phs->name, (SvPOK(phs->sv) ? neatsvpv(phs->sv,10) : "NULL"),(SvUTF8(phs->sv) ? "is-utf8" : "not-utf8"),
phs->ftype,sql_typecode_name(phs->ftype),phs->csid, phs->csform,oci_csform_name(phs->csform), phs->is_inout);
@@ -2832,37 +2832,50 @@
case ORA_NUMBER_TABLE:
done = dbd_rebind_ph_number_table(sth, imp_sth, phs);
break;
-
- /*
- done =1;
- break;*/
+#ifdef ORA_OCI_9
+ case SQLT_CLOB:
case SQLT_BLOB:
- phs->ftype=SQLT_BIN;
- done = dbd_rebind_ph_char(imp_sth, phs);
-
- /* done = dbd_rebind_ph_lob(sth, imp_sth, phs);*/
+ done = dbd_rebind_ph_lob(sth, imp_sth, phs);
+ break;
+#else
+ case SQLT_BLOB:
+ if (!imp_sth->auto_lob){
+ PerlIO_printf(DBILOGFP, " imp_sth->auto_lob=%d\n",imp_sth->auto_lob);
+ done = dbd_rebind_ph_lob(sth, imp_sth, phs);
+ }
+ else {
+ phs->ftype=SQLT_BIN;
+ done = dbd_rebind_ph_char(imp_sth, phs);
+ }
break;
+ case SQLT_CLOB:
+ if (!imp_sth->auto_lob){
+ done = dbd_rebind_ph_lob(sth, imp_sth, phs);
+ }
+ else {
+ phs->ftype=ORA_VARCHAR2;
+ done = dbd_rebind_ph_char(imp_sth, phs);
+ }
+ break;
+#endif
case SQLT_RSET:
done = dbd_rebind_ph_rset(sth, imp_sth, phs);
break;
case ORA_XMLTYPE:
done = dbd_rebind_ph_xml(sth, imp_sth, phs);
break;
- case SQLT_CLOB:
- phs->ftype=ORA_VARCHAR2;
default:
done = dbd_rebind_ph_char(imp_sth, phs);
}
-PerlIO_printf(DBILOGFP, " done=%d \n",done);
if (done == 2) { /* the dbd_rebind_* did the OCI bind call itself successfully */
- if (trace_level >= 3 || dbd_verbose <= 3 )
+ if (trace_level >= 3 || dbd_verbose >= 3 )
PerlIO_printf(DBILOGFP, " rebind %s done with ftype %d (%s)\n",
phs->name, phs->ftype,sql_typecode_name(phs->ftype));
return 1;
}
- if (trace_level >= 3 || dbd_verbose <= 3 )
+ if (trace_level >= 3 || dbd_verbose >= 3 )
PerlIO_printf(DBILOGFP, " bind %s as ftype %d (%s)\n",
phs->name, phs->ftype,sql_typecode_name(phs->ftype));
@@ -3385,11 +3398,11 @@
return -2; /* dbd_describe already called oci_error() */
}
-/* if (imp_sth->has_lobs && imp_sth->stmt_type != OCI_STMT_SELECT) {
+ if (imp_sth->has_lobs && imp_sth->stmt_type != OCI_STMT_SELECT) {
if (!post_execute_lobs(sth, imp_sth, row_count))
- return -2; /* post_insert_lobs already called oci_error()
+ return -2; /* post_insert_lobs already called oci_error() */
}
-*/
+
if (outparams) { /* check validity of bound output SV's */
int i = outparams;
while(--i >= 0) {
Modified: dbd-oracle/branches/by_by_auto_lob/oci8.c
==============================================================================
--- dbd-oracle/branches/by_by_auto_lob/oci8.c (original)
+++ dbd-oracle/branches/by_by_auto_lob/oci8.c Fri Apr 8 08:28:16 2011
@@ -1645,6 +1645,7 @@
if (phs->is_inout)
phs->out_prepost_exec = lob_phs_post_execute;
/* accept input LOBs */
+PerlIO_printf(DBILOGFP, " dbd_rebind_ph_lob 1\n");
if (sv_isobject(phs->sv) && sv_derived_from(phs->sv, "OCILobLocatorPtr")) {
@@ -1652,6 +1653,7 @@
OCILobLocator **dest;
src = INT2PTR(OCILobLocator *, SvIV(SvRV(phs->sv)));
dest = (OCILobLocator **) phs->progv;
+PerlIO_printf(DBILOGFP, " dbd_rebind_ph_lob 2\n");
OCILobLocatorAssign_log_stat(imp_dbh->svchp, imp_sth->errhp, src, dest, status);
if (status != OCI_SUCCESS) {
@@ -1664,6 +1666,7 @@
else if (imp_sth->stmt_type == OCI_STMT_BEGIN ||
imp_sth->stmt_type == OCI_STMT_DECLARE) {
ub4 amtp;
+PerlIO_printf(DBILOGFP, " dbd_rebind_ph_lob 3\n");
if(SvUPGRADE(phs->sv, SVt_PV)){/* For GCC not to warn on unused result */}; /* just in case */
@@ -1673,6 +1676,8 @@
if (amtp > 0) {
ub1 lobtype = (phs->ftype == 112 ? OCI_TEMP_CLOB : OCI_TEMP_BLOB);
+ PerlIO_printf(DBILOGFP, " dbd_rebind_ph_lob 4\n");
+
OCILobCreateTemporary_log_stat(imp_dbh->svchp, imp_sth->errhp,
(OCILobLocator *) phs->desc_h, (ub2) OCI_DEFAULT,
(ub1) OCI_DEFAULT, lobtype, TRUE, OCI_DURATION_SESSION, status);
@@ -1699,7 +1704,7 @@
phs->csform = csform;
}
- if (DBIS->debug >= 3 || dbd_verbose >= 3 )
+ if (DBIS->debug >= 3 || dbd_verbose <= 3 )
PerlIO_printf(DBILOGFP, " calling OCILobWrite phs->csid=%d phs->csform=%d amtp=%d\n",
phs->csid, phs->csform, amtp );
@@ -1713,6 +1718,8 @@
}
}
}
+ PerlIO_printf(DBILOGFP, " dbd_rebind_ph_lob 5\n");
+
return 1;
}