]> granicus.if.org Git - php/commitdiff
- fixing all "long" into "int" fetching problems (cause memory corruption
authorAndrey Hristov <andrey@php.net>
Tue, 19 Apr 2005 12:59:16 +0000 (12:59 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 19 Apr 2005 12:59:16 +0000 (12:59 +0000)
  on 64 bit)
- nail down a problem because of the new MYSQL_TYPE_NEWDECIMAL introduced
  in MySQL 5.0+
- Add more info to the autocommit test

ext/mysqli/mysqli_api.c
ext/mysqli/tests/014.phpt

index 80777292e7174ddd07d1174c7fd58dd0c1ff4a5b..1a82a8199be5f3f737211fee5acc57cdf047e2bf 100644 (file)
@@ -310,6 +310,9 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
                        case MYSQL_TYPE_BLOB:
                        case MYSQL_TYPE_TIMESTAMP:
                        case MYSQL_TYPE_DECIMAL:
+#ifdef FIELD_TYPE_NEWDECIMAL
+                       case MYSQL_TYPE_NEWDECIMAL:
+#endif
                                stmt->result.buf[ofs].type = IS_STRING; 
                                stmt->result.buf[ofs].buflen =
                                        (stmt->stmt->fields) ? (stmt->stmt->fields[ofs].length) ? stmt->stmt->fields[ofs].length + 1: 256: 256;
@@ -749,7 +752,7 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
        MYSQL_RES       *result;
        zval            *mysql_result;
        MYSQL_FIELD *field;
-       int             offset;
+       long            offset;
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
                return;
@@ -839,7 +842,7 @@ PHP_FUNCTION(mysqli_field_seek)
 {
        MYSQL_RES               *result;
        zval                    *mysql_result;
-       unsigned int    fieldnr;
+       unsigned long   fieldnr;
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
                return;
@@ -1029,7 +1032,7 @@ PHP_FUNCTION(mysqli_kill)
 {
        MY_MYSQL        *mysql;
        zval            *mysql_link;
-       int             processid;
+       long            processid;
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
                return;
@@ -1097,7 +1100,8 @@ PHP_FUNCTION(mysqli_set_local_infile_handler)
 
 /* {{{ proto bool mysqli_more_results(object link)
    check if there any more query results from a multi query */
-PHP_FUNCTION(mysqli_more_results) {
+PHP_FUNCTION(mysqli_more_results)
+{
        MY_MYSQL                *mysql;
        zval                    *mysql_link;
 
@@ -1277,7 +1281,7 @@ PHP_FUNCTION(mysqli_real_connect)
        MY_MYSQL                *mysql;
        char                    *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
        unsigned int    hostname_len, username_len, passwd_len, dbname_len, socket_len;
-       unsigned int    port=0, flags=0;
+       unsigned long   port=0, flags=0;
        zval                    *mysql_link;
        zval                    *object = getThis();
 
@@ -1414,7 +1418,8 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
        MY_STMT *stmt;
        zval    *mysql_stmt;
        char    *data;
-       long    param_nr, data_len;
+       long    param_nr;
+       int             data_len;
 
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, &param_nr, &data, &data_len) == FAILURE) {
@@ -1693,7 +1698,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
 {
        MY_STMT *stmt;
        zval    *mysql_stmt;
-       ulong   mode;
+       zend_bool mode;
        ulong   attr;
        int             rc;
 
index f8c02dba69e2ea7542b23c266067bd6248ee6a27..a180bea75651bc5d0b1251cb0e72149bd359805e 100644 (file)
@@ -36,6 +36,7 @@ mysqli autocommit/commit/rollback
        mysqli_rollback($link);
 
        $result = mysqli_query($link, "SELECT * FROM ac_01");
+       printf("Num_of_rows=%d\n", mysqli_num_rows($result));
        $row = mysqli_fetch_row($result);
        mysqli_free_result($result);
 
@@ -54,6 +55,7 @@ mysqli autocommit/commit/rollback
        mysqli_close($link);
 ?>
 --EXPECT--
+Num_of_rows=1
 array(2) {
   [0]=>
   string(1) "1"