[svn:dbd-oracle] r14660 - dbd-oracle/trunk

[email protected] Fri, 28 Jan 2011 04:30:14 -0800 (PST)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Fri Jan 28 04:30:10 2011
New Revision: 14660

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/dbdimp.c
   dbd-oracle/trunk/dbdimp.h
   dbd-oracle/trunk/oci8.c

Log:
Incremental check in. Just house-keeping on functional changes

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Fri Jan 28 04:30:10 2011
@@ -1,10 +1,19 @@
 =head1 Changes in DBD-Oracle 1.28 (svn rev 14583)
 
-  Fix for rt64524  Memory Leak when Oracle connection fails by  Martin J. Evans
+  Fix for function name length, Some function names are over 31char long which may cause problems for some OS/Compilers (VMS IA64 box.) from Jakob Snoer
+  Fix for OCIPing in case where a 10 client tries to ping a <10 DB  from Tim Oertel
+  Fix for DBD-Oracle stored proc with array bug where second call array size is unchanged from Tim Oertel
+  Fix for rt.cpan.org Ticket #=63332: Spelling error in POD from jonasbn
+  Fix for rt.cpan.org Ticket #=62152: t/28array_bind.t and t/31lob.t may call plan() twice and  others do not fial on not connect from John Scoles
+  Fix for rt.cpan.org Ticket #=61511 ORA-00942 when inserting into a table with a LOB column over a synonym on HP-U from Kris Lemaire
+  Fix for rt.cpan.org Ticket #=42842 Test 31lob fails with 64-bit Instant Client by John Scoles
+  Fix for support for objects on big endian platforms from Charles Jardine, John R Pierce
+  Fix for rt.cpan.org Ticket #=61225 Windows install (Stawberry Perl) fails on long path names from David Tulloh
+  Fix for rt.cpan.org Ticket #=rt64524  Memory Leak when Oracle connection fails by  Martin J. Evans
   Add missing ora_drcp* values to dbh private_attribute_info by Martin J. Evans
   Added all the missing ora_drcp values to dbh private_attribute_info by Martin J. Evans
   Removed a load of attributes from sth private_attribute_info which are not handle attributes but attributes to bind_param/prepare by Martin J. Evans
-  Fix for rt 64244 - don't bail out, skip tests we cannot connect by Martin J. Evans and John Scoles
+  Fix for rt.cpan.org Ticket #=64244 - don't bail out, skip tests we cannot connect by Martin J. Evans and John Scoles
   Added DBI to PREREQ_PM in Makefile.PL by Martin J. Evans
   Added build_requires in Makefile.PL by Martin J. Evans
   Added workaround for ExtUtils::MakeMaker problems by Martin J. Evans

Modified: dbd-oracle/trunk/dbdimp.c
==============================================================================
--- dbd-oracle/trunk/dbdimp.c	(original)
+++ dbd-oracle/trunk/dbdimp.c	Fri Jan 28 04:30:10 2011
@@ -283,7 +283,37 @@
 	return 0;
 }
 
+static int
+oratype_rebind_ok(int dbtype) /* all are vrcar any way so just use it */
+{
+	/* basically we support types that can be returned as strings */
+	switch(dbtype) {
+	case  1:	/* VARCHAR2	*/
+	case  2:	/* NVARCHAR2	*/
+	case  5:	/* STRING	*/
+	case  8:	/* LONG		*/
+	case 21:	/* BINARY FLOAT os-endian */
+	case 22:	/* BINARY DOUBLE os-endian */
+	case 23:	/* RAW		*/
+	case 24:	/* LONG RAW	*/
+	case 96:	/* CHAR		*/
+	case 97:	/* CHARZ	*/
+	case 100:	/* BINARY FLOAT oracle-endian */
+	case 101:	/* BINARY DOUBLE oracle-endian */
+	case 106:	/* MLSLABEL	*/
+	case 102:	/* SQLT_CUR	OCI 7 cursor variable	*/
+	case 116:	/* SQLT_RSET	OCI 8 cursor variable	*/
+ 	case ORA_VARCHAR2_TABLE: /* 201 */
+	case ORA_NUMBER_TABLE:	/* 202 */
+	case ORA_XMLTYPE:		/* SQLT_NTY   must be carefull here as its value (108) is the same for an embedded object Well realy only XML clobs not embedded objects  */
+	case 113:	/* SQLT_BLOB / long	*/
+		return SQLT_BIN;
+	case 112:	/* SQLT_CLOB / long	*/
+		return SQLT_CHR;
+	}
 
+	return dbtype;
+}
 /* --- allocate and free oracle oci 'array' buffers --- */
 
 /* --- allocate and free oracle oci 'array' buffers for callback--- */
@@ -366,10 +396,10 @@
 	SV **svp;
 	shared_sv * shared_dbh_ssv = NULL ;
 	imp_dbh_t * shared_dbh	 = NULL ;
-    D_imp_drh_from_dbh;
+	D_imp_drh_from_dbh;
 	ub2 new_charsetid = 0;
 	ub2 new_ncharsetid = 0;
-    int forced_new_environment = 0;
+	int forced_new_environment = 0;
 #if defined(USE_ITHREADS) && defined(PERL_MAGIC_shared_scalar)
 	SV **	shared_dbh_priv_svp ;
 	SV *	shared_dbh_priv_sv ;
@@ -495,14 +525,14 @@
 	if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_envhp", 9)) && SvOK(*svp)) {
 		if (!SvTRUE(*svp)) {
 			imp_dbh->envhp = NULL; /* force new environment */
-            forced_new_environment = 1;
+			forced_new_environment = 1;
 		}
 #if defined(CAN_USE_PRO_C)
 		else {
 			IV tmp;
 			if (!sv_isa(*svp, "ExtProc::OCIEnvHandle"))
 				croak("ora_envhp value is not of type ExtProc::OCIEnvHandle");
-            /* MJE cannot believe the following will work on 64bit platforms */
+			 /* MJE cannot believe the following will work on 64bit platforms */
 			tmp = SvIV((SV*)SvRV(*svp));
 			imp_dbh->envhp = (struct OCIEnv *)tmp;
 		}
@@ -628,9 +658,8 @@
 					"OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var  or PATH (Windows) and or NLS settings, permissions, etc.");
 				return 0;
 			}
-            if (!imp_drh->envhp)	/* cache first envhp info drh as future default */
-                imp_drh->envhp = imp_dbh->envhp;
-
+			if (!imp_drh->envhp)	/* cache first envhp info drh as future default */
+				imp_drh->envhp = imp_dbh->envhp;
 
 			svp = DBD_ATTRIB_GET_SVP(attr, "ora_charset", 11);/*get the charset passed in by the user*/
 			if (svp) {
@@ -669,8 +698,8 @@
 						"OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var  or PATH (Windows) and or NLS settings, permissions, etc");
 					return 0;
 				}
-                if (!imp_drh->envhp)	/* cache first envhp info drh as future default */
-                    imp_drh->envhp = imp_dbh->envhp;
+				if (!imp_drh->envhp)	/* cache first envhp info drh as future default */
+					imp_drh->envhp = imp_dbh->envhp;
 			}
 
 			/* update the hard-coded csid constants for unicode charsets */
@@ -915,8 +944,8 @@
 						OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status);
 						OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR,  status);
 						OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status);
-                        if (forced_new_environment)
-                            OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status);
+						if (forced_new_environment)
+							OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status);
 						return 0;
 					}
 
@@ -2862,16 +2891,16 @@
 
 	if (csform) {
 		/* set OCI_ATTR_CHARSET_FORM before we get the default OCI_ATTR_CHARSET_ID */
-	OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
+		OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
 		&csform, (ub4) 0, (ub4) OCI_ATTR_CHARSET_FORM, imp_sth->errhp, status);
-	if ( status != OCI_SUCCESS ) {
-		oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_FORM)"));
-		return 0;
-	}
+		if ( status != OCI_SUCCESS ) {
+			oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_FORM)"));
+			return 0;
+		}
 	}
 
 	if (!phs->csid_orig) {	/* get the default csid Oracle would use */
-	OCIAttrGet_log_stat(phs->bndhp, OCI_HTYPE_BIND, &phs->csid_orig, (ub4)0 ,
+		OCIAttrGet_log_stat(phs->bndhp, OCI_HTYPE_BIND, &phs->csid_orig, (ub4)0 ,
 		OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
 	}
 
@@ -2894,21 +2923,21 @@
 
 
 	if (csid) {
-	OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
-		&csid, (ub4) 0, (ub4) OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
-	if ( status != OCI_SUCCESS ) {
-		oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_ID)"));
-		return 0;
-	}
+		OCIAttrSet_log_stat(phs->bndhp, (ub4) OCI_HTYPE_BIND,
+			&csid, (ub4) 0, (ub4) OCI_ATTR_CHARSET_ID, imp_sth->errhp, status);
+		if ( status != OCI_SUCCESS ) {
+			oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_CHARSET_ID)"));
+			return 0;
+		}
 	}
 
 	if (phs->maxdata_size) {
-	OCIAttrSet_log_stat(phs->bndhp, (ub4)OCI_HTYPE_BIND,
-		neatsvpv(phs->sv,0), (ub4)phs->maxdata_size, (ub4)OCI_ATTR_MAXDATA_SIZE, imp_sth->errhp, status);
-	if ( status != OCI_SUCCESS ) {
-		oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_MAXDATA_SIZE)"));
-		return 0;
-	}
+		OCIAttrSet_log_stat(phs->bndhp, (ub4)OCI_HTYPE_BIND,
+			neatsvpv(phs->sv,0), (ub4)phs->maxdata_size, (ub4)OCI_ATTR_MAXDATA_SIZE, imp_sth->errhp, status);
+		if ( status != OCI_SUCCESS ) {
+			oci_error(sth, imp_sth->errhp, status, ora_sql_error(imp_sth,"OCIAttrSet (OCI_ATTR_MAXDATA_SIZE)"));
+			return 0;
+		}
 	}
 
 	return 1;
@@ -2962,7 +2991,7 @@
 		croak("Can't bind ``lvalue'' mode scalar as inout parameter (currently)");
 
 	if (DBIS->debug >= 2 || dbd_verbose >= 3 ) {
-		PerlIO_printf(DBILOGFP, "dbd_bind_ph(): bind %s <== %s (type %ld (%s)",
+		PerlIO_printf(DBILOGFP, "dbd_bind_ph(1): bind %s <== %s (type %ld (%s)",
 		name, neatsvpv(newvalue,0), (long)sql_type,sql_typecode_name(sql_type));
 		if (is_inout)
 			PerlIO_printf(DBILOGFP, ", inout 0x%lx, maxlen %ld",

Modified: dbd-oracle/trunk/dbdimp.h
==============================================================================
--- dbd-oracle/trunk/dbdimp.h	(original)
+++ dbd-oracle/trunk/dbdimp.h	Fri Jan 28 04:30:10 2011
@@ -331,6 +331,7 @@
 char *oci_hdtype_name _((ub4 hdtype));
 char *oci_attr_name _((ub4 attr));
 char *oci_exe_mode _((ub4 mode));
+char *dbd_yes_no _((int yes_no));
 char *oci_col_return_codes _((int rc));
 char *oci_csform_name _((ub4 attr));
 char *oci_sql_function_code_name _((int sqlfncode));

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c	(original)
+++ dbd-oracle/trunk/oci8.c	Fri Jan 28 04:30:10 2011
@@ -24,6 +24,15 @@
 
 
 
+char *
+dbd_yes_no(int yes_no)
+{
+	dTHX;
+	if (yes_no) {
+		return "Yes";
+	}
+	return "No";
+}
 
 void
 dbd_init_oci(dbistate_t *dbistate)
@@ -1511,8 +1520,10 @@
 		OCIDescriptorAlloc_ok(imp_sth->envhp,
 				&phs->desc_h, phs->desc_t);
 	}
+
 	OCIAttrSet_log_stat(phs->desc_h, phs->desc_t,
 			&lobEmpty, 0, OCI_ATTR_LOBEMPTY, imp_sth->errhp, status);
+
 	if (status != OCI_SUCCESS)
 		return oci_error(sth, imp_sth->errhp, status, "OCIAttrSet OCI_ATTR_LOBEMPTY");
 
@@ -1525,9 +1536,11 @@
 			if(SvUPGRADE(phs->sv, SVt_PV)){} /* For GCC not to warn on unused result */
 		}
 	}
+
 	phs->indp	= (SvOK(phs->sv)) ? 0 : -1;
 	phs->progv  = (char*)&phs->desc_h;
 	phs->maxlen = sizeof(OCILobLocator*);
+
 	if (phs->is_inout)
 		phs->out_prepost_exec = lob_phs_post_execute;
 	/* accept input LOBs */
@@ -1599,7 +1612,6 @@
 			}
 		}
 	}
-
 	return 1;
 }
 
@@ -4017,6 +4029,8 @@
 	int seen_key = 0;
 	char *orig = src;
 	char *p;
+
+
 	while(*src){
 		if (*src == '\'') {
 			char delim = *src;