wez             Wed Oct 11 02:10:56 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/pdo_odbc       odbc_driver.c odbc_stmt.c pdo_odbc.c 
                                php_pdo_odbc.h php_pdo_odbc_int.h 
  Log:
  Fix for PECL bug #8944.  Could also be the same problem as pecl #7775.
  
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_odbc/odbc_driver.c?r1=1.27.2.4&r2=1.27.2.4.2.1&diff_format=u
Index: php-src/ext/pdo_odbc/odbc_driver.c
diff -u php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.4 
php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.4.2.1
--- php-src/ext/pdo_odbc/odbc_driver.c:1.27.2.4 Sun Apr 30 01:27:33 2006
+++ php-src/ext/pdo_odbc/odbc_driver.c  Wed Oct 11 02:10:55 2006
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2005 The PHP Group                                |
+  | Copyright (c) 1997-2006 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: odbc_driver.c,v 1.27.2.4 2006/04/30 01:27:33 wez Exp $ */
+/* $Id: odbc_driver.c,v 1.27.2.4.2.1 2006/10/11 02:10:55 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_odbc/odbc_stmt.c?r1=1.26.2.2&r2=1.26.2.2.2.1&diff_format=u
Index: php-src/ext/pdo_odbc/odbc_stmt.c
diff -u php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.2 
php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.2.2.1
--- php-src/ext/pdo_odbc/odbc_stmt.c:1.26.2.2   Mon Mar 27 21:04:12 2006
+++ php-src/ext/pdo_odbc/odbc_stmt.c    Wed Oct 11 02:10:56 2006
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2005 The PHP Group                                |
+  | Copyright (c) 1997-2006 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: odbc_stmt.c,v 1.26.2.2 2006/03/27 21:04:12 wez Exp $ */
+/* $Id: odbc_stmt.c,v 1.26.2.2.2.1 2006/10/11 02:10:56 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -404,6 +404,7 @@
         * column. */
        if (colsize < 256 && !S->going_long) {
                S->cols[colno].data = emalloc(colsize+1);
+               S->cols[colno].is_long = 0;
 
                rc = SQLBindCol(S->stmt, colno+1, SQL_C_CHAR, 
S->cols[colno].data,
                        S->cols[colno].datalen+1, &S->cols[colno].fetched_len);
@@ -417,6 +418,7 @@
                 * "long" columns */
                S->cols[colno].data = emalloc(256);
                S->going_long = 1;
+               S->cols[colno].is_long = 1;
        }
 
        return 1;
@@ -428,7 +430,7 @@
        pdo_odbc_column *C = &S->cols[colno];
 
        /* if it is a column containing "long" data, perform late binding now */
-       if (C->datalen > 255) {
+       if (C->is_long) {
                unsigned long alloced = 4096;
                unsigned long used = 0;
                char *buf;
@@ -468,6 +470,11 @@
                                if (rc == SQL_NO_DATA) {
                                        /* we got the lot */
                                        break;
+                               } else if (rc != SQL_SUCCESS) {
+                                       pdo_odbc_stmt_error("SQLGetData");
+                                       if (rc != SQL_SUCCESS_WITH_INFO) {
+                                               break;
+                                       }
                                }
 
                                if (C->fetched_len == SQL_NO_TOTAL) {
@@ -476,6 +483,11 @@
                                        used += C->fetched_len;
                                }
 
+                               if (rc == SQL_SUCCESS) {
+                                       /* this was the final fetch */
+                                       break;
+                               }
+
                                /* we need to fetch another chunk; resize the
                                 * buffer */
                                alloced *= 2;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_odbc/pdo_odbc.c?r1=1.14.2.7&r2=1.14.2.7.2.1&diff_format=u
Index: php-src/ext/pdo_odbc/pdo_odbc.c
diff -u php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.7 
php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.7.2.1
--- php-src/ext/pdo_odbc/pdo_odbc.c:1.14.2.7    Sun Dec  4 22:34:26 2005
+++ php-src/ext/pdo_odbc/pdo_odbc.c     Wed Oct 11 02:10:56 2006
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2005 The PHP Group                                |
+  | Copyright (c) 1997-2006 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_odbc.c,v 1.14.2.7 2005/12/04 22:34:26 wez Exp $ */
+/* $Id: pdo_odbc.c,v 1.14.2.7.2.1 2006/10/11 02:10:56 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_odbc/php_pdo_odbc.h?r1=1.2&r2=1.2.4.1&diff_format=u
Index: php-src/ext/pdo_odbc/php_pdo_odbc.h
diff -u php-src/ext/pdo_odbc/php_pdo_odbc.h:1.2 
php-src/ext/pdo_odbc/php_pdo_odbc.h:1.2.4.1
--- php-src/ext/pdo_odbc/php_pdo_odbc.h:1.2     Thu Jul  7 12:49:21 2005
+++ php-src/ext/pdo_odbc/php_pdo_odbc.h Wed Oct 11 02:10:56 2006
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2005 The PHP Group                                |
+  | Copyright (c) 1997-2006 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_pdo_odbc.h,v 1.2 2005/07/07 12:49:21 wez Exp $ */
+/* $Id: php_pdo_odbc.h,v 1.2.4.1 2006/10/11 02:10:56 wez Exp $ */
 
 #ifndef PHP_PDO_ODBC_H
 #define PHP_PDO_ODBC_H
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_odbc/php_pdo_odbc_int.h?r1=1.9.2.1&r2=1.9.2.1.2.1&diff_format=u
Index: php-src/ext/pdo_odbc/php_pdo_odbc_int.h
diff -u php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9.2.1 
php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9.2.1.2.1
--- php-src/ext/pdo_odbc/php_pdo_odbc_int.h:1.9.2.1     Mon Mar 27 21:04:12 2006
+++ php-src/ext/pdo_odbc/php_pdo_odbc_int.h     Wed Oct 11 02:10:56 2006
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | PHP Version 5                                                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 1997-2005 The PHP Group                                |
+  | Copyright (c) 1997-2006 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.0 of the PHP license,       |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_pdo_odbc_int.h,v 1.9.2.1 2006/03/27 21:04:12 wez Exp $ */
+/* $Id: php_pdo_odbc_int.h,v 1.9.2.1.2.1 2006/10/11 02:10:56 wez Exp $ */
 
 #ifdef PHP_WIN32
 # define PDO_ODBC_TYPE "Win32"
@@ -137,6 +137,7 @@
        long fetched_len;
        SWORD   coltype;
        char colname[128];
+       unsigned is_long;
 } pdo_odbc_column;
 
 typedef struct {

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

Reply via email to