georg           Thu Dec 29 09:49:20 2005 EDT

  Added files:                 (Branch: PHP_5_1)
    /php-src/ext/mysqli/tests   bug35517.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/mysqli mysqli_api.c 
  Log:
  Fix for bug #35517:
        added missing unsigned flag for result buffer
        fixed returncode in mysql_stmt_fetch for data truncation
  
  
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.330&r2=1.2027.2.331&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.330 php-src/NEWS:1.2027.2.331
--- php-src/NEWS:1.2027.2.330   Wed Dec 28 20:55:13 2005
+++ php-src/NEWS        Thu Dec 29 09:49:19 2005
@@ -14,6 +14,7 @@
 - Fixed bug #35781 (stream_filter_append() can cause segfault). (Tony)
 - Fixed bug #35759 (mysqli_stmt_bind_result() makes huge allocation when
   column empty). (Andrey)
+- Fixed bug #35517 (mysql_stmt_fetch returns NULL on data truncation). (Georg)
 - Fixed bug #29955 (mb_strtoupper() / lower() broken with Turkish encoding).
   (Rui)
 - Fixed bug #28899 (mb_substr() and substr() behave differently when
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.118.2.13&r2=1.118.2.14&diff_format=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.118.2.13 
php-src/ext/mysqli/mysqli_api.c:1.118.2.14
--- php-src/ext/mysqli/mysqli_api.c:1.118.2.13  Fri Dec 23 22:22:41 2005
+++ php-src/ext/mysqli/mysqli_api.c     Thu Dec 29 09:49:19 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.118.2.13 2005/12/23 22:22:41 andrey Exp $ 
+  $Id: mysqli_api.c,v 1.118.2.14 2005/12/29 09:49:19 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -299,6 +299,7 @@
                                bind[ofs].buffer_type = MYSQL_TYPE_LONG;
                                bind[ofs].buffer = stmt->result.buf[ofs].val;
                                bind[ofs].is_null = &stmt->result.is_null[ofs];
+                               bind[ofs].is_unsigned = 
(stmt->stmt->fields[ofs].flags & UNSIGNED_FLAG) ? 1 : 0;
                                break;
 
                        case MYSQL_TYPE_LONGLONG:
@@ -309,6 +310,7 @@
                                bind[ofs].buffer = stmt->result.buf[ofs].val;
                                bind[ofs].is_null = &stmt->result.is_null[ofs];
                                bind[ofs].buffer_length = 
stmt->result.buf[ofs].buflen;
+                               bind[ofs].is_unsigned = 
(stmt->stmt->fields[ofs].flags & UNSIGNED_FLAG) ? 1 : 0;
                                break;
 
                        case MYSQL_TYPE_DATE:
@@ -721,6 +723,13 @@
 
        switch (ret) {
                case 0:
+#ifdef MYSQL_DATA_TRUNCATED
+               /* according to SQL standard truncation (e.g. loss of precision 
is
+                  not an error) - for detecting possible truncation you have 
to 
+                  check mysqli_stmt_warning
+               */
+               case MYSQL_DATA_TRUNCATED:
+#endif
                        RETURN_TRUE;
                break;
                case 1:

http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/tests/bug35517.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/bug35517.phpt
+++ php-src/ext/mysqli/tests/bug35517.phpt

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

Reply via email to