georg           Tue Mar  9 07:01:26 2004 EDT

  Modified files:              
    /php-src/ext/mysqli config.m4 mysqli_api.c mysqli_fe.c php_mysqli.h 
  Log:
  fixed memleaks in bind functions
  added 4.1.2 support (renamed functions)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/config.m4?r1=1.14&r2=1.15&ty=u
Index: php-src/ext/mysqli/config.m4
diff -u php-src/ext/mysqli/config.m4:1.14 php-src/ext/mysqli/config.m4:1.15
--- php-src/ext/mysqli/config.m4:1.14   Fri Feb 20 08:09:14 2004
+++ php-src/ext/mysqli/config.m4        Tue Mar  9 07:01:23 2004
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.14 2004/02/20 13:09:14 georg Exp $
+dnl $Id: config.m4,v 1.15 2004/03/09 12:01:23 georg Exp $
 dnl config.m4 for extension mysqli
 
 PHP_ARG_WITH(mysqli, for MySQLi support,
@@ -39,11 +39,15 @@
   dnl
   dnl Check the library
   dnl
-  PHP_CHECK_LIBRARY(mysqlclient, mysql_bind_param,
+  PHP_CHECK_LIBRARY(mysqlclient, mysql_set_server_option,
   [
     PHP_EVAL_INCLINE($MYSQLI_INCLINE)
     PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD)
     AC_DEFINE(HAVE_MYSQLILIB,1,[ ])
+    PHP_CHECK_LIBRARY(mysqlclient, mysql_bind_param,
+    [
+       AC_DEFINE(HAVE_MYSQLI_OLDAPI,1,[ ])
+    ],[],[])
   ],[
     AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for 
more information.])
   ],[
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.77&r2=1.78&ty=u
Index: php-src/ext/mysqli/mysqli_api.c
diff -u php-src/ext/mysqli/mysqli_api.c:1.77 php-src/ext/mysqli/mysqli_api.c:1.78
--- php-src/ext/mysqli/mysqli_api.c:1.77        Thu Feb 26 07:24:21 2004
+++ php-src/ext/mysqli/mysqli_api.c     Tue Mar  9 07:01:23 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_api.c,v 1.77 2004/02/26 12:24:21 georg Exp $ 
+  $Id: mysqli_api.c,v 1.78 2004/03/09 12:01:23 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -68,9 +68,9 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_bind_param(object stmt, string types, mixed variable 
[,mixed,....])
+/* {{{ proto bool mysqli_stmt_bind_param(object stmt, string types, mixed variable 
[,mixed,....])
    Bind variables to a prepared statement as parameters */
-PHP_FUNCTION(mysqli_bind_param)
+PHP_FUNCTION(mysqli_stmt_bind_param)
 {
        zval                    ***args;
        int                     argc = ZEND_NUM_ARGS();
@@ -170,8 +170,11 @@
                }
                ofs++;
        }
-       
+#ifndef HAVE_MYSQLI_OLDAPI     
+       rc = mysql_stmt_bind_param(stmt->stmt, bind);
+#else
        rc = mysql_bind_param(stmt->stmt, bind);
+#endif
        MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
 
        if (rc) {
@@ -197,14 +200,14 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_bind_result(object stmt, mixed var, [,mixed, ...])
+/* {{{ proto bool mysqli_stmt_bind_result(object stmt, mixed var, [,mixed, ...])
    Bind variables to a prepared statement for result storage */
 
 /* TODO:
    do_alloca, free_alloca
 */
 
-PHP_FUNCTION(mysqli_bind_result)
+PHP_FUNCTION(mysqli_stmt_bind_result)
 {
        zval            ***args;
        int             argc = ZEND_NUM_ARGS();
@@ -243,6 +246,7 @@
 
        if (var_cnt != stmt->stmt->field_count) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number of bind variables 
doesn't match number of fields in prepared statmement.");
+               efree(args);
                RETURN_FALSE;
        }
 
@@ -266,9 +270,12 @@
                        case MYSQL_TYPE_FLOAT:
                                convert_to_double_ex(args[i]);
                                stmt->result.buf[ofs].type = IS_DOUBLE;
-                               stmt->result.buf[ofs].buflen = 0;
+                               stmt->result.buf[ofs].buflen = sizeof(double);
+                               
+                               /* allocate buffer for double */
+                               stmt->result.buf[ofs].val = (char 
*)emalloc(sizeof(double));
                                bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
-                               bind[ofs].buffer = (gptr)&Z_DVAL_PP(args[i]);
+                               bind[ofs].buffer = stmt->result.buf[ofs].val;
                                bind[ofs].is_null = &stmt->result.is_null[ofs];
                                break;
 
@@ -280,17 +287,18 @@
                                convert_to_long_ex(args[i]);
                                stmt->result.buf[ofs].type = IS_LONG;
                                stmt->result.buf[ofs].buflen = 0;
+                               stmt->result.buf[ofs].val = (char 
*)emalloc(sizeof(long));
                                bind[ofs].buffer_type = MYSQL_TYPE_LONG;
-                               bind[ofs].buffer = (gptr)&Z_LVAL_PP(args[i]);
+                               bind[ofs].buffer = stmt->result.buf[ofs].val;
                                bind[ofs].is_null = &stmt->result.is_null[ofs];
                                break;
 
                        case MYSQL_TYPE_LONGLONG:
                                stmt->result.buf[ofs].type = IS_STRING; 
                                stmt->result.buf[ofs].buflen = sizeof(my_ulonglong); 
-                               stmt->result.buf[ofs].buffer = (char 
*)emalloc(stmt->result.buf[ofs].buflen);
+                               stmt->result.buf[ofs].val = (char 
*)emalloc(stmt->result.buf[ofs].buflen);
                                bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
-                               bind[ofs].buffer = stmt->result.buf[ofs].buffer;
+                               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;
                                break;
@@ -307,9 +315,9 @@
                                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;
-                               stmt->result.buf[ofs].buffer = (char 
*)emalloc(stmt->result.buf[ofs].buflen);
+                               stmt->result.buf[ofs].val = (char 
*)emalloc(stmt->result.buf[ofs].buflen);
                                bind[ofs].buffer_type = MYSQL_TYPE_STRING;
-                               bind[ofs].buffer = stmt->result.buf[ofs].buffer;
+                               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].length = &stmt->result.buf[ofs].buflen;
@@ -317,7 +325,11 @@
                }
        }
 
+#ifndef HAVE_MYSQLI_OLDAPI     
+       rc = mysql_stmt_bind_result(stmt->stmt, bind);
+#else
        rc = mysql_bind_result(stmt->stmt, bind);
+#endif
        MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
 
        if (rc) {
@@ -521,9 +533,9 @@
 }
 /* }}} */
 
-/* {{{ proto bool mysqli_execute(object stmt)
+/* {{{ proto bool mysqli_stmt_execute(object stmt)
    Execute a prepared statement */
-PHP_FUNCTION(mysqli_execute)
+PHP_FUNCTION(mysqli_stmt_execute)
 {
        STMT                    *stmt;
        zval                    *mysql_stmt;
@@ -557,8 +569,11 @@
                        }       
                }
        }
-
+#ifndef HAVE_MYSQLI_OLDAPI     
+       if (mysql_stmt_execute(stmt->stmt)) {
+#else
        if (mysql_execute(stmt->stmt)) {
+#endif
                MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
                RETURN_FALSE;
        }
@@ -570,14 +585,18 @@
 }
 /* }}} */
 
-/* {{{ proto mixed mysqli_fetch(object stmt)
+/* {{{ proto mixed mysqli_stmt_fetch(object stmt)
    Fetch results from a prepared statement into the bound variables */
-PHP_FUNCTION(mysqli_fetch)
+PHP_FUNCTION(mysqli_stmt_fetch)
 {
        STMT                    *stmt;
        zval                    *mysql_stmt;
        unsigned int    i;
        ulong                   ret;
+       long                    lval;
+       double                  dval;
+       my_ulonglong    llval;
+       
 
        if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
                return;
@@ -589,41 +608,44 @@
 
        for (i = 0; i < stmt->result.var_cnt; i++) {
                if (stmt->result.buf[i].type == IS_STRING) {
-                       memset(stmt->result.buf[i].buffer, 0, 
stmt->result.buf[i].buflen);
+                       memset(stmt->result.buf[i].val, 0, stmt->result.buf[i].buflen);
                }
        }
-       
+#ifndef HAVE_MYSQLI_OLDAPI     
+       if (!(ret = mysql_stmt_fetch(stmt->stmt))) {
+#else
        if (!(ret = mysql_fetch(stmt->stmt))) {
-
+#endif
                for (i = 0; i < stmt->result.var_cnt; i++) {
+                       if (stmt->result.vars[i]->type == IS_STRING && 
stmt->result.vars[i]->value.str.len) {
+                       efree(stmt->result.vars[i]->value.str.val);
+                       }
                        if (!stmt->result.is_null[i]) {
                                switch (stmt->result.buf[i].type) {
                                        case IS_LONG:
-                                               stmt->result.vars[i]->type = IS_LONG;
+                                               memcpy(&lval, stmt->result.buf[i].val, 
sizeof(long));
+                                               ZVAL_LONG(stmt->result.vars[i], lval);
                                                break;
                                        case IS_DOUBLE:
-                                               stmt->result.vars[i]->type = IS_DOUBLE;
+                                               memcpy(&dval, stmt->result.buf[i].val, 
sizeof(double));
+                                               ZVAL_DOUBLE(stmt->result.vars[i], 
dval);
                                                break;
                                        case IS_STRING:
                                                if (stmt->stmt->bind[i].buffer_type == 
MYSQL_TYPE_LONGLONG) {
                                                        char tmp[50];
-                                                       my_ulonglong lval;
-                                                       memcpy (&lval, 
stmt->result.buf[i].buffer, sizeof(my_ulonglong));
-                                                       if (lval != (long)lval) {
+                                                       memcpy (&llval, 
stmt->result.buf[i].val, sizeof(my_ulonglong));
+                                                       if (llval != (long)llval) {
                                                                /* even though lval is 
declared as unsigned, the value
                                                                 * may be negative. 
Therefor we cannot use %llu and must
                                                                 * use %lld.
                                                                 */
-                                                               sprintf((char *)&tmp, 
"%lld", lval);
+                                                               sprintf((char *)&tmp, 
"%lld", llval);
                                                                
ZVAL_STRING(stmt->result.vars[i], tmp, 1);
                                                        } else {
-                                                               
ZVAL_LONG(stmt->result.vars[i], lval);
+                                                               
ZVAL_LONG(stmt->result.vars[i], llval);
                                                        }
                                                } else {
-                                                       if (stmt->result.vars[i]->type 
== IS_STRING) {
-                                                               
efree(stmt->result.vars[i]->value.str.val);
-                                                       } 
-                                                       
ZVAL_STRING(stmt->result.vars[i], stmt->result.buf[i].buffer, 1); 
+                                                       
ZVAL_STRING(stmt->result.vars[i], stmt->result.buf[i].val, 1); 
                                                }
                                                break;
                                        default:
@@ -1128,7 +1150,7 @@
 
 /* {{{ proto int mysqli_param_count(object stmt) {
    Return the number of parameter for the given statement */
-PHP_FUNCTION(mysqli_param_count)
+PHP_FUNCTION(mysqli_stmt_param_count)
 {
        STMT            *stmt;
        zval            *mysql_stmt;
@@ -1138,7 +1160,11 @@
        }
        MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt"); 
                
+#ifndef HAVE_MYSQLI_OLDAPI     
+       RETURN_LONG(mysql_stmt_param_count(stmt->stmt));
+#else
        RETURN_LONG(mysql_param_count(stmt->stmt));
+#endif
 }
 /* }}} */
 
@@ -1181,8 +1207,16 @@
 
        stmt = (STMT *)ecalloc(1,sizeof(STMT));
 
+#ifdef HAVE_MYSQLI_OLDAPI
        stmt->stmt = mysql_prepare(mysql, query, query_len); 
-
+#else
+    if ((stmt->stmt = mysql_stmt_init(mysql))) {
+               if (mysql_stmt_prepare(stmt->stmt, query, query_len)) {
+                       mysql_stmt_close(stmt->stmt);
+                       stmt->stmt = NULL;
+               }
+       } 
+#endif
        if (!stmt->stmt) {
                MYSQLI_REPORT_MYSQL_ERROR(mysql);
                efree(stmt);
@@ -1195,31 +1229,6 @@
 }
 /* }}} */
 
-/* {{{ proto mixed mysqli_get_metadata(object stmt)
-   return result set from statement */
-PHP_FUNCTION(mysqli_get_metadata)
-{
-       STMT                    *stmt;
-       MYSQL_RES               *result;
-       zval                    *mysql_stmt;
-       MYSQLI_RESOURCE *mysqli_resource;
-
-       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"); 
-       
-       if (!(result = mysql_get_metadata(stmt->stmt))){
-               MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
-               RETURN_FALSE;
-       }
-
-       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
-       mysqli_resource->ptr = (void *)result;
-       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);     
-}
-/* }}} */
-
 /* {{{ proto bool mysqli_real_connect(object link [,string hostname [,string username 
[,string passwd [,string dbname [,int port [,string socket [,int flags]]]]]]])
    Open a connection to a mysql server */ 
 PHP_FUNCTION(mysqli_real_connect)
@@ -1355,7 +1364,7 @@
 
 /* {{{ proto bool mysqli_send_long_data(object stmt, int param_nr, string data)
 */
-PHP_FUNCTION(mysqli_send_long_data)
+PHP_FUNCTION(mysqli_stmt_send_long_data)
 {
        STMT    *stmt;
        zval    *mysql_stmt;
@@ -1372,8 +1381,11 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter 
number");
                RETURN_FALSE;
        }
-
+#ifndef HAVE_MYSQLI_OLDAPI     
+       if (mysql_stmt_send_long_data(stmt->stmt, param_nr, data, data_len)) {
+#else
        if (mysql_send_long_data(stmt->stmt, param_nr, data, data_len)) {
+#endif
                RETURN_FALSE;
        }
        RETURN_TRUE;
@@ -1605,6 +1617,85 @@
 }
 /* }}} */
 
+#ifndef HAVE_MYSQLI_OLDAPI
+/* {{{ proto object mysqli_stmt_init(object link)
+   Initialize statement object
+*/
+PHP_FUNCTION(mysqli_stmt_init)
+{
+       MYSQL                   *mysql;
+       STMT                    *stmt;
+       zval                    *mysql_link;
+       MYSQLI_RESOURCE *mysqli_resource; 
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), 
"O",&mysql_link, mysqli_link_class_entry) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(mysql, MYSQL *, &mysql_link, "mysqli_link");
+
+       if (!(stmt->stmt = mysql_stmt_init(mysql))) {
+               RETURN_FALSE;
+       }
+
+       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+       mysqli_resource->ptr = (void *)stmt;
+       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_stmt_class_entry);
+}
+/* }}} */
+
+/* {{{ proto bool mysqli_stmt_prepare(object link, string query)
+   prepare server side statement with query
+*/
+PHP_FUNCTION(mysqli_stmt_prepare)
+{
+       STMT    *stmt;
+       zval    *mysql_stmt;
+       char    *query;
+       int             query_len;
+
+       if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", 
&mysql_stmt, mysqli_stmt_class_entry, &query, &query_len) == FAILURE) {
+               return;
+       }
+       MYSQLI_FETCH_RESOURCE(stmt, STMT *, &mysql_stmt, "mysqli_stmt");
+
+       if (mysql_stmt_prepare(stmt->stmt, query, query_len)) {
+               MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
+               RETURN_FALSE;
+       }
+       RETURN_TRUE;
+}
+/* }}} */
+#endif
+
+/* {{{ proto mixed mysqli_stmt_result_metadata(object stmt)
+   return result set from statement */
+PHP_FUNCTION(mysqli_stmt_result_metadata)
+{
+       STMT                    *stmt;
+       MYSQL_RES               *result;
+       zval                    *mysql_stmt;
+       MYSQLI_RESOURCE *mysqli_resource;
+
+       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"); 
+
+#ifndef HAVE_MYSQLI_OLDAPI     
+       if (!(result = mysql_stmt_result_metadata(stmt->stmt))){
+#else
+       if (!(result = mysql_get_metadata(stmt->stmt))){
+#endif
+               MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
+               RETURN_FALSE;
+       }
+
+       mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+       mysqli_resource->ptr = (void *)result;
+       MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);     
+}
+/* }}} */
+
 /* {{{ proto bool mysqli_stmt_store_result(stmt)
 */
 PHP_FUNCTION(mysqli_stmt_store_result)
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.31&r2=1.32&ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.31 php-src/ext/mysqli/mysqli_fe.c:1.32
--- php-src/ext/mysqli/mysqli_fe.c:1.31 Wed Mar  3 13:54:20 2004
+++ php-src/ext/mysqli/mysqli_fe.c      Tue Mar  9 07:01:23 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: mysqli_fe.c,v 1.31 2004/03/03 18:54:20 edink Exp $ 
+  $Id: mysqli_fe.c,v 1.32 2004/03/09 12:01:23 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -53,12 +53,8 @@
 function_entry mysqli_functions[] = {
        PHP_FE(mysqli_affected_rows,                                            NULL)
        PHP_FE(mysqli_autocommit,                                                      
 NULL)
-       PHP_FE(mysqli_bind_param,                                                      
 third_arg_force_by_ref_rest)
-       PHP_FE(mysqli_bind_result,                                                     
 second_arg_force_by_ref_rest)
        PHP_FE(mysqli_change_user,                                                     
 NULL)
        PHP_FE(mysqli_character_set_name,                                       NULL)
-       PHP_FALIAS(mysqli_client_encoding, 
-                          mysqli_character_set_name,                           NULL)
        PHP_FE(mysqli_close,                                                           
 NULL)
        PHP_FE(mysqli_commit,                                                          
 NULL)
        PHP_FE(mysqli_connect,                                                         
 NULL)
@@ -76,8 +72,8 @@
        PHP_FE(mysqli_enable_rpl_parse,                                         NULL)
        PHP_FE(mysqli_errno,                                                           
 NULL)
        PHP_FE(mysqli_error,                                                           
 NULL)
-       PHP_FE(mysqli_execute,                                                         
 NULL)
-       PHP_FE(mysqli_fetch,                                                           
 NULL)
+       PHP_FE(mysqli_stmt_execute,                                                    
 NULL)
+       PHP_FALIAS(mysqli_execute, mysqli_stmt_execute,         NULL)
        PHP_FE(mysqli_fetch_field,                                                     
 NULL)
        PHP_FE(mysqli_fetch_fields,                                                    
 NULL)
        PHP_FE(mysqli_fetch_field_direct,                                       NULL)
@@ -93,7 +89,6 @@
        PHP_FE(mysqli_get_client_info,                                          NULL)
        PHP_FE(mysqli_get_client_version,                                       NULL)
        PHP_FE(mysqli_get_host_info,                                            NULL)
-       PHP_FE(mysqli_get_metadata,                                                    
 NULL)
        PHP_FE(mysqli_get_proto_info,                                           NULL)
        PHP_FE(mysqli_get_server_info,                                          NULL)
        PHP_FE(mysqli_get_server_version,                                       NULL)
@@ -108,28 +103,33 @@
        PHP_FE(mysqli_num_fields,                                                      
 NULL)
        PHP_FE(mysqli_num_rows,                                                        
 NULL)
        PHP_FE(mysqli_options,                                                         
 NULL)
-       PHP_FE(mysqli_param_count,                                                     
 NULL)
        PHP_FE(mysqli_ping,                                                            
         NULL)
        PHP_FE(mysqli_prepare,                                                         
 NULL)
        PHP_FE(mysqli_report,                                                          
 NULL)
        PHP_FE(mysqli_query,                                                           
 NULL)
        PHP_FE(mysqli_real_connect,                                                    
 NULL)
        PHP_FE(mysqli_real_escape_string,                                       NULL)
-       PHP_FALIAS(mysqli_escape_string, 
-                               mysqli_real_escape_string,                             
 NULL)
        PHP_FE(mysqli_real_query,                                                      
 NULL)
        PHP_FE(mysqli_rollback,                                                        
 NULL)
        PHP_FE(mysqli_rpl_parse_enabled,                                        NULL)
        PHP_FE(mysqli_rpl_probe,                                                       
 NULL)
        PHP_FE(mysqli_rpl_query_type,                                           NULL)
        PHP_FE(mysqli_select_db,                                                       
 NULL)
-       PHP_FE(mysqli_send_long_data,                                           NULL)
+#ifndef HAVE_MYSQLI_OLDAPI
+       PHP_FE(mysqli_stmt_init,                                                       
 NULL)
+       PHP_FE(mysqli_stmt_prepare,                                                    
 NULL)
+#endif
+       PHP_FE(mysqli_stmt_result_metadata,                                     NULL)
+       PHP_FE(mysqli_stmt_send_long_data,                                      NULL)
+       PHP_FE(mysqli_stmt_bind_param,                                          
third_arg_force_by_ref_rest)
+       PHP_FE(mysqli_stmt_bind_result,                                         
second_arg_force_by_ref_rest)
+       PHP_FE(mysqli_stmt_fetch,                                                      
 NULL)
+       PHP_FE(mysqli_stmt_param_count,                                         NULL)
        PHP_FE(mysqli_send_query,                                                      
 NULL)
 #ifdef HAVE_EMBEDDED_MYSQLI
        PHP_FE(mysqli_server_end,                                                      
 NULL)
        PHP_FE(mysqli_server_init,                                                     
 NULL)
 #endif
-       PHP_FALIAS(mysqli_set_opt,              mysqli_options,         NULL)
        PHP_FE(mysqli_slave_query,                                                     
 NULL)
 #if MYSQL_VERSION_ID >= 40101
        PHP_FE(mysqli_sqlstate,                                                        
 NULL)
@@ -151,6 +151,25 @@
        PHP_FE(mysqli_thread_safe,                                                     
 NULL)
        PHP_FE(mysqli_use_result,                                                      
 NULL)
        PHP_FE(mysqli_warning_count,                                            NULL)
+
+       /* Aliases */
+       PHP_FALIAS(mysqli_bind_param,
+                               mysqli_stmt_bind_param,                                
 third_arg_force_by_ref_rest)
+       PHP_FALIAS(mysqli_bind_result,
+                               mysqli_stmt_bind_result,                               
 second_arg_force_by_ref_rest)
+       PHP_FALIAS(mysqli_client_encoding, 
+                          mysqli_character_set_name,                           NULL)
+       PHP_FALIAS(mysqli_escape_string, 
+                               mysqli_real_escape_string,                             
 NULL)
+       PHP_FALIAS(mysqli_fetch, mysqli_stmt_fetch,                     NULL)
+       PHP_FALIAS(mysqli_param_count,
+                               mysqli_stmt_param_count,                               
 NULL)
+       PHP_FALIAS(mysqli_get_metadata,
+                               mysqli_stmt_result_metadata,                    NULL)
+       PHP_FALIAS(mysqli_send_long_data,
+                               mysqli_stmt_send_long_data,                            
 NULL)
+       PHP_FALIAS(mysqli_set_opt,              mysqli_options,         NULL)
+
        {NULL, NULL, NULL}      /* Must be the last line in mysqli_functions[] */
 };
 /* }}} */
@@ -199,6 +218,9 @@
        PHP_FALIAS(slave_query,mysqli_slave_query,NULL)
        PHP_FALIAS(ssl_set,mysqli_ssl_set,NULL)
        PHP_FALIAS(stat,mysqli_stat,NULL)
+#ifndef HAVE_MYSQLI_OLDAPI
+       PHP_FALIAS(stmt_init,mysqli_stmt_init, NULL)
+#endif
        PHP_FALIAS(store_result,mysqli_store_result,NULL)
        PHP_FALIAS(thread_safe,mysqli_thread_safe,NULL)
        PHP_FALIAS(use_result,mysqli_use_result,NULL)
@@ -234,16 +256,19 @@
  */
 function_entry mysqli_stmt_methods[] = {
        PHP_FALIAS(affected_rows,mysqli_stmt_affected_rows,NULL)
-       PHP_FALIAS(bind_param,mysqli_bind_param,second_arg_force_by_ref_rest)
-       PHP_FALIAS(bind_result,mysqli_bind_result,all_args_force_by_ref)
+       PHP_FALIAS(bind_param,mysqli_stmt_bind_param,second_arg_force_by_ref_rest)
+       PHP_FALIAS(bind_result,mysqli_stmt_bind_result,all_args_force_by_ref)
        PHP_FALIAS(close,mysqli_stmt_close,NULL)
        PHP_FALIAS(data_seek,mysqli_stmt_data_seek,NULL)
-       PHP_FALIAS(execute,mysqli_execute,NULL)
-       PHP_FALIAS(fetch,mysqli_fetch,NULL)
-       PHP_FALIAS(get_metadata, mysqli_get_metadata,NULL)
+       PHP_FALIAS(execute,mysqli_stmt_execute,NULL)
+       PHP_FALIAS(fetch,mysqli_stmt_fetch,NULL)
+       PHP_FALIAS(get_metadata, mysqli_stmt_result_metadata,NULL)
        PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)
-       PHP_FALIAS(send_long_data,mysqli_send_long_data,NULL)
+       PHP_FALIAS(send_long_data,mysqli_stmt_send_long_data,NULL)
        PHP_FALIAS(stmt,mysqli_prepare,NULL)
+#ifndef HAVE_MYSQLI_OLDAPI
+       PHP_FALIAS(prepare,mysqli_stmt_prepare, NULL)
+#endif
        PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL)
        {NULL, NULL, NULL}
 };
http://cvs.php.net/diff.php/php-src/ext/mysqli/php_mysqli.h?r1=1.32&r2=1.33&ty=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.32 php-src/ext/mysqli/php_mysqli.h:1.33
--- php-src/ext/mysqli/php_mysqli.h:1.32        Thu Feb 26 07:33:23 2004
+++ php-src/ext/mysqli/php_mysqli.h     Tue Mar  9 07:01:23 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>                                |
   +----------------------------------------------------------------------+
 
-  $Id: php_mysqli.h,v 1.32 2004/02/26 12:33:23 sniper Exp $ 
+  $Id: php_mysqli.h,v 1.33 2004/03/09 12:01:23 georg Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -30,10 +30,9 @@
 #ifndef PHP_MYSQLI_H
 #define PHP_MYSQLI_H
 
-
 typedef struct {
        ulong           buflen;
-       char            *buffer;
+       char            *val;
        ulong           type;
 } VAR_BUFFER;
 
@@ -259,8 +258,6 @@
 PHP_FUNCTION(mysqli);
 PHP_FUNCTION(mysqli_affected_rows);
 PHP_FUNCTION(mysqli_autocommit);
-PHP_FUNCTION(mysqli_bind_param);
-PHP_FUNCTION(mysqli_bind_result);
 PHP_FUNCTION(mysqli_change_user);
 PHP_FUNCTION(mysqli_character_set_name);
 PHP_FUNCTION(mysqli_close);
@@ -280,8 +277,6 @@
 PHP_FUNCTION(mysqli_enable_rpl_parse);
 PHP_FUNCTION(mysqli_errno);
 PHP_FUNCTION(mysqli_error);
-PHP_FUNCTION(mysqli_execute);
-PHP_FUNCTION(mysqli_fetch);
 PHP_FUNCTION(mysqli_fetch_array);
 PHP_FUNCTION(mysqli_fetch_assoc);
 PHP_FUNCTION(mysqli_fetch_object);
@@ -311,11 +306,10 @@
 PHP_FUNCTION(mysqli_num_fields);
 PHP_FUNCTION(mysqli_num_rows);
 PHP_FUNCTION(mysqli_options);
-PHP_FUNCTION(mysqli_param_count);
 PHP_FUNCTION(mysqli_ping);
 PHP_FUNCTION(mysqli_prepare);
 PHP_FUNCTION(mysqli_query);
-PHP_FUNCTION(mysqli_get_metadata);
+PHP_FUNCTION(mysqli_stmt_result_metadata);
 PHP_FUNCTION(mysqli_report);
 PHP_FUNCTION(mysqli_read_query_result);
 PHP_FUNCTION(mysqli_real_connect);
@@ -327,7 +321,16 @@
 PHP_FUNCTION(mysqli_rpl_probe);
 PHP_FUNCTION(mysqli_rpl_query_type);
 PHP_FUNCTION(mysqli_select_db);
-PHP_FUNCTION(mysqli_send_long_data);
+PHP_FUNCTION(mysqli_stmt_bind_param);
+PHP_FUNCTION(mysqli_stmt_bind_result);
+PHP_FUNCTION(mysqli_stmt_execute);
+#ifndef MYSQLI_HAVE_OLDAPI
+PHP_FUNCTION(mysqli_stmt_init);
+PHP_FUNCTION(mysqli_stmt_prepare);
+#endif
+PHP_FUNCTION(mysqli_stmt_fetch);
+PHP_FUNCTION(mysqli_stmt_param_count);
+PHP_FUNCTION(mysqli_stmt_send_long_data);
 PHP_FUNCTION(mysqli_send_query);
 #ifdef HAVE_EMBEDDED_MYSQLI
 PHP_FUNCTION(mysqli_server_init);

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

Reply via email to