davidc          Tue Nov  4 18:25:26 2008 UTC

  Modified files:              
    /php-src/ext/pdo    pdo_dbh.c 
  Log:
  - Bug #44154: [DOC] Return 3 elements at all times. If the dbh stmt doesn't 
have
    an error code we used to return an array with one element. For the sake
    of consistency and verification of returned values at userland we are now
    returning an array with 3 elements. Note the two last elements are null but
    present
  
  - Bug #44153: [DOC] If the error code returned by the DBH is null, we return
    a null value. This is used in order to help with empty error codes.
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.153&r2=1.154&diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.153 php-src/ext/pdo/pdo_dbh.c:1.154
--- php-src/ext/pdo/pdo_dbh.c:1.153     Thu Oct  9 12:59:47 2008
+++ php-src/ext/pdo/pdo_dbh.c   Tue Nov  4 18:25:26 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_dbh.c,v 1.153 2008/10/09 12:59:47 felipe Exp $ */
+/* $Id: pdo_dbh.c,v 1.154 2008/11/04 18:25:26 davidc Exp $ */
 
 /* The PDO Database Handle Class */
 
@@ -988,7 +988,12 @@
        if (dbh->query_stmt) {
                RETURN_STRING(dbh->query_stmt->error_code, 1);
        }
-       
+
+       if (dbh->error_code[0] == '\0') {
+               RETURN_NULL();
+       }
+
+       // Fallback to default documented value 
        RETURN_STRING(dbh->error_code, 1);
 }
 /* }}} */
@@ -1010,6 +1015,8 @@
                add_next_index_string(return_value, 
dbh->query_stmt->error_code, 1);
        } else {
                add_next_index_string(return_value, dbh->error_code, 1);
+               add_next_index_null(return_value);
+               add_next_index_null(return_value);
        }
        if (dbh->methods->fetch_err) {
                dbh->methods->fetch_err(dbh, dbh->query_stmt, return_value 
TSRMLS_CC);


Reply via email to