DBD::Oracle: Object support on sparc platforms

[email protected] (Charles Jardine)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
Attached is a patch against DBD::Oracle version 1.27 which corrects
some type mismatches which prevent the support for objects working
on big-endian platforms such as Sun-sparc.

There was a thread on this topic in this mail list last April.
See http://www.mail-archive.com/[email protected]/msg32902.html

The original poster reported that tests in t/58object.t in
version 1.24a did not work on his sparc platform. I posted a patch.
the OP tested it, and found that my patch allowed him to get further,
but later tests still failed. I posted a second patch and asked the OP
to test it. I never got a reply.

The first patch got into DBD::Oracle-1.27, but the second patch,
being untested, did not.

I have now managed to borrow some sparc hardware. I have re-worked
the second patch for 1.27, and tested it. With the patch applied,
DBD::Oracle passes all its tests on a 64-bit sparc running
Solaris 10. I can now run some of my production scripts, which
use objects, on the sparc.

I recommend that this patch be incorporated into version 1.28.

-- 
Charles Jardine - Computing Service, University of Cambridge
[email protected]    Tel: +44 1223 334506, Fax: +44 1223 334679
sparc-object-patch (text/plain, 1.8 KB)
diff -r -u DBD-Oracle-1.27/oci8.c DBD-Oracle-1.27.patched/oci8.c
--- DBD-Oracle-1.27/oci8.c	2010-12-15 00:41:56.000000000 +0000
+++ DBD-Oracle-1.27.patched/oci8.c	2011-01-28 12:40:45.000000000 +0000
@@ -2045,6 +2045,7 @@
 	text		str_buf[200];
 	double		dnum;
 	size_t		str_len;
+	ub4		ub4_str_len;
 	OCIRaw		*raw 	= (OCIRaw *) 0;
 	OCIString	*vs 	= (OCIString *) 0;
 	ub1			*temp	= (ub1 *)0;
@@ -2068,7 +2069,7 @@
 		 						fbh->imp_sth->errhp,
 		 						attr_value,
 		 						str_buf,
-		 						200,
+		 						(size_t)200,
 		 						&str_len,
 							status);
 		str_buf[str_len+1] = '\0';
@@ -2080,9 +2081,9 @@
 	case OCI_TYPECODE_TIMESTAMP :
 
 
-		str_len = 200;
+		ub4_str_len = 200;
 		OCIDateTimeToText_log_stat(fbh->imp_sth->envhp,
-									fbh->imp_sth->errhp,attr_value,&str_len,str_buf,status);
+									fbh->imp_sth->errhp,attr_value,&ub4_str_len,str_buf,status);
 
 		if (typecode == OCI_TYPECODE_TIMESTAMP_TZ || typecode == OCI_TYPECODE_TIMESTAMP_LTZ){
 			char s_tz_hour[3]="000";
@@ -2104,19 +2105,19 @@
 			sprintf(s_tz_min,":%02d", tz_minute);
 			strcat((signed char*)str_buf, s_tz_hour);
 			strcat((signed char*)str_buf, s_tz_min);
-			str_buf[str_len+7] = '\0';
+			str_buf[ub4_str_len+7] = '\0';
 
 		} else {
-		  str_buf[str_len+1] = '\0';
+		  str_buf[ub4_str_len+1] = '\0';
 		}
 
 		av_push(list, newSVpv( (char *) str_buf,0));
 		break;
 
 	case OCI_TYPECODE_DATE :						 /* fixed length string*/
-		str_len = 200;
-		OCIDateToText_log_stat(fbh->imp_sth->errhp, (CONST OCIDate *) attr_value,&str_len,str_buf,status);
-		str_buf[str_len+1] = '\0';
+		ub4_str_len = 200;
+		OCIDateToText_log_stat(fbh->imp_sth->errhp, (CONST OCIDate *) attr_value,&ub4_str_len,str_buf,status);
+		str_buf[ub4_str_len+1] = '\0';
 		av_push(list, newSVpv( (char *) str_buf,0));
 		break;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.