Author: byterock
Date: Tue May 20 11:06:57 2008
New Revision: 11296
Modified:
dbd-oracle/trunk/Changes
dbd-oracle/trunk/oci8.c
Log:
moved from strncat and strcopy to memcpy as this works for both blobs and clobs
Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes (original)
+++ dbd-oracle/trunk/Changes Tue May 20 11:06:57 2008
@@ -1,6 +1,7 @@
=head1 Changes in DBD-Oracle 1.22(svn rev xxxx) 2008
Makefile.PL now working without flags for Linux 11.1.0.6 instant client and
regular client from John Scoles, Andy Sautins, H.Merijn Brand, Nathan Vonnahme
and Karun Dutt
- Fixed how persistant lob fetch works now uses callback correctly, from John
Scoles
+ Fixed how persistant lob fetch works now uses callback correctly, from John
Scoles & Darren Kipp
+
=head1 Changes in DBD-Oracle 1.21(svn rev 11067) 11th April 2008
Added Notes to README.win32.txt on installing Instant Client 11.1.0.6.0 from
John Scoles
Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c (original)
+++ dbd-oracle/trunk/oci8.c Tue May 20 11:06:57 2008
@@ -609,15 +609,21 @@
imp_fbh_t *fbh =(imp_fbh_t*)octxp;
fb_ary_t *fb_ary;
fb_ary = fbh->fb_ary;
-
+
*bufpp = (dvoid *) fb_ary->abuf;
*alenpp = &fb_ary->bufl;
*indpp = (dvoid *) fb_ary->aindp;
*rcpp = fb_ary->arcode;
if ( *piecep ==OCI_NEXT_PIECE ){/*more than one piece*/
-
- fb_ary->cb_abuf= strncat( fb_ary->cb_abuf,
fb_ary->abuf,(STRLEN)fb_ary->bufl);/*cat into the the cb buffer the piece*/
+
+
memcpy(fb_ary->cb_abuf+fb_ary->piece_count*fb_ary->bufl,fb_ary->abuf,fb_ary->bufl
);
+ /*as we will be using both blobs and clobs we have to use
+ pointer arithmetic to get the values right. in this case we simply
+ copy all of the memory of the buff into the cb buffer starting
+ at the piece count * the buffer length
+ */
+
fb_ary->piece_count++;/*used to tell me how many pieces I have, Might
be able to use aindp for this?*/
}
@@ -2736,23 +2742,23 @@
if (DBIS->debug >= 6)
PerlIO_printf(DBILOGFP," Fetch persistent lob of %d (char/bytes) with callback
in 1 piece of %d (Char/Bytes)\n",actual_bufl,fb_ary->bufl);
-
- strcpy (fb_ary->cb_abuf,fb_ary->abuf);
-
+
+
memcpy(fb_ary->cb_abuf,fb_ary->abuf,fb_ary->bufl );
+
} else {
if (DBIS->debug >= 6)
PerlIO_printf(DBILOGFP," Fetch persistent lob of %d (Char/Bytes) with callback
in %d piece(s) of %d (Char/Bytes) and one piece of %d
(Char/Bytes)\n",actual_bufl,fb_ary->piece_count,fbh->piece_size,fb_ary->bufl);
-
- fb_ary->cb_abuf= strncat( fb_ary->cb_abuf,
fb_ary->abuf,fb_ary->bufl);
- }
+
+
memcpy(fb_ary->cb_abuf+imp_sth->piece_size*(fb_ary->piece_count),fb_ary->abuf,fb_ary->bufl
);
+ }
if (fbh->ftype == SQLT_BIN){
*(fb_ary->cb_abuf+(actual_bufl))='\0';
/* add a null teminator*/
- sv_setpvn(sv, (char*)fb_ary->cb_abuf,
actual_bufl);
+ sv_setpvn(sv,
(char*)fb_ary->cb_abuf,(STRLEN)actual_bufl);
} else {
- sv_setpvn(sv,
(char*)fb_ary->cb_abuf, (STRLEN)actual_bufl);
+ sv_setpvn(sv,
(char*)fb_ary->cb_abuf,(STRLEN)actual_bufl);
if
(CSFORM_IMPLIES_UTF8(fbh->csform) ){
SvUTF8_on(sv);
}