[svn:dbd-oracle] r14691 - dbd-oracle/branches/exe_array

[email protected] Tue, 8 Feb 2011 12:44:27 -0800 (PST)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: byterock
Date: Tue Feb  8 12:44:26 2011
New Revision: 14691

Modified:
   dbd-oracle/branches/exe_array/Oracle.pm
   dbd-oracle/branches/exe_array/dbdimp.c

Log:
Just finished off a few little things to make it work correctly for an update in list context.  It will now return the correct # of rows updated.

Modified: dbd-oracle/branches/exe_array/Oracle.pm
==============================================================================
--- dbd-oracle/branches/exe_array/Oracle.pm	(original)
+++ dbd-oracle/branches/exe_array/Oracle.pm	Tue Feb  8 12:44:26 2011
@@ -1033,6 +1033,8 @@
                                            scalar(@tuple_batch),
                                            $tuple_batch_status,
                                            $err_count );
+                                           
+           
            if(defined($res)) { #no error
                 $row_count += $res;
            } else {
@@ -1050,11 +1052,10 @@
        	   if $err_count;
                    
        if (!wantarray) {
-	   return undef if !defined $row_count;
-   	   return $tuple_count;
+	   return $tuple_count;
        }
 
-       return (defined $row_count ? $tuple_count : undef, $tuple_count-$err_count);
+       return ($tuple_count, defined $row_count ? $row_count : undef);
             
        
        
@@ -1133,18 +1134,23 @@
 
 So to make a short story a little longer;
 
-  1) If you are using Oracle 7 or early 8 DB and you can manage to get a 9 client and you can use any DBD::Oracle version.
+  1) If you are using Oracle 7 or early 8 DB and you can manage to get a 9 client and you can use 
+     any DBD::Oracle version.
   2) If you have to use an Oracle 7 client then DBD::Oracle 1.17 should work
-  3) Same thing for 8 up to R2, use 1.17, if you are lucky and have the right patch-set you might go with 1.18.
-  4) For 8iR3 you can use any of the DBD::Oracle versions up to 1.21. Again this depends on your patch-set, If you run into trouble go with 1.19
+  3) Same thing for 8 up to R2, use 1.17, if you are lucky and have the right patch-set you might 
+     go with 1.18.
+  4) For 8iR3 you can use any of the DBD::Oracle versions up to 1.21. Again this depends on your
+     patch-set, If you run into trouble go with 1.19
   5) After 9.2 you can use any version you want.
-  6) For you Luddites out there ORAPERL still works and is still included but not updated or supported anymore and will be removed in 1.27.
-  7) It seems that the 10g client can only connect to 9 and 11 DBs while the 9 can go back to 7 and even get to 10. 
-     I am not sure what the 11g client can connect to.
-  8) DBD::Oracle still has the code in place for ProC. But good luck trying to get it to work with any of the instant clients 
-     as Oracle no longer ships the correct .mk files.  I was unable to get it to work with Oracle 11+ as it ships with only 
-     part of the full ProC install.  You may have to get a full version of ProC from Oracle to get it to compile. It is also slated
-     to be removed in 1.27
+  6) For you Luddites out there ORAPERL still works and is still included but not updated or 
+     supported anymore and will be removed in 1.29.
+  7) It seems that the 10g client can only connect to 9 and 11 DBs while the 9 can go back to 7
+     and even get to 10. I am not sure what the 11g client can connect to.
+  8) DBD::Oracle still has the code in place for ProC. But good luck trying to get it to work with
+     any of the instant clients as Oracle no longer ships the correct .mk files.  I was unable to
+     get it to work with Oracle 11+ as it ships with only part of the full ProC install. You may 
+     have to get a full version of ProC from Oracle to get it to compile. It is also slated to be
+     removed in 1.29
 
 =head1 CONNECTING TO ORACLE
 
@@ -1391,7 +1397,9 @@
   
   $dbh = DBI->connect('dbi:Oracle:DB','username','password',{ora_drcp=>1})
   
-  $dbh = DBI->connect('dbi:Oracle:DB','username','password',{ora_drcp=>1, ora_drcp_class=>'my_app', ora_drcp_min=>10})
+  $dbh = DBI->connect('dbi:Oracle:DB','username','password',{ora_drcp      =>1, 
+                                                             ora_drcp_class=>'my_app',
+                                                             ora_drcp_min  =>10})
  
   $dbh = DBI->connect('dbi:Oracle:host=foobar;sid=ORCL;port=1521;SERVER=POOLED', 'scott/tiger', '')
 

Modified: dbd-oracle/branches/exe_array/dbdimp.c
==============================================================================
--- dbd-oracle/branches/exe_array/dbdimp.c	(original)
+++ dbd-oracle/branches/exe_array/dbdimp.c	Tue Feb  8 12:44:26 2011
@@ -3486,12 +3486,13 @@
 				OCINlsCharSetIdToName(imp_sth->envhp,charsetname, sizeof(charsetname),csid );
 
 				for(i=0;i<av_len(tuples_utf8_av)+1;i++){
-					SV *err_svs[2];
+					SV *err_svs[3];
 					SV *item;
 					item=*(av_fetch(tuples_utf8_av,i,0));
 					err_svs[0] = newSViv((IV)0);
 					err_svs[1] = newSVpvf("DBD Oracle Warning: You have mixed utf8 and non-utf8 in an array bind in parameter#%d. This may result in corrupt data. The Query charset id=%d, name=%s",parma_index+1,csid,charsetname);
-					av_store(tuples_status_av,SvIV(item),newRV_noinc((SV *)(av_make(2, err_svs))));
+					err_svs[2] = newSVpvn("S1000", 0);
+					av_store(tuples_status_av,SvIV(item),newRV_noinc((SV *)(av_make(3, err_svs))));
 				}
 
 
@@ -3552,7 +3553,7 @@
 {
 	dTHX;
 	dTHR;
-	/*ub4 row_count = 0;*/
+	ub4 row_count = 0;
 	int debug = DBIS->debug;
 	D_imp_dbh_from_sth;
 	sword status, exe_status;
@@ -3735,6 +3736,9 @@
 	OCIStmtExecute_log_stat(imp_sth->svchp, imp_sth->stmhp, imp_sth->errhp,
 							exe_count, 0, 0, 0, oci_mode, exe_status);
 
+	OCIAttrGet_stmhp_stat(imp_sth, &row_count, 0, OCI_ATTR_ROW_COUNT, status);
+
+
 	 imp_sth->bind_tuples = NULL;
 
 	if (exe_status != OCI_SUCCESS) {
@@ -3742,7 +3746,6 @@
 		if(exe_status != OCI_SUCCESS_WITH_INFO)
 			return -2;
 	}
-
 	if (outparams){
 		i=outparams;
 		while(--i >= 0) {
@@ -3767,7 +3770,7 @@
 	if(num_errs && tuples_status_av) {
 		OCIError *row_errhp, *tmp_errhp;
 		ub4 row_off;
-		SV *err_svs[2];
+		SV *err_svs[3];
 		/*AV *err_av;*/
 		sb4 err_code;
 	    sv_setiv(err_count,num_errs);
@@ -3809,9 +3812,7 @@
 	if(num_errs) {
 		return -2;
 	} else {
-		ub4 row_count = 0;
 
-		OCIAttrGet_stmhp_stat(imp_sth, &row_count, 0, OCI_ATTR_ROW_COUNT, status);
 		return row_count;
 	}
 }