georg           Tue Mar 16 16:43:26 2004 EDT

  Modified files:              
    /php-src/ext/mysqli mysqli.c php_mysqli.h mysqli_api.c 
                        mysqli_report.c mysqli_prop.c 
  Log:
  fixed stmt->stmt->query which was removed in libmysql 4.1.2
  added query buffer in internal stmt structure to copy string
  after prepare
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.34&r2=1.35&ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.34 php-src/ext/mysqli/mysqli.c:1.35
--- php-src/ext/mysqli/mysqli.c:1.34    Tue Mar  9 09:29:20 2004
+++ php-src/ext/mysqli/mysqli.c Tue Mar 16 16:43:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli.c,v 1.34 2004/03/09 14:29:20 helly Exp $ 
+  $Id: mysqli.c,v 1.35 2004/03/16 21:43:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -64,11 +64,14 @@
        }
 
        for (i=0; i < bbuf.var_cnt; i++) {
+
+               /* free temporary bind buffer */
                if (type == FETCH_RESULT) {
                        if (bbuf.buf[i].type == IS_STRING) {
                                efree(bbuf.buf[i].val);
                        }
                }
+
                if (bbuf.vars[i]) {
                        zval_ptr_dtor(&bbuf.vars[i]);
                }       
@@ -96,6 +99,9 @@
        php_free_stmt_bind_buffer(stmt->param, FETCH_SIMPLE);
        php_free_stmt_bind_buffer(stmt->result, FETCH_RESULT);
 
+       if (stmt->query) {
+               efree(stmt->query);
+       }
        efree(stmt);
        return;
 }
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.34&r2=1.35&ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.34 php-src/ext/mysqli/php_mysqli.h:1.35
--- php-src/ext/mysqli/php_mysqli.h:1.34        Wed Mar 10 04:50:05 2004
+++ php-src/ext/mysqli/php_mysqli.h     Tue Mar 16 16:43:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: php_mysqli.h,v 1.34 2004/03/10 09:50:05 georg Exp $ 
+  $Id: php_mysqli.h,v 1.35 2004/03/16 21:43:25 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -47,6 +47,7 @@
        MYSQL_STMT      *stmt;
        BIND_BUFFER     param;
        BIND_BUFFER     result;
+       char            *query;
 } STMT;
 
 typedef struct {
@@ -349,6 +350,7 @@
 PHP_FUNCTION(mysqli_stmt_error);
 #ifndef HAVE_MYSQLI_OLDAPI
 PHP_FUNCTION(mysqli_stmt_free_result);
+PHP_FUNCTION(mysqli_stmt_reset);
 #endif
 PHP_FUNCTION(mysqli_stmt_num_rows);
 #if MYSQL_VERSION_ID >= 40101
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.79&r2=1.80&ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.79 php-src/ext/mysqli/mysqli_api.c:1.80
--- php-src/ext/mysqli/mysqli_api.c:1.79        Wed Mar 10 04:50:05 2004
+++ php-src/ext/mysqli/mysqli_api.c     Tue Mar 16 16:43:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.79 2004/03/10 09:50:05 georg Exp $ 
+  $Id: mysqli_api.c,v 1.80 2004/03/16 21:43:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -578,7 +578,7 @@
                RETURN_FALSE;
        }
        if (MyG(report_mode) & MYSQLI_REPORT_INDEX) {
-               php_mysqli_report_index(stmt->stmt->query, 
stmt->stmt->mysql->server_status TSRMLS_CC);
+               php_mysqli_report_index(stmt->query, stmt->stmt->mysql->server_status 
TSRMLS_CC);
        }
        
        RETURN_TRUE;
@@ -1225,6 +1225,8 @@
 
        mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
        mysqli_resource->ptr = (void *)stmt;
+       stmt->query = (query_len) ? (char *)emalloc(query_len + 1) : NULL;
+       strcpy(stmt->query, query);
        MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_stmt_class_entry);
 }
 /* }}} */
@@ -1502,6 +1504,25 @@
        return;
 }
 /* }}} */
+
+/* {{{ proto void mysqli_stmt_reset(object stmt)
+   reset a prepared statement */
+PHP_FUNCTION(mysqli_stmt_reset) 
+{
+       STMT                    *stmt;
+       zval                    *mysql_stmt;
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+               return;
+       }
+
+       MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt");
+
+       mysql_stmt_reset(stmt->stmt);
+
+       return;
+}
+/* }}} */
 #endif
 
 /* {{{ proto mixed mysqli_stmt_num_rows(object stmt)
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_report.c?r1=1.7&r2=1.8&ty=u
Index: php-src/ext/mysqli/mysqli_report.c
diff -u php-src/ext/mysqli/mysqli_report.c:1.7 php-src/ext/mysqli/mysqli_report.c:1.8
--- php-src/ext/mysqli/mysqli_report.c:1.7      Wed Feb 25 15:16:22 2004
+++ php-src/ext/mysqli/mysqli_report.c  Tue Mar 16 16:43:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_report.c,v 1.7 2004/02/25 20:16:22 abies Exp $ 
+  $Id: mysqli_report.c,v 1.8 2004/03/16 21:43:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -62,7 +62,7 @@
        } else {
                return;
        }
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s used in query %s", index, 
query);
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s used in query/prepared 
statement %s", index, query);
 #else
        return;
 #endif
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_prop.c?r1=1.11&r2=1.12&ty=u
Index: php-src/ext/mysqli/mysqli_prop.c
diff -u php-src/ext/mysqli/mysqli_prop.c:1.11 php-src/ext/mysqli/mysqli_prop.c:1.12
--- php-src/ext/mysqli/mysqli_prop.c:1.11       Thu Feb 26 07:33:23 2004
+++ php-src/ext/mysqli/mysqli_prop.c    Tue Mar 16 16:43:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_prop.c,v 1.11 2004/02/26 12:33:23 sniper Exp $ 
+  $Id: mysqli_prop.c,v 1.12 2004/03/16 21:43:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -189,7 +189,6 @@
 MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_affected_rows_read, STMT, stmt->affected_rows);
 #endif
 MYSQLI_MAP_PROPERTY_LONG_LONG(stmt_num_rows_read, STMT, stmt->result->row_count);
-MYSQLI_MAP_PROPERTY_STRING(stmt_query_read, STMT, stmt->query);
 MYSQLI_MAP_PROPERTY_LONG(stmt_param_count_read, STMT, stmt->param_count);
 MYSQLI_MAP_PROPERTY_LONG(stmt_field_count_read, STMT, stmt->field_count);
 MYSQLI_MAP_PROPERTY_LONG(stmt_id_read, STMT, stmt->stmt_id);
@@ -236,7 +235,6 @@
 mysqli_property_entry mysqli_stmt_property_entries[] = {
        {"affected_rows", stmt_affected_rows_read, NULL},
        {"num_rows", stmt_num_rows_read, NULL},
-       {"query", stmt_query_read, NULL},
        {"param_count", stmt_param_count_read, NULL},
        {"field_count", stmt_field_count_read, NULL},
        {"id", stmt_id_read, NULL},

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

Reply via email to