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

[email protected] Sat, 22 Oct 2011 04:07:43 -0700 (PDT)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: mjevans
Date: Sat Oct 22 04:07:35 2011
New Revision: 14958

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/Oracle.pm
   dbd-oracle/trunk/oci8.c

Log:
Fix problems with bind_col where TYPE is specified but no attributes
Add warning if TYPE to bind_col is not supported in sql_type_cast
Add note to bind_col pod re use of TYPE


Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Sat Oct 22 04:07:35 2011
@@ -1,5 +1,21 @@
 Revision history for DBD::Oracle
 
+Changes in DBD-Oracle 1.33_01 (xx-xx-xxxx)
+
+ [BUG FIXES]
+ - if bind_col is called with a TYPE but no bind attributes like
+   StrictlyTyped or DiscardString are set DBD::Oracle still attempts
+   to call sql_type_cast which is pointless (Martin J. Evans)
+ - if bind_col is called with a TYPE other than SQL_NUMERIC,
+   SQL_INTEGER or SQL_DOUBLE and bind attributes like StrictlyTyped or
+   DiscardString a warning was not issued that the type is unsupported
+   and no data was returned (Martin J. Evans)
+
+ [DOCUMENTATION]
+ - Added notes to bind_col documenting the fact that setting a TYPE
+   does not affect how the column is bound in Oracle, only what
+   happens after the column data is retrieved (Martin J. Evans)
+
 Changes in DBD-Oracle 1.33_00 (18-10-2011)
 
  [BUG FIXES]

Modified: dbd-oracle/trunk/Oracle.pm
==============================================================================
--- dbd-oracle/trunk/Oracle.pm	(original)
+++ dbd-oracle/trunk/Oracle.pm	Sat Oct 22 04:07:35 2011
@@ -4148,6 +4148,12 @@
 Binds a Perl variable and/or some attributes to an output column of a SELECT statement.
 Column numbers count up from 1. You do not need to bind output columns in order to fetch data.
 
+NOTE: DBD::Oracle does not use the C<$bind_type> to determine how to
+bind the column; it uses what Oracle says the data type is. You can
+however set a numeric bind type with the bind attributes
+StrictlyTyped/DiscardString as these attributes are applied after the
+column is retrieved.
+
 See the DBI documentation for a discussion of the optional parameters C<\%attr> and C<$bind_type>
 
 =head3 B<bind_columns>

Modified: dbd-oracle/trunk/oci8.c
==============================================================================
--- dbd-oracle/trunk/oci8.c	(original)
+++ dbd-oracle/trunk/oci8.c	Sat Oct 22 04:07:35 2011
@@ -3738,6 +3738,7 @@
 AV *
 dbd_st_fetch(SV *sth, imp_sth_t *imp_sth){
 	dTHX;
+    D_imp_xxh(sth);
 	sword status;
 	D_imp_dbh_from_sth;
 	int num_fields = DBIc_NUM_FIELDS(imp_sth);
@@ -3927,12 +3928,13 @@
 #if DBIXS_REVISION > 13590
 		/* If a bind type was specified we use DBI's sql_type_cast
 			to cast it - currently only number types are handled */
-					if (fbh->req_type != 0) {
+					if ((fbh->req_type != 0) && (fbh->bind_flags != 0)) {
 						int sts;
 						char errstr[256];
 
 						sts = DBIc_DBISTATE(imp_sth)->sql_type_cast_svpv(
 						aTHX_ sv, fbh->req_type, fbh->bind_flags, NULL);
+
 						if (sts == 0) {
 							sprintf(errstr,
 								"over/under flow converting column %d to type %"IVdf"",
@@ -3945,7 +3947,11 @@
 							sprintf(errstr,
 								"unsupported bind type %"IVdf" for column %d",
 								fbh->req_type, i+1);
-							return Nullav;
+                            /* issue warning */
+                            DBIh_SET_ERR_CHAR(sth, imp_xxh, "0", 1, errstr, Nullch, Nullch);
+                            if (CSFORM_IMPLIES_UTF8(fbh->csform) ){
+                                SvUTF8_on(sv);
+                            }
 						}
 					}
 					else
@@ -4669,4 +4675,4 @@
 	}
 	imp_dbh->server_version = vernum;
 	return vernum;
-}
\ No newline at end of file
+}