]> granicus.if.org Git - php/commitdiff
- Fixed invalid handling of float value passed to an integer field on 64bit machine
authorJani Taskinen <jani@php.net>
Mon, 29 Oct 2007 09:50:49 +0000 (09:50 +0000)
committerJani Taskinen <jani@php.net>
Mon, 29 Oct 2007 09:50:49 +0000 (09:50 +0000)
ext/mysqli/mysqli_api.c

index cf6e04eac5fab2e2761453babe62207b3089de1a..23dd0090efb1b937364c537608da27c9b4bbb2b5 100644 (file)
@@ -105,7 +105,11 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
                                break;
 
                        case 'i': /* Integer */
-                               bind[ofs].buffer_type = (sizeof(long) > 4) ? MYSQL_TYPE_LONGLONG : MYSQL_TYPE_LONG;
+#if SIZEOF_LONG==8
+                               bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
+#elif SIZEOF_LONG==4
+                               bind[ofs].buffer_type = MYSQL_TYPE_LONG;
+#endif
                                bind[ofs].buffer = &Z_LVAL_PP(args[i]);
                                bind[ofs].is_null = &stmt->param.is_null[ofs];
                                break;
@@ -735,6 +739,7 @@ PHP_FUNCTION(mysqli_stmt_execute)
                                                convert_to_double_ex(&stmt->param.vars[i]);
                                                stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);
                                                break;
+                                       case MYSQL_TYPE_LONGLONG:
                                        case MYSQL_TYPE_LONG:
                                                convert_to_long_ex(&stmt->param.vars[i]);
                                                stmt->stmt->params[i].buffer = &Z_LVAL_PP(&stmt->param.vars[i]);