tony2001                Thu Jul  7 19:03:22 2005 EDT

  Modified files:              
    /php-src/ext/pdo_oci        oci_driver.c 
  Log:
  do not set error_code to HY000 when there was NO error
  reset both handle & statement error codes to 0
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_oci/oci_driver.c?r1=1.22&r2=1.23&ty=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.22 
php-src/ext/pdo_oci/oci_driver.c:1.23
--- php-src/ext/pdo_oci/oci_driver.c:1.22       Tue Mar  8 21:13:06 2005
+++ php-src/ext/pdo_oci/oci_driver.c    Thu Jul  7 19:03:22 2005
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: oci_driver.c,v 1.22 2005/03/09 02:13:06 wez Exp $ */
+/* $Id: oci_driver.c,v 1.23 2005/07/07 23:03:22 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -63,26 +63,25 @@
        pdo_oci_stmt *S = NULL;
        pdo_error_type *pdo_err = &dbh->error_code;
        
-       einfo = &H->einfo;
-
-       if (einfo->errmsg) {
-               pefree(einfo->errmsg, dbh->is_persistent);
-               einfo->errmsg = NULL;
-       }
-
        if (stmt) {
                S = (pdo_oci_stmt*)stmt->driver_data;
                einfo = &S->einfo;
                pdo_err = &stmt->error_code;
+               if (einfo->errmsg) {
+                       efree(einfo->errmsg);
+               }
+       }
+       else {
+               einfo = &H->einfo;
+               if (einfo->errmsg) {
+                       pefree(einfo->errmsg, dbh->is_persistent);
+               }
        }
-               
+       
+       einfo->errmsg = NULL;
        einfo->errcode = 0;
        einfo->file = file;
        einfo->line = line;
-       if (einfo->errmsg) {
-               efree(einfo->errmsg);
-               einfo->errmsg = NULL;
-       }
        
        switch (status) {
                case OCI_SUCCESS:
@@ -113,34 +112,36 @@
                        break;
        }
 
-       switch (einfo->errcode) {
-               case 1013:      /* user requested cancel of current operation */
-                       zend_bailout();
-                       break;
+       if (einfo->errcode) {
+               switch (einfo->errcode) {
+                       case 1013:      /* user requested cancel of current 
operation */
+                               zend_bailout();
+                               break;
 
 #if 0
-               case 955:       /* ORA-00955: name is already used by an 
existing object */
-                       *pdo_err = PDO_ERR_ALREADY_EXISTS;
-                       break;
+                       case 955:       /* ORA-00955: name is already used by 
an existing object */
+                               *pdo_err = PDO_ERR_ALREADY_EXISTS;
+                               break;
 #endif
 
-               case 12154:     /* ORA-12154: TNS:could not resolve service 
name */
-                       strcpy(*pdo_err, "42S02");
-                       break;
-                       
-               case 22:        /* ORA-00022: invalid session id */
-               case 1012:      /* ORA-01012: */
-               case 3113:      /* ORA-03133: end of file on communication 
channel */
-               case 604:
-               case 1041:
-                       /* consider the connection closed */
-                       dbh->is_closed = 1;
-                       H->attached = 0;
-                       strcpy(*pdo_err, "01002"); /* FIXME */
-                       break;
+                       case 12154:     /* ORA-12154: TNS:could not resolve 
service name */
+                               strcpy(*pdo_err, "42S02");
+                               break;
+                               
+                       case 22:        /* ORA-00022: invalid session id */
+                       case 1012:      /* ORA-01012: */
+                       case 3113:      /* ORA-03133: end of file on 
communication channel */
+                       case 604:
+                       case 1041:
+                               /* consider the connection closed */
+                               dbh->is_closed = 1;
+                               H->attached = 0;
+                               strcpy(*pdo_err, "01002"); /* FIXME */
+                               break;
 
-               default:
-                       strcpy(*pdo_err, "HY000");
+                       default:
+                               strcpy(*pdo_err, "HY000");
+               }
        }
 
        /* little mini hack so that we can use this code from the dbh ctor */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to