The stock DBD-Oracle-1.12 causes Perl to dump core for me if I try to
select from a BFILE column. The appended patch adds support for
BFILEs. I'm not an Oracle OCI expert so I can't vouch that the code
is 100% correct, but "it works for me." I hope that it is useful.
David Hull
--- oci8.c 2001/10/10 18:58:47 1.2
+++ oci8.c 2001/10/10 20:43:27 1.3
@@ -1,5 +1,5 @@
/*
- $Id: oci8.c,v 1.2 2001/10/10 18:58:47 hull Exp $
+ $Id: oci8.c,v 1.3 2001/10/10 20:43:27 hull Exp $
Copyright (c) 1998,1999,2000,2001 Tim Bunce
@@ -740,6 +740,16 @@
SvGROW(dest_sv, buflen+1);
if (loblen > 0) {
+ if (fbh->dbtype==114) {
+ OCILobFileOpen_log_stat(imp_sth->svchp, imp_sth->errhp, lobloc,
+ OCI_FILE_READONLY, status);
+ if (status != OCI_SUCCESS) {
+ oci_error(sth, imp_sth->errhp, status, "OCILobFileOpen");
+ (void)SvOK_off(dest_sv);
+ return 0;
+ }
+ }
+
OCILobRead_log_stat(imp_sth->svchp, imp_sth->errhp, lobloc,
&amtp, 1, SvPVX(dest_sv), buflen, 0, 0, 0, SQLCS_IMPLICIT, status);
if (DBIS->debug >= 3)
@@ -747,6 +757,10 @@
" OCILobRead field %d %s: LOBlen %ldc, LongReadLen %ldc, BufLen
%ldb, Got %ldc\n",
fbh->field_num+1, oci_status_name(status), ul_t(loblen),
imp_sth->long_readlen, ul_t(buflen), ul_t(amtp));
+ if (fbh->dbtype==114) {
+ OCILobFileClose_log_stat(imp_sth->svchp, imp_sth->errhp,
+ lobloc, status);
+ }
if (status != OCI_SUCCESS) {
oci_error(sth, imp_sth->errhp, status, "OCILobRead");
(void)SvOK_off(dest_sv);
@@ -930,6 +944,7 @@
case 112: /* CLOB */
case 113: /* BLOB */
+ case 114: /* BFILE */
fbh->ftype = fbh->dbtype;
fbh->disize = fbh->dbsize;
fbh->fetch_func = (imp_sth->auto_lob)
--- ocitrace.h 2001/10/10 19:51:04 1.1
+++ ocitrace.h 2001/10/10 20:43:28 1.2
@@ -150,6 +150,20 @@
OciTp, (void*)sh,(void*)eh,(void*)lh,pul_t(l), \
oci_status_name(stat)),stat : stat
+#define OCILobFileOpen_log_stat(sv,eh,lh,mode,stat) \
+ stat=OCILobFileOpen(sv,eh,lh,mode); \
+ (DBD_OCI_TRACEON) ? fprintf(DBD_OCI_TRACEFP, \
+ "%sLobFileOpen(%p,%p,%p,%u)=%s\n", \
+ OciTp, (void*)sv,(void*)eh,(void*)lh,(ub1)mode, \
+ oci_status_name(stat)),stat : stat
+
+#define OCILobFileClose_log_stat(sv,eh,lh,stat) \
+ stat=OCILobFileClose(sv,eh,lh); \
+ (DBD_OCI_TRACEON) ? fprintf(DBD_OCI_TRACEFP, \
+ "%sLobFileClose(%p,%p,%p)=%s\n", \
+ OciTp, (void*)sv,(void*)eh,(void*)lh, \
+ oci_status_name(stat)),stat : stat
+
#define OCILobRead_log_stat(sv,eh,lh,am,of,bp,bl,cx,cb,csi,csf,stat) \
stat=OCILobRead(sv,eh,lh,am,of,bp,bl,cx,cb,csi,csf); \
(DBD_OCI_TRACEON) ? fprintf(DBD_OCI_TRACEFP, \