[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_fe.c php_mysqli_structs.h /ext/mysqlnd mysqlnd_enum_n_def.h mysqlnd_libmysql_compat.h
johannesThu Jan 22 20:57:33 2009 UTC Modified files: /php-src/ext/mysqlndmysqlnd_enum_n_def.h mysqlnd_libmysql_compat.h /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_fe.c php_mysqli_structs.h Log: - Export mysql_refresh to mysqli (mysqli_refresh(), $mysqli-refresh()) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_enum_n_def.h?r1=1.12r2=1.13diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_enum_n_def.h diff -u php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.12 php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.13 --- php-src/ext/mysqlnd/mysqlnd_enum_n_def.h:1.12 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_enum_n_def.hThu Jan 22 20:57:31 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: mysqlnd_enum_n_def.h,v 1.12 2008/12/31 11:12:33 sebastian Exp $ */ +/* $Id: mysqlnd_enum_n_def.h,v 1.13 2009/01/22 20:57:31 johannes Exp $ */ #ifndef MYSQLND_ENUM_N_DEF_H #define MYSQLND_ENUM_N_DEF_H @@ -431,6 +431,15 @@ #define MYSQLND_DEFAULT_PREFETCH_ROWS (ulong) 1 +#define MYSQLND_REFRESH_GRANT 1 /* Refresh grant tables */ +#define MYSQLND_REFRESH_LOG2 /* Start on new log file */ +#define MYSQLND_REFRESH_TABLES 4 /* close all tables */ +#define MYSQLND_REFRESH_HOSTS 8/* Flush host cache */ +#define MYSQLND_REFRESH_STATUS 16 /* Flush status variables */ +#define MYSQLND_REFRESH_THREADS32 /* Flush thread cache */ +#define MYSQLND_REFRESH_SLAVE 64 /* Reset master info and restart slave */ +#define MYSQLND_REFRESH_MASTER 128 /* Remove all bin logs in the index */ +#define MYSQLND_REFRESH_BACKUP_LOG 0x20L #endif /* MYSQLND_ENUM_N_DEF_H */ http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h?r1=1.9r2=1.10diff_format=u Index: php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h diff -u php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.9 php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.10 --- php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h:1.9 Wed Dec 31 11:12:33 2008 +++ php-src/ext/mysqlnd/mysqlnd_libmysql_compat.h Thu Jan 22 20:57:31 2009 @@ -73,6 +73,7 @@ #define mysql_ping(r) mysqlnd_ping((r)) #define mysql_real_escape_string(r,a,b,c) mysqlnd_real_escape_string((r), (a), (b), (c)) #define mysql_real_query(r,a,b)mysqlnd_query((r), (a), (b)) +#define mysql_refresh(conn, options) mysqlnd_refresh((conn), (options)) #define mysql_rollback(r) mysqlnd_rollback((r)) #define mysql_select_db(r,a) mysqlnd_select_db((r), (a) ,strlen((a))) #define mysql_set_server_option(r,o) mysqlnd_set_server_option((r), (o)) @@ -118,4 +119,14 @@ #define mysql_warning_count(r) mysqlnd_warning_count((r)) #define mysql_eof(r) (((r)-unbuf (r)-unbuf-eof_reached) || (r)-stored_data) +#define REFRESH_GRANT MYSQLND_REFRESH_GRANT +#define REFRESH_LOGMYSQLND_REFRESH_LOG +#define REFRESH_TABLES MYSQLND_REFRESH_TABLES +#define REFRESH_HOSTS MYSQLND_REFRESH_HOSTS +#define REFRESH_STATUS MYSQLND_REFRESH_STATUS +#define REFRESH_THREADSMYSQLND_REFRESH_THREADS +#define REFRESH_SLAVE MYSQLND_REFRESH_SLAVE +#define REFRESH_MASTER MYSQLND_REFRESH_MASTER +#define REFRESH_BACKUP_LOG MYSQLND_REFRESH_BACKUP_LOG + #endif /* MYSQLND_LIBMYSQL_COMPAT_H */ http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.142r2=1.143diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.142 php-src/ext/mysqli/mysqli.c:1.143 --- php-src/ext/mysqli/mysqli.c:1.142 Mon Jan 12 12:54:17 2009 +++ php-src/ext/mysqli/mysqli.c Thu Jan 22 20:57:32 2009 @@ -17,7 +17,7 @@ | Ulf Wendel u...@php.net | +--+ - $Id: mysqli.c,v 1.142 2009/01/12 12:54:17 johannes Exp $ + $Id: mysqli.c,v 1.143 2009/01/22 20:57:32 johannes Exp $ */ #ifdef HAVE_CONFIG_H @@ -869,6 +869,18 @@ REGISTER_LONG_CONSTANT(MYSQLI_SERVER_QUERY_WAS_SLOW, SERVER_QUERY_WAS_SLOW, CONST_CS | CONST_PERSISTENT); #endif + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_GRANT, REFRESH_GRANT, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_LOG,REFRESH_LOG, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_TABLES, REFRESH_TABLES, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_HOSTS, REFRESH_HOSTS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_STATUS, REFRESH_STATUS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_THREADS,REFRESH_THREADS, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(MYSQLI_REFRESH_SLAVE,
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c /ext/mysqli/tests bug46109.phpt
andrey Fri Sep 19 11:35:37 2008 UTC Added files: /php-src/ext/mysqli/tests bug46109.phpt Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c Log: Fix for bug#46019 MySQLi::init() leaks memory http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.133r2=1.134diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.133 php-src/ext/mysqli/mysqli.c:1.134 --- php-src/ext/mysqli/mysqli.c:1.133 Mon Sep 15 18:07:58 2008 +++ php-src/ext/mysqli/mysqli.c Fri Sep 19 11:35:37 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.133 2008/09/15 18:07:58 andrey Exp $ + $Id: mysqli.c,v 1.134 2008/09/19 11:35:37 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1255,7 +1255,7 @@ } else { ZVAL_STRINGL(res, row[i], field_len[i], 1); } - + if (m if (fetchtype MYSQLI_NUM) { add_index_zval(return_value, i, res); } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.168r2=1.169diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.168 php-src/ext/mysqli/mysqli_api.c:1.169 --- php-src/ext/mysqli/mysqli_api.c:1.168 Sat Aug 2 04:40:44 2008 +++ php-src/ext/mysqli/mysqli_api.c Fri Sep 19 11:35:37 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_api.c,v 1.168 2008/08/02 04:40:44 felipe Exp $ + $Id: mysqli_api.c,v 1.169 2008/09/19 11:35:37 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1364,7 +1364,13 @@ PHP_FUNCTION(mysqli_init) { MYSQLI_RESOURCE *mysqli_resource; - MY_MYSQL *mysql = (MY_MYSQL *)ecalloc(1, sizeof(MY_MYSQL)); + MY_MYSQL *mysql; + + if (getThis() instanceof_function(Z_OBJCE_P(getThis()), mysqli_link_class_entry TSRMLS_CC)) { + return; + } + + mysql = (MY_MYSQL *)ecalloc(1, sizeof(MY_MYSQL)); #if !defined(MYSQLI_USE_MYSQLND) if (!(mysql-mysql = mysql_init(NULL))) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug46109.phpt?view=markuprev=1.1 Index: php-src/ext/mysqli/tests/bug46109.phpt +++ php-src/ext/mysqli/tests/bug46109.phpt --TEST-- Bug #46109 (MySQLi::init - Memory leaks) --SKIPIF-- ?php require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); ? --FILE-- ?php include connect.inc; $mysqli = new mysqli(); $mysqli-init(); $mysqli-init(); echo done; ? --EXPECTF-- done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c /ext/mysqli/tests bug46109.phpt
Err.. This can't be right, Andrey. On 19.09.2008 15:35, Andrey Hristov wrote: http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.133r2=1.134diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.133 php-src/ext/mysqli/mysqli.c:1.134 --- php-src/ext/mysqli/mysqli.c:1.133 Mon Sep 15 18:07:58 2008 +++ php-src/ext/mysqli/mysqli.c Fri Sep 19 11:35:37 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.133 2008/09/15 18:07:58 andrey Exp $ + $Id: mysqli.c,v 1.134 2008/09/19 11:35:37 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1255,7 +1255,7 @@ } else { ZVAL_STRINGL(res, row[i], field_len[i], 1); } - + if (m if (fetchtype MYSQLI_NUM) { add_index_zval(return_value, i, res); } -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c /ext/mysqli/tests bug46109.phpt
Hi Tony, I noticed it when I saw what files are being committed :( Sorry! Andrey Antony Dovgal wrote: Err.. This can't be right, Andrey. On 19.09.2008 15:35, Andrey Hristov wrote: http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.133r2=1.134diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.133 php-src/ext/mysqli/mysqli.c:1.134 --- php-src/ext/mysqli/mysqli.c:1.133Mon Sep 15 18:07:58 2008 +++ php-src/ext/mysqli/mysqli.c Fri Sep 19 11:35:37 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.133 2008/09/15 18:07:58 andrey Exp $ + $Id: mysqli.c,v 1.134 2008/09/19 11:35:37 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1255,7 +1255,7 @@ } else { ZVAL_STRINGL(res, row[i], field_len[i], 1); } - +if (m if (fetchtype MYSQLI_NUM) { add_index_zval(return_value, i, res); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_fe.c mysqli_nonapi.c php_mysqli_structs.h /ext/mysqli/tests bug39457.phpt
andrey Sat Mar 8 15:16:08 2008 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_fe.c mysqli_nonapi.c php_mysqli_structs.h /php-src/ext/mysqli/tests bug39457.phpt Log: MFB: - Fixed problem with $mysqli-connect() not connecting with defaults - Fixed leak (#39475) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.122r2=1.123diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.122 php-src/ext/mysqli/mysqli.c:1.123 --- php-src/ext/mysqli/mysqli.c:1.122 Tue Feb 12 22:06:06 2008 +++ php-src/ext/mysqli/mysqli.c Sat Mar 8 15:16:08 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.122 2008/02/12 22:06:06 andrey Exp $ + $Id: mysqli.c,v 1.123 2008/03/08 15:16:08 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -57,8 +57,6 @@ #endif -extern void php_mysqli_connect(INTERNAL_FUNCTION_PARAMETERS); - typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC); typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval TSRMLS_DC); @@ -426,7 +424,7 @@ f.type = ZEND_INTERNAL_FUNCTION; if (obj-zo.ce == mysqli_link_class_entry) { - f.handler = ZEND_FN(mysqli_connect); + f.handler = ZEND_FN(mysqli_link_construct); } else if (obj-zo.ce == mysqli_stmt_class_entry) { f.handler = ZEND_FN(mysqli_stmt_construct); } else if (obj-zo.ce == mysqli_result_class_entry) { http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.158r2=1.159diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.158 php-src/ext/mysqli/mysqli_api.c:1.159 --- php-src/ext/mysqli/mysqli_api.c:1.158 Wed Feb 6 11:35:44 2008 +++ php-src/ext/mysqli/mysqli_api.c Sat Mar 8 15:16:08 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_api.c,v 1.158 2008/02/06 11:35:44 andrey Exp $ + $Id: mysqli_api.c,v 1.159 2008/03/08 15:16:08 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1669,7 +1669,7 @@ Open a connection to a mysql server */ PHP_FUNCTION(mysqli_real_connect) { - mysqli_common_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE); + mysqli_common_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE, FALSE); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_fe.c?r1=1.60r2=1.61diff_format=u Index: php-src/ext/mysqli/mysqli_fe.c diff -u php-src/ext/mysqli/mysqli_fe.c:1.60 php-src/ext/mysqli/mysqli_fe.c:1.61 --- php-src/ext/mysqli/mysqli_fe.c:1.60 Mon Dec 31 07:12:11 2007 +++ php-src/ext/mysqli/mysqli_fe.c Sat Mar 8 15:16:08 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_fe.c,v 1.60 2007/12/31 07:12:11 sebastian Exp $ + $Id: mysqli_fe.c,v 1.61 2008/03/08 15:16:08 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -211,7 +211,7 @@ PHP_FALIAS(set_local_infile_handler,mysqli_set_local_infile_handler,NULL) #endif PHP_FALIAS(multi_query,mysqli_multi_query,NULL) - PHP_FALIAS(mysqli,mysqli_connect,NULL) + PHP_FALIAS(mysqli,mysqli_link_construct,NULL) PHP_FALIAS(more_results,mysqli_more_results, NULL) PHP_FALIAS(next_result, mysqli_next_result, NULL) PHP_FALIAS(options,mysqli_options,NULL) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_nonapi.c?r1=1.79r2=1.80diff_format=u Index: php-src/ext/mysqli/mysqli_nonapi.c diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.79 php-src/ext/mysqli/mysqli_nonapi.c:1.80 --- php-src/ext/mysqli/mysqli_nonapi.c:1.79 Tue Mar 4 23:39:15 2008 +++ php-src/ext/mysqli/mysqli_nonapi.c Sat Mar 8 15:16:08 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_nonapi.c,v 1.79 2008/03/04 23:39:15 felipe Exp $ + $Id: mysqli_nonapi.c,v 1.80 2008/03/08 15:16:08 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -33,7 +33,7 @@ #define SAFE_STR(a) ((a)?a:) -void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_connect) +void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_connect, zend_bool in_ctor) { MY_MYSQL*mysql = NULL; MYSQLI_RESOURCE *mysqli_resource = NULL; @@ -48,7 +48,7 @@ zend_rsrc_list_entry*le; mysqli_plist_entry *plist = NULL; - if (getThis() !ZEND_NUM_ARGS()) { + if (getThis()
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c php_mysqli_structs.h /ext/mysqli/tests mysqli_real_connect.phpt mysqli_real_connect_pconn.phpt
andrey Wed Feb 6 11:35:44 2008 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c php_mysqli_structs.h /php-src/ext/mysqli/tests mysqli_real_connect.phpt mysqli_real_connect_pconn.phpt Log: Pconnect working with mysqli_real_connect() http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.116r2=1.117diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.116 php-src/ext/mysqli/mysqli.c:1.117 --- php-src/ext/mysqli/mysqli.c:1.116 Mon Jan 28 18:27:49 2008 +++ php-src/ext/mysqli/mysqli.c Wed Feb 6 11:35:44 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.116 2008/01/28 18:27:49 andrey Exp $ + $Id: mysqli.c,v 1.117 2008/02/06 11:35:44 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -684,7 +684,7 @@ /* for mysqli_query */ REGISTER_LONG_CONSTANT(MYSQLI_STORE_RESULT, MYSQLI_STORE_RESULT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_USE_RESULT, MYSQLI_USE_RESULT, CONST_CS | CONST_PERSISTENT); -#if defined(HAVE_MYSQLND) defined(MYSQLND_THREADING) +#if defined(HAVE_MYSQLND) defined(MYSQLND_THREADED) REGISTER_LONG_CONSTANT(MYSQLI_BG_STORE_RESULT, MYSQLI_BG_STORE_RESULT, CONST_CS | CONST_PERSISTENT); #endif @@ -981,7 +981,7 @@ case MYSQLI_USE_RESULT: result = mysql_use_result(mysql-mysql); break; -#if defined(HAVE_MYSQLND) defined(MYSQLND_THREADING) +#if defined(HAVE_MYSQLND) defined(MYSQLND_THREADED) case MYSQLI_BG_STORE_RESULT: result = mysqli_bg_store_result(mysql-mysql); break; http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.157r2=1.158diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.157 php-src/ext/mysqli/mysqli_api.c:1.158 --- php-src/ext/mysqli/mysqli_api.c:1.157 Mon Dec 31 07:12:11 2007 +++ php-src/ext/mysqli/mysqli_api.c Wed Feb 6 11:35:44 2008 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_api.c,v 1.157 2007/12/31 07:12:11 sebastian Exp $ + $Id: mysqli_api.c,v 1.158 2008/02/06 11:35:44 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -1326,7 +1326,11 @@ #if !defined(HAVE_MYSQLND) if (!(mysql-mysql = mysql_init(NULL))) #else - if (!(mysql-mysql = mysql_init(FALSE))) + /* + We create always persistent, as if the user want to connecto + to p:somehost, we can't convert the handle then + */ + if (!(mysql-mysql = mysql_init(TRUE))) #endif { efree(mysql); @@ -1665,86 +1669,7 @@ Open a connection to a mysql server */ PHP_FUNCTION(mysqli_real_connect) { - MY_MYSQL*mysql; - char*hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; - unsigned inthostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0; - unsigned long port=0, flags=0; - zval*mysql_link; - - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O|lsl, mysql_link, mysqli_link_class_entry, - hostname, hostname_len, UG(utf8_conv), username, username_len, UG(utf8_conv), passwd, passwd_len, UG(utf8_conv), - dbname, dbname_len, UG(utf8_conv), port, socket, socket_len, UG(utf8_conv), flags) == FAILURE) { - return; - } - - if (!socket_len) { - socket = NULL; - } - if (!socket) { - socket = MyG(default_socket); - } - if (!passwd) { - passwd = MyG(default_pw); - passwd_len = strlen(passwd); - } - if (!username){ - username = MyG(default_user); - } - if (!hostname) { - hostname = MyG(default_host); - } - - MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, MYSQLI_STATUS_INITIALIZED); - - /* set some required options */ - flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */ - /* remove some insecure options */ - flags = ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */ - if (PG(open_basedir) PG(open_basedir)[0] != '\0') { - flags ^= CLIENT_LOCAL_FILES; - } - - if (UG(unicode)) { - mysql_options(mysql-mysql, MYSQL_SET_CHARSET_NAME, utf8); - } - -#if !defined(HAVE_MYSQLND) - if (mysql_real_connect(mysql-mysql, hostname, username, passwd, dbname ,port,
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c php_mysqli_structs.h
andrey Fri Nov 9 12:13:15 2007 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c php_mysqli_structs.h Log: Fix crashes with pconn (merge from 5_3) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.112r2=1.113diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.112 php-src/ext/mysqli/mysqli.c:1.113 --- php-src/ext/mysqli/mysqli.c:1.112 Wed Oct 17 08:17:34 2007 +++ php-src/ext/mysqli/mysqli.c Fri Nov 9 12:13:15 2007 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.112 2007/10/17 08:17:34 tony2001 Exp $ + $Id: mysqli.c,v 1.113 2007/11/09 12:13:15 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -73,42 +73,16 @@ static int le_pmysqli; -static int php_mysqli_persistent_on_rshut(zend_rsrc_list_entry *le TSRMLS_DC) -{ - if (le-type == le_pmysqli) { - mysqli_plist_entry *plist = (mysqli_plist_entry *) le-ptr; - HashPosition pos; - MYSQL **mysql; - ulong idx; - dtor_func_t pDestructor = plist-used_links.pDestructor; - plist-used_links.pDestructor = NULL; /* Don't call pDestructor now */ - - zend_hash_internal_pointer_reset_ex(plist-used_links, pos); - while (SUCCESS == zend_hash_get_current_data_ex(plist-used_links, (void **)mysql, pos)) { - zend_hash_get_current_key_ex(plist-used_links, NULL, NULL, idx, FALSE, pos); - /* Make it free */ - zend_hash_next_index_insert(plist-free_links, mysql, sizeof(MYSQL *), NULL); - /* First move forward */ - zend_hash_move_forward_ex(plist-used_links, pos); - /* The delete, because del will free memory, but we need it's -nextItem */ - zend_hash_index_del(plist-used_links, idx); - } - - /* restore pDestructor, which should be php_mysqli_dtor_p_elements() */ - plist-used_links.pDestructor = pDestructor; - } - return ZEND_HASH_APPLY_KEEP; -} /* Destructor for mysqli entries in free_links/used_links */ void php_mysqli_dtor_p_elements(void *data) { - MYSQL **mysql = (MYSQL **) data; + MYSQL *mysql = (MYSQL *) data; TSRMLS_FETCH(); #if defined(HAVE_MYSQLND) - mysqlnd_end_psession(*mysql); + mysqlnd_end_psession(mysql); #endif - mysqli_close(*mysql, MYSQLI_CLOSE_IMPLICIT); + mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT); } @@ -116,8 +90,8 @@ { if (rsrc-ptr) { mysqli_plist_entry *plist = (mysqli_plist_entry *) rsrc-ptr; - zend_hash_destroy(plist-free_links); - zend_hash_destroy(plist-used_links); + zend_ptr_stack_clean(plist-free_links, php_mysqli_dtor_p_elements, 0); + zend_ptr_stack_destroy(plist-free_links); free(plist); } } @@ -225,6 +199,8 @@ } /* }}} */ +/* mysqli_link_free_storage partly doubles the work of PHP_FUNCTION(mysqli_close) */ + /* {{{ mysqli_link_free_storage */ static void mysqli_link_free_storage(void *object TSRMLS_DC) @@ -238,6 +214,19 @@ if (mysql-mysql) { if (!mysql-persistent) { mysqli_close(mysql-mysql, MYSQLI_CLOSE_IMPLICIT); + } else { + zend_rsrc_list_entry *le; + if (zend_hash_find(EG(persistent_list), mysql-hash_key, strlen(mysql-hash_key) + 1, (void **)le) == SUCCESS) { + if (Z_TYPE_P(le) == php_le_pmysqli()) { + mysqli_plist_entry *plist = (mysqli_plist_entry *) le-ptr; + + zend_ptr_stack_push(plist-free_links, mysql-mysql); + + MyG(num_links)--; + MyG(num_active_persistent)--; + MyG(num_inactive_persistent)++; + } + } } } php_clear_mysql(mysql); @@ -851,9 +840,6 @@ */ PHP_RSHUTDOWN_FUNCTION(mysqli) { - /* check persistent connections, move used to free */ - zend_hash_apply(EG(persistent_list), (apply_func_t) php_mysqli_persistent_on_rshut TSRMLS_CC); - #if !defined(HAVE_MYSQLND) defined(ZTS) MYSQL_VERSION_ID = 4 mysql_thread_end(); #endif http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.154r2=1.155diff_format=u Index:
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c
tony2001Wed Oct 17 08:17:34 2007 UTC Modified files: /php-src/ext/mysqli mysqli_api.c mysqli.c Log: use correct dtor and variable for the callback http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.151r2=1.152diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.151 php-src/ext/mysqli/mysqli_api.c:1.152 --- php-src/ext/mysqli/mysqli_api.c:1.151 Sun Oct 7 05:15:04 2007 +++ php-src/ext/mysqli/mysqli_api.c Wed Oct 17 08:17:34 2007 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli_api.c,v 1.151 2007/10/07 05:15:04 davidw Exp $ + $Id: mysqli_api.c,v 1.152 2007/10/17 08:17:34 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H @@ -1403,7 +1403,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, MYSQLI_STATUS_VALID); if (mysql-li_read) { - zval_dtor(mysql-li_read); + zval_ptr_dtor((mysql-li_read)); mysql-li_read = NULL; } } @@ -1415,7 +1415,7 @@ { MY_MYSQL*mysql; zval*mysql_link; - zvalcallback_name; + zvalcallback_name, *p_callback_name; zval*callback_func; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Oz, mysql_link, mysqli_link_class_entry, @@ -1435,7 +1435,6 @@ zval_dtor(callback_name); RETURN_FALSE; } - zval_dtor(callback_name); /* save callback function */ if (!mysql-li_read) { @@ -1443,7 +1442,7 @@ } else { zval_dtor(mysql-li_read); } - ZVAL_STRINGL(mysql-li_read, Z_STRVAL_P(callback_func), Z_STRLEN_P(callback_func), 1); + ZVAL_ZVAL(mysql-li_read, callback_name, 0, 0); RETURN_TRUE; } http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.111r2=1.112diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.111 php-src/ext/mysqli/mysqli.c:1.112 --- php-src/ext/mysqli/mysqli.c:1.111 Tue Oct 16 13:18:55 2007 +++ php-src/ext/mysqli/mysqli.c Wed Oct 17 08:17:34 2007 @@ -17,7 +17,7 @@ | Ulf Wendel [EMAIL PROTECTED] | +--+ - $Id: mysqli.c,v 1.111 2007/10/16 13:18:55 tony2001 Exp $ + $Id: mysqli.c,v 1.112 2007/10/17 08:17:34 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H @@ -205,7 +205,7 @@ mysql-hash_key = NULL; } if (mysql-li_read) { - zval_dtor(mysql-li_read); + zval_ptr_dtor((mysql-li_read)); mysql-li_read = NULL; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c /ext/mysqli/tests 068.phpt
Great! So, has anyone tested or played around with the mysqli extension after these updates? -Andrei On Oct 1, 2006, at 2:01 PM, Georg Richter wrote: georg Sun Oct 1 21:01:31 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c /php-src/ext/mysqli/tests 068.phpt Log: unicode fixes georg-20061001210131.txt-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c /ext/mysqli/tests 068.phpt
georg Sun Oct 1 21:01:31 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c /php-src/ext/mysqli/tests 068.phpt Log: unicode fixes http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.99r2=1.100diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.99 php-src/ext/mysqli/mysqli.c:1.100 --- php-src/ext/mysqli/mysqli.c:1.99Wed Sep 27 15:25:52 2006 +++ php-src/ext/mysqli/mysqli.c Sun Oct 1 21:01:31 2006 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.99 2006/09/27 15:25:52 georg Exp $ + $Id: mysqli.c,v 1.100 2006/10/01 21:01:31 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -901,7 +901,6 @@ int ulen; zend_string_to_unicode(UG(utf8_conv), ustr, ulen, fields[i].name, strlen(fields[i].name) TSRMLS_CC); - /* maybe a bug in add_u_assoc_zval_ex: string is truncated when specifying ulen only */ add_u_assoc_zval_ex(return_value, IS_UNICODE, ZSTR(ustr), ulen + 1, res); efree(ustr); } else { http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_api.c?r1=1.133r2=1.134diff_format=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.133 php-src/ext/mysqli/mysqli_api.c:1.134 --- php-src/ext/mysqli/mysqli_api.c:1.133 Fri Sep 29 08:35:19 2006 +++ php-src/ext/mysqli/mysqli_api.c Sun Oct 1 21:01:31 2006 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.133 2006/09/29 08:35:19 georg Exp $ + $Id: mysqli_api.c,v 1.134 2006/10/01 21:01:31 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -444,7 +444,7 @@ csname = (char *)mysql_character_set_name(mysql-mysql); - ZVAL_UTF8_STRINGL(return_value, csname, strlen(csname), ZSTR_DUPLICATE); + RETURN_UTF8_STRING(csname, ZSTR_DUPLICATE); } /* }}} */ @@ -582,7 +582,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, MYSQLI_STATUS_VALID); strerr = (char *)mysql_error(mysql-mysql); - ZVAL_UTF8_STRINGL(return_value, strerr, strlen(strerr), ZSTR_DUPLICATE); + RETURN_UTF8_STRING(strerr, ZSTR_DUPLICATE); } /* }}} */ @@ -709,15 +709,10 @@ uval = uval / 10; } while (--j 0); tmp[10]= '\0'; - /* unsigned int INT_MAX is 10 digis - ALWAYS */ + /* unsigned int INT_MAX is 10 digits - ALWAYS */ + ZVAL_UTF8_STRINGL(stmt-result.vars[i], tmp, 10, 0); if (UG(unicode)) { - UChar *ubuf = NULL; - int ulen; - zend_string_to_unicode(UG(ascii_conv), ubuf, ulen, tmp, strlen(tmp) TSRMLS_CC); - ZVAL_UNICODEL(stmt-result.vars[i], ubuf, ulen, 0); efree(tmp); - } else { - ZVAL_STRINGL(stmt-result.vars[i], tmp, 10, 0); } break; } @@ -749,14 +744,7 @@ * use MYSQLI_LL_SPEC. */ sprintf((char *)tmp, (stmt-stmt-fields[i].flags UNSIGNED_FLAG)? MYSQLI_LLU_SPEC : MYSQLI_LL_SPEC, llval); - if (UG(unicode)) { - UChar *ubuf = NULL; - int ulen; -
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c php_mysqli.h
Am Do, den 28.09.2006 schrieb Andrei Zmievski um 18:43: Hello Andrei, A couple more notes. Thanks, I will fix it this weekend. Also, I don't know much about MySQL client library, but it seems that it only works in UTF-8 mode. Is this correct? Does it translate UTF-8 to other charsets when communicating with server that has tables in those other charsets? If a table or a column uses another charset, MySQL Server automatically converts utf8 to another charset. When PHP runs in unicode, we automatically set the client character set to utf8. UCS2 is not fully supported currently. /Georg -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c php_mysqli.h
Hi Georg, A couple more notes. 1. This can be simplified: if (UG(unicode)) { zend_string_to_unicode(UG(utf8_conv), ustr, ulen, row[i], field_len[i] TSRMLS_CC); ZVAL_UNICODEL(res, ustr, ulen, 0); } else { ZVAL_STRINGL(res, row[i], field_len[i], 1); } Use ZVAL_UTF8_STRINGL(res, row[i], field_len[i], ZSTR_DUPLICATE) 2. This also: ZVAL_UTF8_STRINGL(return_value, strerr, strlen(strerr), ZSTR_DUPLICATE); to: RETURN_UTF8_STRINGL(strerr, strlen(strerr), ZSTR_DUPLICATE); 3. As well as this: if (UG(unicode)) { zend_string_to_unicode(UG(utf8_conv), ustr, ulen, (field-name) ? field-name : , (field-name) ? strlen(field-name) : 0 TSRMLS_CC); add_property_unicodel(value, name, ustr, ulen, 0); } else { add_property_string(value, name, (field-name) ? field-name : , 1); } Use add_property_utf8_string(): add_property_utf8_string(value, name, (field-name) ? field-name : , ZSTR_DUPLICATE); Also, I don't know much about MySQL client library, but it seems that it only works in UTF-8 mode. Is this correct? Does it translate UTF-8 to other charsets when communicating with server that has tables in those other charsets? -Andrei On Sep 27, 2006, at 8:25 AM, Georg Richter wrote: georg Wed Sep 27 15:25:52 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c php_mysqli.h Log: ZTS fixes. Implemented Andrei's hints (simplifying unicode stuff) georg-20060927152552.txt-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c php_mysqli.h
georg Wed Sep 27 15:25:52 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c php_mysqli.h Log: ZTS fixes. Implemented Andrei's hints (simplifying unicode stuff) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.98r2=1.99diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.98 php-src/ext/mysqli/mysqli.c:1.99 --- php-src/ext/mysqli/mysqli.c:1.98Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/mysqli.c Wed Sep 27 15:25:52 2006 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.98 2006/09/26 13:06:13 georg Exp $ + $Id: mysqli.c,v 1.99 2006/09/27 15:25:52 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -166,6 +166,13 @@ } /* }}} */ +/* {{{ mysql_driver_free_storage */ +static void mysqli_driver_free_storage(void *object TSRMLS_DC) +{ + mysqli_objects_free_storage(object TSRMLS_CC); +} +/* }}} */ + /* {{{ mysqli_stmt_free_storage */ static void mysqli_stmt_free_storage(void *object TSRMLS_DC) @@ -251,22 +258,13 @@ } if (obj-prop_handler != NULL) { - ret = zend_u_hash_find(obj-prop_handler, UG(unicode)?IS_UNICODE:IS_STRING, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) hnd); + ret = zend_u_hash_find(obj-prop_handler, ZEND_STR_TYPE, Z_UNIVAL_P(member), Z_UNILEN_P(member)+1, (void **) hnd); } if (ret == SUCCESS) { - int is_driver; - if (UG(unicode)) { - UChar *ustr = USTR_MAKE(mysqli_driver); - is_driver = u_strcmp(obj-zo.ce-name.u, ustr); - USTR_FREE(ustr); - } else { - is_driver = strcmp(obj-zo.ce-name.s, mysqli_driver); - } - - if (is_driver (!obj-ptr || ((MYSQLI_RESOURCE *)(obj-ptr))-status MYSQLI_STATUS_INITIALIZED)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't fetch %R, UG(unicode)?IS_UNICODE:IS_STRING, obj-zo.ce-name ); + if ((!obj-ptr || ((MYSQLI_RESOURCE *)(obj-ptr))-status MYSQLI_STATUS_INITIALIZED)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't fetch %v, obj-zo.ce-name ); retval = EG(uninitialized_zval_ptr); return(retval); } @@ -396,7 +394,7 @@ mysqli_base_class = mysqli_base_class-parent; } - zend_u_hash_find(classes, UG(unicode)?IS_UNICODE:IS_STRING, mysqli_base_class-name, mysqli_base_class-name_length + 1, + zend_u_hash_find(classes, ZEND_STR_TYPE, mysqli_base_class-name, mysqli_base_class-name_length + 1, (void **) intern-prop_handler); zend_object_std_init(intern-zo, class_type TSRMLS_CC); @@ -406,6 +404,8 @@ /* link object */ if (instanceof_function(class_type, mysqli_link_class_entry TSRMLS_CC)) { free_storage = mysqli_link_free_storage; + } else if (instanceof_function(class_type, mysqli_driver_class_entry TSRMLS_CC)) { /* stmt object */ + free_storage = mysqli_driver_free_storage; } else if (instanceof_function(class_type, mysqli_stmt_class_entry TSRMLS_CC)) { /* stmt object */ free_storage = mysqli_stmt_free_storage; } else if (instanceof_function(class_type, mysqli_result_class_entry TSRMLS_CC)) { /* result object */ @@ -720,7 +720,8 @@ zval*mysql_link; MY_STMT *stmt; MYSQLI_RESOURCE *mysqli_resource; - MYSQLI_STRING statement; + char*statement; + int statement_len; switch (ZEND_NUM_ARGS()) { @@ -735,19 +736,16 @@ stmt-stmt = mysql_stmt_init(mysql-mysql); break; case 2: - if (zend_parse_parameters(2 TSRMLS_CC, OT, mysql_link, mysqli_link_class_entry, MYSQLI_GET_STRING(statement))==FAILURE) { + if (zend_parse_parameters(2 TSRMLS_CC, Os, mysql_link, mysqli_link_class_entry, statement, statement_len, UG(utf8_conv))==FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link, MYSQLI_STATUS_VALID); stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT)); - MYSQLI_CONVERT_PARAM_STRING(statement, MYSQLI_CONV_UTF8); - if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) { - mysql_stmt_prepare(stmt-stmt, (char
Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c mysqli_report.c php_mysqli.h /ext/mysqli/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt
ZTS build is badly broken =( On 26.09.2006 17:06, Georg Richter wrote: georg Tue Sep 26 13:06:13 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c mysqli_driver.c mysqli_nonapi.c mysqli_prop.c mysqli_report.c php_mysqli.h /php-src/ext/mysqli/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 009.phpt 011.phpt 012.phpt 014.phpt 015.phpt 016.phpt 017.phpt 019.phpt 020.phpt 021.phpt 022.phpt 026.phpt 028.phpt 031.phpt 032.phpt 042.phpt 043.phpt 045.phpt 047.phpt 048.phpt 049.phpt 057.phpt 058.phpt 059.phpt 060.phpt 061.phpt 062.phpt 063.phpt 065.phpt 069.phpt 072.phpt 073.phpt 074.phpt bug28817.phpt bug31141.phpt bug31668.phpt bug32405.phpt bug33263.phpt bug34785.phpt bug35517.phpt bug36745.phpt connect.inc skipif.inc Log: added unicode support for mysqli extension -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c
andrey Wed May 10 12:29:10 2006 UTC Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c Log: MFB http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.87r2=1.88diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.87 php-src/ext/mysqli/mysqli.c:1.88 --- php-src/ext/mysqli/mysqli.c:1.87Tue May 9 11:27:20 2006 +++ php-src/ext/mysqli/mysqli.c Wed May 10 12:29:09 2006 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.87 2006/05/09 11:27:20 georg Exp $ + $Id: mysqli.c,v 1.88 2006/05/10 12:29:09 andrey Exp $ */ #ifdef HAVE_CONFIG_H @@ -69,10 +69,6 @@ return; } - if (bbuf.is_null) { - efree(bbuf.is_null); - } - for (i=0; i bbuf.var_cnt; i++) { /* free temporary bind buffer */ @@ -89,9 +85,18 @@ efree(bbuf.vars); } + /* + Don't free bbuf.is_null for FETCH_RESULT since we have allocated + is_null and buf in one block so we free only buf, which is the beginning + of the block. When FETCH_SIMPLE then buf wasn't allocated together with + buf and we have to free it. + */ if (type == FETCH_RESULT) { efree(bbuf.buf); + } else if (type == FETCH_SIMPLE){ + efree(bbuf.is_null); } + bbuf.var_cnt = 0; return; } @@ -158,16 +163,16 @@ efree(mysql); my_res-ptr = NULL; } - } else if (instanceof_function(intern-zo.ce, mysqli_stmt_class_entry TSRMLS_CC)) { /* stmt obj */ + } else if (instanceof_function(intern-zo.ce, mysqli_stmt_class_entry TSRMLS_CC)) { /* stmt object */ if (my_res my_res-ptr) { MY_STMT *stmt = (MY_STMT *)my_res-ptr; php_clear_stmt_bind(stmt); } - } else if (instanceof_function(intern-zo.ce, mysqli_result_class_entry TSRMLS_CC)) { /* result obj */ + } else if (instanceof_function(intern-zo.ce, mysqli_result_class_entry TSRMLS_CC)) { /* result object */ if (my_res my_res-ptr) { mysql_free_result(my_res-ptr); } - } else if (instanceof_function(intern-zo.ce, mysqli_warning_class_entry TSRMLS_CC)) { /* warning obj */ + } else if (instanceof_function(intern-zo.ce, mysqli_warning_class_entry TSRMLS_CC)) { /* warning object */ if (my_res my_res-ptr) { php_clear_warnings((MYSQLI_WARNING *)my_res-info); } @@ -453,7 +458,7 @@ zend_hash_init(mysqli_driver_properties, 0, NULL, NULL, 1); MYSQLI_ADD_PROPERTIES(mysqli_driver_properties, mysqli_driver_property_entries); zend_hash_add(classes, ce-name.s, ce-name_length+1, mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL); -ce-ce_flags |= ZEND_ACC_FINAL_CLASS; + ce-ce_flags |= ZEND_ACC_FINAL_CLASS; REGISTER_MYSQLI_CLASS_ENTRY(mysqli, mysqli_link_class_entry, mysqli_link_methods); ce = mysqli_link_class_entry; @@ -463,7 +468,7 @@ REGISTER_MYSQLI_CLASS_ENTRY(mysqli_warning, mysqli_warning_class_entry, mysqli_warning_methods); ce = mysqli_warning_class_entry; -ce-ce_flags |= ZEND_ACC_FINAL_CLASS | ZEND_ACC_PROTECTED; + ce-ce_flags |= ZEND_ACC_FINAL_CLASS | ZEND_ACC_PROTECTED; zend_hash_init(mysqli_warning_properties, 0, NULL, NULL, 1); MYSQLI_ADD_PROPERTIES(mysqli_warning_properties, mysqli_warning_property_entries); zend_hash_add(classes, ce-name.s, ce-name_length+1, mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL); @@ -560,11 +565,14 @@ REGISTER_LONG_CONSTANT(MYSQLI_TYPE_CHAR, FIELD_TYPE_CHAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_TYPE_INTERVAL, FIELD_TYPE_INTERVAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_TYPE_GEOMETRY, FIELD_TYPE_GEOMETRY, CONST_CS | CONST_PERSISTENT); + #if MYSQL_VERSION_ID 50002 REGISTER_LONG_CONSTANT(MYSQLI_TYPE_NEWDECIMAL, FIELD_TYPE_NEWDECIMAL, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_TYPE_BIT, FIELD_TYPE_BIT, CONST_CS | CONST_PERSISTENT); #endif + + /* replication */ REGISTER_LONG_CONSTANT(MYSQLI_RPL_MASTER, MYSQL_RPL_MASTER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_RPL_SLAVE, MYSQL_RPL_SLAVE, CONST_CS | CONST_PERSISTENT); @@ -693,7 +701,7 @@ mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource-ptr = (void *)stmt; mysqli_resource-status = (ZEND_NUM_ARGS() == 1) ? MYSQLI_STATUS_INITIALIZED : MYSQLI_STATUS_VALID; - + ((mysqli_object
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c /ext/mysqli/tests 064.phpt
georg Thu May 5 09:02:32 2005 EDT Added files: /php-src/ext/mysqli/tests 064.phpt Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c Log: fixed memleak in mysqli_close fixed bug #32956 (mysqli_bind_result doesn't support MYSQL_TYPE_NULL) http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.67r2=1.68ty=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.67 php-src/ext/mysqli/mysqli.c:1.68 --- php-src/ext/mysqli/mysqli.c:1.67Fri Apr 29 06:23:55 2005 +++ php-src/ext/mysqli/mysqli.c Thu May 5 09:02:31 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.67 2005/04/29 10:23:55 andrey Exp $ + $Id: mysqli.c,v 1.68 2005/05/05 13:02:31 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -69,7 +69,7 @@ for (i=0; i bbuf.var_cnt; i++) { /* free temporary bind buffer */ - if (type == FETCH_RESULT) { + if (type == FETCH_RESULT bbuf.buf[i].val) { efree(bbuf.buf[i].val); } @@ -133,9 +133,14 @@ if (my_res my_res-ptr) { MY_MYSQL *mysql = (MY_MYSQL *)my_res-ptr; - mysql_close(mysql-mysql); + if (mysql-mysql) { + mysql_close(mysql-mysql); + } + + php_clear_mysql(mysql); + efree(mysql); - php_clear_mysql(mysql); + my_res-ptr = NULL; } } else if (intern-zo.ce == mysqli_stmt_class_entry) { /* stmt object */ if (my_res my_res-ptr) { http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.107r2=1.108ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.107 php-src/ext/mysqli/mysqli_api.c:1.108 --- php-src/ext/mysqli/mysqli_api.c:1.107 Wed Apr 27 13:53:15 2005 +++ php-src/ext/mysqli/mysqli_api.c Thu May 5 09:02:31 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.107 2005/04/27 17:53:15 andrey Exp $ + $Id: mysqli_api.c,v 1.108 2005/05/05 13:02:31 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -277,6 +277,15 @@ bind[ofs].is_null = stmt-result.is_null[ofs]; break; + case MYSQL_TYPE_NULL: + stmt-result.buf[ofs].type = IS_NULL; + stmt-result.buf[ofs].buflen = 0; + bind[ofs].buffer_type = MYSQL_TYPE_NULL; + bind[ofs].buffer = 0; + bind[ofs].is_null = stmt-result.is_null[ofs]; + bind[ofs].buffer_length = 0; + break; + case MYSQL_TYPE_SHORT: case MYSQL_TYPE_TINY: case MYSQL_TYPE_LONG: @@ -423,7 +432,8 @@ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link); mysql_close(mysql-mysql); - php_clear_mysql(mysql); + php_clear_mysql(mysql); + efree(mysql); MYSQLI_CLEAR_RESOURCE(mysql_link); RETURN_TRUE; } @@ -1013,7 +1023,7 @@ PHP_FUNCTION(mysqli_init) { MYSQLI_RESOURCE *mysqli_resource; - MY_MYSQL *mysql = (MY_MYSQL *)calloc(1, sizeof(MY_MYSQL)); + MY_MYSQL *mysql = (MY_MYSQL *)ecalloc(1, sizeof(MY_MYSQL)); if (!(mysql-mysql = mysql_init(NULL))) { efree(mysql); http://cvs.php.net/co.php/php-src/ext/mysqli/tests/064.phpt?r=1.1p=1 Index: php-src/ext/mysqli/tests/064.phpt +++ php-src/ext/mysqli/tests/064.phpt --TEST-- NULL binding --SKIPIF-- ?php require_once('skipif.inc'); ? --FILE-- ?php include connect.inc; $mysql = new mysqli($host, $user, $passwd); $stmt = new mysqli_stmt($mysql, SELECT NULL FROM DUAL); $stmt-execute(); $stmt-bind_result($foo); $stmt-fetch(); $stmt-close(); $mysql-close(); var_dump($foo); ? --EXPECT-- NULL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c
georg Wed Apr 20 08:50:15 2005 EDT Modified files: /php-src/ext/mysqli mysqli.c mysqli_api.c Log: added support for data truncation (bind_result) for MySQL 5.0.5 http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.64r2=1.65ty=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.64 php-src/ext/mysqli/mysqli.c:1.65 --- php-src/ext/mysqli/mysqli.c:1.64Mon Apr 18 02:03:29 2005 +++ php-src/ext/mysqli/mysqli.c Wed Apr 20 08:50:13 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.64 2005/04/18 06:03:29 georg Exp $ + $Id: mysqli.c,v 1.65 2005/04/20 12:50:13 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -561,8 +561,11 @@ REGISTER_LONG_CONSTANT(MYSQLI_RPL_SLAVE, MYSQL_RPL_SLAVE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(MYSQLI_RPL_ADMIN, MYSQL_RPL_ADMIN, CONST_CS | CONST_PERSISTENT); - /* bind blob support */ + /* bind support */ REGISTER_LONG_CONSTANT(MYSQLI_NO_DATA, MYSQL_NO_DATA, CONST_CS | CONST_PERSISTENT); +#ifdef MYSQL_DATA_TRUNCATION + REGISTER_LONG_CONSTANT(MYSQLI_DATA_TRUNCATION, MYSQL_DATA_TRUNCATION, CONST_CS | CONST_PERSISTENT); +#endif /* reporting */ REGISTER_LONG_CONSTANT(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_INDEX, CONST_CS | CONST_PERSISTENT); http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.104r2=1.105ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.104 php-src/ext/mysqli/mysqli_api.c:1.105 --- php-src/ext/mysqli/mysqli_api.c:1.104 Tue Apr 19 09:28:41 2005 +++ php-src/ext/mysqli/mysqli_api.c Wed Apr 20 08:50:13 2005 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.104 2005/04/19 13:28:41 andrey Exp $ + $Id: mysqli_api.c,v 1.105 2005/04/20 12:50:13 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -606,7 +606,12 @@ memset(stmt-result.buf[i].val, 0, stmt-result.buf[i].buflen); } } - if (!(ret = mysql_stmt_fetch(stmt-stmt))) { + ret = mysql_stmt_fetch(stmt-stmt); +#ifdef MYSQL_DATA_TRUNCATED + if (!ret || ret == MYSQL_DATA_TRUNCATED) { +#else + if (!ret || ret == MYSQL_DATA_TRUNCATED) { +#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); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_nonapi.c php_mysqli.h
georg Wed Aug 25 09:57:35 2004 EDT Modified files: /php-src/ext/mysqli mysqli_api.c mysqli.c mysqli_nonapi.c php_mysqli.h Log: changed local_infile_handler: mysql client lib now uses php_local_infile functions by default, which allows to use php_fopen_wrapper: e.g. LOAD DATA LOCAL INFILE 'http://foo.com/bar.csv' ... mysql_set_local_infile_handler now only supports a callback function for read. http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.91r2=1.92ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.91 php-src/ext/mysqli/mysqli_api.c:1.92 --- php-src/ext/mysqli/mysqli_api.c:1.91Thu Aug 12 18:14:06 2004 +++ php-src/ext/mysqli/mysqli_api.c Wed Aug 25 09:57:35 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.91 2004/08/12 22:14:06 georg Exp $ + $Id: mysqli_api.c,v 1.92 2004/08/25 13:57:35 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -258,7 +258,7 @@ for (i=start; i var_cnt + start ; i++) { ofs = i - start; stmt-result.is_null[ofs] = 0; - + //bind[ofs].truncated = NULL; col_type = (stmt-stmt-fields) ? stmt-stmt-fields[ofs].type : MYSQL_TYPE_STRING; switch (col_type) { @@ -406,7 +406,7 @@ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link); mysql_close(mysql-mysql); - + php_clear_mysql(mysql); MYSQLI_CLEAR_RESOURCE(mysql_link); RETURN_TRUE; } @@ -1036,7 +1036,6 @@ { MY_MYSQL*mysql; zval*mysql_link; - int i; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry) == FAILURE) { return; @@ -1044,52 +1043,41 @@ MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link); - for (i=0; i 3; i++) { - if (mysql-callback_func[i]) { - zval_dtor(mysql-callback_func[i]); - } + if (mysql-li_read) { + efree(Z_STRVAL_P(mysql-li_read)); + zval_dtor(mysql-li_read); + mysql-li_read = NULL; } - - mysql_set_local_infile_default(mysql-mysql); } /* }}} */ -/* {{{ proto bool mysqli_set_local_infile_handler(object link, callback init_func, - callback read_func, callback end_func) +/* {{{ proto bool mysqli_set_local_infile_handler(object link, callback read_func) Set callback functions for LOAD DATA LOCAL INFILE */ PHP_FUNCTION(mysqli_set_local_infile_handler) { MY_MYSQL*mysql; zval*mysql_link; char*callback_name; - zval*callback_func[4]; - int i; + zval*callback_func; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O, mysql_link, mysqli_link_class_entry, - callback_func[0], callback_func[1], callback_func[2], callback_func[3]) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Oz, mysql_link, mysqli_link_class_entry, + callback_func) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link); - /* check callback functions */ - for (i=0; i 3; i++) { - if (!zend_is_callable(callback_func[i], 0, callback_name)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Not a valid callback function %s, callback_name); - efree(callback_name); - RETURN_FALSE; - } + /* check callback function */ + if (!zend_is_callable(callback_func, 0, callback_name)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Not a valid callback function %s, callback_name); efree(callback_name); + RETURN_FALSE; } + efree(callback_name); - /* save callback functions */ - for (i=0; i 3; i++) { - ZVAL_STRING(mysql-callback_func[i], callback_func[i]-value.str.val, 1); - } - - /* register internal callback functions */ - mysql_set_local_infile_handler(mysql-mysql, php_local_infile_init, php_local_infile_read, - php_local_infile_end, php_local_infile_error, (void *)mysql); + /* save callback function */ + ALLOC_ZVAL(mysql-li_read); + ZVAL_STRING(mysql-li_read, callback_func-value.str.val, 1); } /* }}} */ @@ -1324,6 +1312,9 @@ php_mysqli_set_error(mysql_errno(mysql-mysql), (char
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c mysqli_prop.c mysqli_report.c php_mysqli.h
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.34r2=1.35ty=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.34Tue 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.34r2=1.35ty=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.34Wed 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.79r2=1.80ty=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.79Wed 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.7r2=1.8ty=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-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c
georg Wed Feb 11 03:34:10 2004 EDT Modified files: /php-src/ext/mysqli mysqli_api.c mysqli.c Log: removed printfs :) Thx Andi! http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.69r2=1.70ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.69 php-src/ext/mysqli/mysqli_api.c:1.70 --- php-src/ext/mysqli/mysqli_api.c:1.69Wed Feb 11 02:38:43 2004 +++ php-src/ext/mysqli/mysqli_api.c Wed Feb 11 03:34:07 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.69 2004/02/11 07:38:43 georg Exp $ + $Id: mysqli_api.c,v 1.70 2004/02/11 08:34:07 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -1261,8 +1261,6 @@ RETURN_FALSE; } - if (stmt-stmt-fields) printf(**\n); - mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource-ptr = (void *)stmt; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_stmt_class_entry); http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.29r2=1.30ty=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.29 php-src/ext/mysqli/mysqli.c:1.30 --- php-src/ext/mysqli/mysqli.c:1.29Wed Feb 11 02:38:43 2004 +++ php-src/ext/mysqli/mysqli.c Wed Feb 11 03:34:08 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.29 2004/02/11 07:38:43 georg Exp $ + $Id: mysqli.c,v 1.30 2004/02/11 08:34:08 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -66,7 +66,6 @@ for (i=0; i bbuf.var_cnt; i++) { if (type == FETCH_RESULT) { if (bbuf.buf[i].type == IS_STRING) { - printf (--free--\n); efree(bbuf.buf[i].buffer); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c
georg Wed Feb 11 02:38:44 2004 EDT Modified files: /php-src/ext/mysqli mysqli_api.c mysqli.c Log: changed first parameter in mysqli_bind_param from array to string (as discussed on berlin db meeting) http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.68r2=1.69ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.68 php-src/ext/mysqli/mysqli_api.c:1.69 --- php-src/ext/mysqli/mysqli_api.c:1.68Sat Jan 31 02:51:03 2004 +++ php-src/ext/mysqli/mysqli_api.c Wed Feb 11 02:38:43 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.68 2004/01/31 07:51:03 georg Exp $ + $Id: mysqli_api.c,v 1.69 2004/02/11 07:38:43 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -68,7 +68,7 @@ } /* }}} */ -/* {{{ proto bool mysqli_bind_param(object stmt, array types, mixed variable [,mixed,]) +/* {{{ proto bool mysqli_bind_param(object stmt, string types, mixed variable [,mixed,]) Bind variables to a prepared statement as parameters */ PHP_FUNCTION(mysqli_bind_param) { @@ -81,8 +81,8 @@ STMT*stmt; zval*mysql_stmt; MYSQL_BIND *bind; - zval*types; - HashPositionhpos; + char*types; + int typelen; unsigned long rc; /* calculate and check number of parameters */ @@ -96,7 +96,7 @@ WRONG_PARAM_COUNT; } - if (zend_parse_method_parameters((getThis()) ? 1:2 TSRMLS_CC, getThis(), Oa, mysql_stmt, mysqli_stmt_class_entry, types) == FAILURE) { + if (zend_parse_method_parameters((getThis()) ? 1:2 TSRMLS_CC, getThis(), Os, mysql_stmt, mysqli_stmt_class_entry, types, typelen) == FAILURE) { return; } @@ -106,9 +106,9 @@ start = 1; } - if (zend_hash_num_elements(Z_ARRVAL_P(types)) != argc - start) { - /* number of bind variables doesn't match number of elements in array */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements in type array doesn't match number of bind variables); + if (strlen(types) != argc - start) { + /* number of bind variables doesn't match number of elements in type definition string */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, Number of elements in type definition string doesn't match number of bind variables); } /* prevent leak if variables are already bound */ @@ -126,35 +126,30 @@ stmt-param.is_null = ecalloc(num_vars, sizeof(char)); bind = (MYSQL_BIND *)ecalloc(num_vars, sizeof(MYSQL_BIND)); - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(types), hpos); - ofs = 0; for (i=start; i argc; i++) { - zval **ctype; - - zend_hash_get_current_data_ex(Z_ARRVAL_P(types), (void **)ctype, hpos); /* set specified type */ - switch (Z_LVAL_PP(ctype)) { - case MYSQLI_BIND_DOUBLE: + switch (types[ofs]) { + case 'd': /* Double */ bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE; bind[ofs].buffer = (gptr)Z_DVAL_PP(args[i]); bind[ofs].is_null = stmt-param.is_null[ofs]; break; - case MYSQLI_BIND_INT: + case 'i': /* Integer */ bind[ofs].buffer_type = MYSQL_TYPE_LONG; bind[ofs].buffer = (gptr)Z_LVAL_PP(args[i]); bind[ofs].is_null = stmt-param.is_null[ofs]; break; - case MYSQLI_BIND_SEND_DATA: + case 'b': /* Blob (send data) */ bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING; bind[ofs].is_null = 0; bind[ofs].length = 0; break; - case MYSQLI_BIND_STRING: + case 's': /* string */ bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING; bind[ofs].buffer = NULL; bind[ofs].buffer_length = 0; @@ -162,14 +157,13 @@ break; default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, Undefined fieldtype %ld (parameter %d), Z_LVAL_PP(args[i]), i+1); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Undefined fieldtype %c (parameter %d), types[ofs], i+1);
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c php_mysqli.h
georg Tue Jul 15 06:37:19 2003 EDT Modified files: /php-src/ext/mysqli php_mysqli.h mysqli.c mysqli_api.c Log: added support for rebind Index: php-src/ext/mysqli/php_mysqli.h diff -u php-src/ext/mysqli/php_mysqli.h:1.17 php-src/ext/mysqli/php_mysqli.h:1.18 --- php-src/ext/mysqli/php_mysqli.h:1.17Sun Jun 22 04:46:39 2003 +++ php-src/ext/mysqli/php_mysqli.h Tue Jul 15 06:37:19 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: php_mysqli.h,v 1.17 2003/06/22 08:46:39 georg Exp $ + $Id: php_mysqli.h,v 1.18 2003/07/15 10:37:19 georg Exp $ */ /* A little hack to prevent build break, when mysql is used together with @@ -36,15 +36,19 @@ ulong buflen; char*buffer; ulong type; -} BIND_BUFFER; +} VAR_BUFFER; typedef struct { - MYSQL_STMT *stmt; unsigned intvar_cnt; + VAR_BUFFER *buf; zval**vars; - BIND_BUFFER *bind; char*is_null; - chartype; +} BIND_BUFFER; + +typedef struct { + MYSQL_STMT *stmt; + BIND_BUFFER param; + BIND_BUFFER result; } STMT; typedef struct { @@ -88,6 +92,7 @@ extern function_entry mysqli_result_methods[]; extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int flag); extern void php_clear_stmt_bind(STMT *stmt); +extern void php_free_stmt_bind_buffer(BIND_BUFFER bbuf, int type); zend_class_entry *mysqli_link_class_entry; zend_class_entry *mysqli_stmt_class_entry; Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.14 php-src/ext/mysqli/mysqli.c:1.15 --- php-src/ext/mysqli/mysqli.c:1.14Tue Jun 10 16:03:33 2003 +++ php-src/ext/mysqli/mysqli.c Tue Jul 15 06:37:19 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli.c,v 1.14 2003/06/10 20:03:33 imajes Exp $ + $Id: mysqli.c,v 1.15 2003/07/15 10:37:19 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -37,32 +37,52 @@ static zend_object_handlers mysqli_object_handlers; PR_MAIN *prmain; -/* {{{ php_clear_stmt_bind */ -void php_clear_stmt_bind(STMT *stmt) +/* {{{ php_free_stmt_bind_buffer */ +void php_free_stmt_bind_buffer(BIND_BUFFER bbuf, int type) { unsigned int i; - if (stmt-stmt) { - mysql_stmt_close(stmt-stmt); + if (!bbuf.var_cnt) { + return; } - if (stmt-var_cnt) { - for (i = 0; i stmt-var_cnt; i++) { - if (stmt-type == FETCH_RESULT) { - if (stmt-bind[i].type == IS_STRING) { - efree(stmt-bind[i].buffer); - } - } - if (stmt-vars[i]) { - ZVAL_DELREF(stmt-vars[i]); + if (bbuf.is_null) { + efree(bbuf.is_null); + } + + for (i=0; i bbuf.var_cnt; i++) { + if (type == FETCH_RESULT) { + if (bbuf.buf[i].type == IS_STRING) { + efree(bbuf.buf[i].buffer); } } - if (stmt-type == FETCH_RESULT) { - efree(stmt-bind); - } - efree(stmt-vars); - efree(stmt-is_null); + if (bbuf.vars[i]) { + ZVAL_DELREF(bbuf.vars[i]); + } } + + if (bbuf.vars) { + efree(bbuf.vars); + } + + if (type == FETCH_RESULT) { + efree(bbuf.buf); + } + bbuf.var_cnt = 0; + return; +} +/* }}} */ + +/* {{{ php_clear_stmt_bind */ +void php_clear_stmt_bind(STMT *stmt) +{ + if (stmt-stmt) { + mysql_stmt_close(stmt-stmt); + } + + php_free_stmt_bind_buffer(stmt-param, FETCH_SIMPLE); + php_free_stmt_bind_buffer(stmt-result, FETCH_RESULT); + efree(stmt); return; } Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.34 php-src/ext/mysqli/mysqli_api.c:1.35 --- php-src/ext/mysqli/mysqli_api.c:1.34Sat Jun 28 17:27:08 2003 +++ php-src/ext/mysqli/mysqli_api.c Tue Jul 15 06:37:19 2003 @@ -15,7 +15,7 @@ | Author: Georg Richter [EMAIL PROTECTED]| +--+ - $Id: mysqli_api.c,v 1.34 2003/06/28 21:27:08 georg Exp $ + $Id: mysqli_api.c,v 1.35 2003/07/15 10:37:19 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -120,18 +120,13 @@ if (zend_hash_num_elements(Z_ARRVAL_P(types)) != argc - start) { /* number of bind