[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2009-04-06 Thread Pierre-Alain Joye
pajoye  Mon Apr  6 11:07:39 2009 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - fix TS build
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.144r2=1.145diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.144 php-src/ext/mysqli/mysqli.c:1.145
--- php-src/ext/mysqli/mysqli.c:1.144   Fri Mar 27 19:28:26 2009
+++ php-src/ext/mysqli/mysqli.c Mon Apr  6 11:07:39 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli.c,v 1.144 2009/03/27 19:28:26 felipe Exp $ 
+  $Id: mysqli.c,v 1.145 2009/04/06 11:07:39 pajoye Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -95,6 +95,7 @@
 void php_mysqli_dtor_p_elements(void *data)
 {
MYSQL *mysql = (MYSQL *) data;
+   TSRMLS_FETCH();
 
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
 }



-- 
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 php_mysqli_structs.h /ext/mysqlnd mysqlnd_enum_n_def.h mysqlnd_libmysql_compat.h

2009-01-22 Thread Johannes Schlüter
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_prop.c /ext/mysqli/tests mysqli_fetch_lengths_oo.phpt mysqli_result_references.phpt

2009-01-12 Thread Johannes Schlüter
johannesMon Jan 12 12:54:17 2009 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c mysqli_prop.c 
/php-src/ext/mysqli/tests   mysqli_fetch_lengths_oo.phpt 
mysqli_result_references.phpt 
  Log:
  - Fix #45940 MySQLI OO does not populate connect_error property on failed
connect
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.141r2=1.142diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.141 php-src/ext/mysqli/mysqli.c:1.142
--- php-src/ext/mysqli/mysqli.c:1.141   Wed Jan  7 16:29:42 2009
+++ php-src/ext/mysqli/mysqli.c Mon Jan 12 12:54:17 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli.c,v 1.141 2009/01/07 16:29:42 johannes Exp $ 
+  $Id: mysqli.c,v 1.142 2009/01/12 12:54:17 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -347,13 +347,6 @@
}
 
if (ret == SUCCESS) {
-   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);
-   }
-
ret = hnd-read_func(obj, retval TSRMLS_CC);
if (ret == SUCCESS) {
/* ensure we're creating a temporary variable */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_prop.c?r1=1.41r2=1.42diff_format=u
Index: php-src/ext/mysqli/mysqli_prop.c
diff -u php-src/ext/mysqli/mysqli_prop.c:1.41 
php-src/ext/mysqli/mysqli_prop.c:1.42
--- php-src/ext/mysqli/mysqli_prop.c:1.41   Wed Dec 31 11:12:33 2008
+++ php-src/ext/mysqli/mysqli_prop.cMon Jan 12 12:54:17 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli_prop.c,v 1.41 2008/12/31 11:12:33 sebastian Exp $ 
+  $Id: mysqli_prop.c,v 1.42 2009/01/12 12:54:17 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -32,7 +32,7 @@
 #include php_mysqli_structs.h
 
 #define CHECK_STATUS(value) \
-   if (((MYSQLI_RESOURCE *)obj-ptr)-status  value ) { \
+   if (!obj-ptr || ((MYSQLI_RESOURCE *)obj-ptr)-status  value ) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, Property access is 
not allowed yet); \
ZVAL_NULL(*retval); \
return SUCCESS; \
@@ -136,7 +136,6 @@
 static int link_connect_errno_read(mysqli_object *obj, zval **retval TSRMLS_DC)
 {
MAKE_STD_ZVAL(*retval);
-   CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
ZVAL_LONG(*retval, (long)MyG(error_no));
return SUCCESS;
 }
@@ -146,8 +145,11 @@
 static int link_connect_error_read(mysqli_object *obj, zval **retval TSRMLS_DC)
 {
MAKE_STD_ZVAL(*retval);
-   CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
-   ZVAL_UTF8_STRING(*retval, MyG(error_msg), ZSTR_DUPLICATE)
+   if (MyG(error_msg)) {
+   ZVAL_UTF8_STRING(*retval, MyG(error_msg), ZSTR_DUPLICATE);
+   } else {
+   ZVAL_NULL(*retval);
+   }
return SUCCESS;
 }
 /* }}} */
@@ -160,6 +162,8 @@
 
MAKE_STD_ZVAL(*retval); 
 
+   CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
+
mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj-ptr))-ptr;

if (!mysql) {
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
diff -u php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.2 
php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.3
--- php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.2   Thu Aug  9 
10:01:19 2007
+++ php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt   Mon Jan 12 
12:54:17 2009
@@ -38,6 +38,6 @@
 }
 NULL
 
-Warning: main(): Couldn't fetch mysqli_result in %s on line %d
+Warning: main(): Property access is not allowed yet in %s on line %d
 NULL
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_result_references.phpt?r1=1.4r2=1.5diff_format=u
Index: php-src/ext/mysqli/tests/mysqli_result_references.phpt
diff -u php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.4 
php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.5
--- php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.4  Tue Jan  6 
00:56:04 2009
+++ php-src/ext/mysqli/tests/mysqli_result_references.phpt  Mon Jan 12 
12:54:17 2009
@@ -125,7 +125,17 @@
 long(4) refcount(2)
   }
   [6]=
-  object(mysqli_result)#2 (0) refcount(2){
+  object(mysqli_result)#2 (5) refcount(2){
+[current_field]=
+NULL refcount(1)
+[field_count]=
+NULL refcount(1)
+[lengths]=
+

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c /ext/mysqli/tests 066.phpt bug34810.phpt mysqli_class_mysqli_result_interface.phpt mysqli_class_mysqli_stmt_interface.phpt mysqli_mysqli_result_invalid_mod

2009-01-07 Thread Johannes Schlüter
johannesWed Jan  7 16:29:42 2009 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
/php-src/ext/mysqli/tests   066.phpt bug34810.phpt 
mysqli_class_mysqli_result_interface.phpt 
mysqli_class_mysqli_stmt_interface.phpt 
mysqli_mysqli_result_invalid_mode.phpt 
  Log:
  Proper ctor usage (Fix #46044)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.140r2=1.141diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.140 php-src/ext/mysqli/mysqli.c:1.141
--- php-src/ext/mysqli/mysqli.c:1.140   Wed Dec 31 11:12:33 2008
+++ php-src/ext/mysqli/mysqli.c Wed Jan  7 16:29:42 2009
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli.c,v 1.140 2008/12/31 11:12:33 sebastian Exp $ 
+  $Id: mysqli.c,v 1.141 2009/01/07 16:29:42 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -424,41 +424,6 @@
 }
 /* }}} */
 
-static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC)
-{
-   zend_class_entry * ce = Z_OBJCE_P(object);
-
-   if (ce != mysqli_link_class_entry  ce != mysqli_stmt_class_entry 
-   ce != mysqli_result_class_entry  ce != 
mysqli_driver_class_entry  
-   ce != mysqli_warning_class_entry) {
-   return zend_std_get_constructor(object TSRMLS_CC);
-   } else {
-   static zend_internal_function f;
-   mysqli_object *obj = (mysqli_object 
*)zend_objects_get_address(object TSRMLS_CC);
-
-   f.function_name = obj-zo.ce-name;
-   f.scope = obj-zo.ce;
-   f.arg_info = NULL;
-   f.num_args = 0;
-   f.fn_flags = 0;
-
-   f.type = ZEND_INTERNAL_FUNCTION;
-   if (obj-zo.ce == mysqli_link_class_entry) {
-   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) {
-   f.handler = ZEND_FN(mysqli_result_construct);
-   } else if (obj-zo.ce == mysqli_driver_class_entry) {
-   f.handler = ZEND_FN(mysqli_driver_construct);
-   } else if (obj-zo.ce == mysqli_warning_class_entry) {
-   f.handler = ZEND_MN(mysqli_warning___construct);
-   }
-
-   return (union _zend_function*)f;
-   }
-}
-
 static int mysqli_object_has_property(zval *object, zval *member, int 
has_set_exists TSRMLS_DC) /* {{{ */
 {
mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object 
TSRMLS_CC);
@@ -713,7 +678,6 @@
mysqli_object_handlers.read_property = mysqli_read_property;
mysqli_object_handlers.write_property = mysqli_write_property;
mysqli_object_handlers.get_property_ptr_ptr = 
std_hnd-get_property_ptr_ptr;
-   mysqli_object_handlers.get_constructor = php_mysqli_constructor_get;
mysqli_object_handlers.has_property = mysqli_object_has_property;
mysqli_object_handlers.get_debug_info = mysqli_object_get_debug_info;
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/066.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/mysqli/tests/066.phpt
diff -u php-src/ext/mysqli/tests/066.phpt:1.3 
php-src/ext/mysqli/tests/066.phpt:1.4
--- php-src/ext/mysqli/tests/066.phpt:1.3   Thu Aug  9 08:41:12 2007
+++ php-src/ext/mysqli/tests/066.phpt   Wed Jan  7 16:29:42 2009
@@ -19,7 +19,7 @@
 
$mysql-query(INSERT INTO test_warnings VALUES (1),(2),(NULL));
 
-   if (($warning = new mysqli_warning($mysql))) {
+   if (($warning = $mysql-get_warnings())) {
do {
printf(Warning\n);
} while ($warning-next());
@@ -30,4 +30,4 @@
 ?
 --EXPECT--
 Warning
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug34810.phpt?r1=1.9r2=1.10diff_format=u
Index: php-src/ext/mysqli/tests/bug34810.phpt
diff -u php-src/ext/mysqli/tests/bug34810.phpt:1.9 
php-src/ext/mysqli/tests/bug34810.phpt:1.10
--- php-src/ext/mysqli/tests/bug34810.phpt:1.9  Tue Jan  6 00:56:03 2009
+++ php-src/ext/mysqli/tests/bug34810.phpt  Wed Jan  7 16:29:42 2009
@@ -24,7 +24,7 @@
$mysql-query(CREATE TABLE test_warnings (a int not null));
$mysql-query(SET sql_mode='');
$mysql-query(INSERT INTO test_warnings VALUES 
(1),(2),(NULL));
-   var_dump(new mysqli_warning($mysql));
+   var_dump($mysql-get_warnings());
} 
 } 
 
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt?r1=1.4r2=1.5diff_format=u
Index: 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c /ext/xmlwriter php_xmlwriter.c

2008-12-18 Thread Ilia Alshanetsky
iliaa   Thu Dec 18 20:04:26 2008 UTC

  Modified files:  
/php-src/ext/xmlwriter  php_xmlwriter.c 
/php-src/ext/mysqli mysqli.c 
  Log:
  
  MFB: Fixed bug #46887 (Invalid calls to php_error_docref())
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlwriter/php_xmlwriter.c?r1=1.57r2=1.58diff_format=u
Index: php-src/ext/xmlwriter/php_xmlwriter.c
diff -u php-src/ext/xmlwriter/php_xmlwriter.c:1.57 
php-src/ext/xmlwriter/php_xmlwriter.c:1.58
--- php-src/ext/xmlwriter/php_xmlwriter.c:1.57  Mon Nov 17 11:26:25 2008
+++ php-src/ext/xmlwriter/php_xmlwriter.c   Thu Dec 18 20:04:26 2008
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: php_xmlwriter.c,v 1.57 2008/11/17 11:26:25 felipe Exp $ */
+/* $Id: php_xmlwriter.c,v 1.58 2008/12/18 20:04:26 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -168,7 +168,7 @@
 
 #define XMLW_NAME_CHK(__err) \
if (xmlValidateName((xmlChar *) name, 0) != 0) {\
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, __err); \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, __err);   
\
RETURN_FALSE;   \
}   \

http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.138r2=1.139diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.138 php-src/ext/mysqli/mysqli.c:1.139
--- php-src/ext/mysqli/mysqli.c:1.138   Thu Nov 27 19:02:44 2008
+++ php-src/ext/mysqli/mysqli.c Thu Dec 18 20:04:26 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel u...@php.net |
   +--+
 
-  $Id: mysqli.c,v 1.138 2008/11/27 19:02:44 dmitry Exp $ 
+  $Id: mysqli.c,v 1.139 2008/12/18 20:04:26 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1390,7 +1390,7 @@
 #define LOCAL_INFILE_ERROR_MSG(source,dest)\
memset(source, 0, LOCAL_INFILE_ERROR_LEN);\
memcpy(source, dest, MIN(strlen(dest), LOCAL_INFILE_ERROR_LEN-1));\
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, dest);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, dest);
 
 
 /* {{{ php_local_infile_init



-- 
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

2008-10-03 Thread Pierre-Alain Joye
pajoye  Fri Oct  3 16:20:57 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - MFB: Declarations MUST BE done in the beginning of a context
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.135r2=1.136diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.135 php-src/ext/mysqli/mysqli.c:1.136
--- php-src/ext/mysqli/mysqli.c:1.135   Fri Sep 19 11:39:53 2008
+++ php-src/ext/mysqli/mysqli.c Fri Oct  3 16:20:56 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.135 2008/09/19 11:39:53 andrey Exp $ 
+  $Id: mysqli.c,v 1.136 2008/10/03 16:20:56 pajoye Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -94,8 +94,8 @@
 /* Destructor for mysqli entries in free_links/used_links */
 void php_mysqli_dtor_p_elements(void *data)
 {
-   TSRMLS_FETCH();
MYSQL *mysql = (MYSQL *) data;
+   TSRMLS_FETCH();
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);
 }
 



-- 
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 /ext/mysqli/tests bug46109.phpt

2008-09-19 Thread Andrey Hristov
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

2008-09-19 Thread Antony Dovgal
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



[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2008-09-19 Thread Andrey Hristov
andrey  Fri Sep 19 11:39:53 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fix the libmysql build. Unintentionally broken by my last commit.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.134r2=1.135diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.134 php-src/ext/mysqli/mysqli.c:1.135
--- php-src/ext/mysqli/mysqli.c:1.134   Fri Sep 19 11:35:37 2008
+++ php-src/ext/mysqli/mysqli.c Fri Sep 19 11:39:53 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.134 2008/09/19 11:35:37 andrey Exp $ 
+  $Id: mysqli.c,v 1.135 2008/09/19 11:39:53 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



Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_api.c /ext/mysqli/tests bug46109.phpt

2008-09-19 Thread Andrey Hristov
 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

2008-03-18 Thread Andrey Hristov
andrey  Tue Mar 18 17:32:03 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  MFB : fix the build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.128r2=1.129diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.128 php-src/ext/mysqli/mysqli.c:1.129
--- php-src/ext/mysqli/mysqli.c:1.128   Tue Mar 18 16:58:42 2008
+++ php-src/ext/mysqli/mysqli.c Tue Mar 18 17:32:03 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.128 2008/03/18 16:58:42 andrey Exp $ 
+  $Id: mysqli.c,v 1.129 2008/03/18 17:32:03 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -986,9 +986,7 @@
  */
 PHP_MINFO_FUNCTION(mysqli)
 {
-#if defined(MYSQLI_USE_MYSQLND)
char buf[32];
-#endif
 
php_info_print_table_start();
php_info_print_table_header(2, MysqlI Support, enabled);



-- 
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

2008-03-10 Thread Johannes Schlüter
johannesMon Mar 10 13:26:15 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Fix build with older MySQL
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.124r2=1.125diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.124 php-src/ext/mysqli/mysqli.c:1.125
--- php-src/ext/mysqli/mysqli.c:1.124   Sat Mar  8 15:17:45 2008
+++ php-src/ext/mysqli/mysqli.c Mon Mar 10 13:26:15 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.124 2008/03/08 15:17:45 andrey Exp $ 
+  $Id: mysqli.c,v 1.125 2008/03/10 13:26:15 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -723,7 +723,9 @@
REGISTER_LONG_CONSTANT(MYSQLI_GROUP_FLAG, GROUP_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_ENUM_FLAG, ENUM_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_BINARY_FLAG, BINARY_FLAG, CONST_CS | 
CONST_PERSISTENT);
+#if (MYSQL_VERSION_ID  50001 || defined(HAVE_MYSQLND)
REGISTER_LONG_CONSTANT(MYSQLI_NO_DEFAULT_VALUE_FLAG, 
NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
+#endif
 
 #if (MYSQL_VERSION_ID  51122  MYSQL_VERSION_ID  6) || 
(MYSQL_VERSION_ID  60003) || defined(HAVE_MYSQLND)
REGISTER_LONG_CONSTANT(MYSQLI_ON_UPDATE_NOW_FLAG, ON_UPDATE_NOW_FLAG, 
CONST_CS | CONST_PERSISTENT);



-- 
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

2008-03-10 Thread Johannes Schlüter
johannesMon Mar 10 13:38:23 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fix typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.125r2=1.126diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.125 php-src/ext/mysqli/mysqli.c:1.126
--- php-src/ext/mysqli/mysqli.c:1.125   Mon Mar 10 13:26:15 2008
+++ php-src/ext/mysqli/mysqli.c Mon Mar 10 13:38:23 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.125 2008/03/10 13:26:15 johannes Exp $ 
+  $Id: mysqli.c,v 1.126 2008/03/10 13:38:23 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -723,7 +723,7 @@
REGISTER_LONG_CONSTANT(MYSQLI_GROUP_FLAG, GROUP_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_ENUM_FLAG, ENUM_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_BINARY_FLAG, BINARY_FLAG, CONST_CS | 
CONST_PERSISTENT);
-#if (MYSQL_VERSION_ID  50001 || defined(HAVE_MYSQLND)
+#if MYSQL_VERSION_ID  50001 || defined(HAVE_MYSQLND)
REGISTER_LONG_CONSTANT(MYSQLI_NO_DEFAULT_VALUE_FLAG, 
NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
 #endif
 



-- 
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

2008-03-08 Thread Andrey Hristov
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

2008-02-12 Thread Andrey Hristov
andrey  Tue Feb 12 10:51:25 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fix typo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.118r2=1.119diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.118 php-src/ext/mysqli/mysqli.c:1.119
--- php-src/ext/mysqli/mysqli.c:1.118   Mon Feb 11 16:45:15 2008
+++ php-src/ext/mysqli/mysqli.c Tue Feb 12 10:51:25 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.118 2008/02/11 16:45:15 andrey Exp $ 
+  $Id: mysqli.c,v 1.119 2008/02/12 10:51:25 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -726,7 +726,7 @@
REGISTER_LONG_CONSTANT(MYSQLI_BINARY_FLAG, BINARY_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_NO_DEFAULT_VALUE_FLAG, 
NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
 
-#if (MYSQL_VERSION_ID  51122  MYSQL_VERSION_ID  6) || 
(MYSQLI_VERSION_ID  60003) || defined(HAVE_MYSQLND)
+#if (MYSQL_VERSION_ID  51122  MYSQL_VERSION_ID  6) || 
(MYSQL_VERSION_ID  60003) || defined(HAVE_MYSQLND)
REGISTER_LONG_CONSTANT(MYSQLI_ON_UPDATE_NOW_FLAG, ON_UPDATE_NOW_FLAG, 
CONST_CS | CONST_PERSISTENT);
 #endif
 



-- 
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

2008-02-12 Thread Antony Dovgal
tony2001Tue Feb 12 10:54:27 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  nuke unnecessary TSRMLS_FETCH()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.119r2=1.120diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.119 php-src/ext/mysqli/mysqli.c:1.120
--- php-src/ext/mysqli/mysqli.c:1.119   Tue Feb 12 10:51:25 2008
+++ php-src/ext/mysqli/mysqli.c Tue Feb 12 10:54:27 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.119 2008/02/12 10:51:25 andrey Exp $ 
+  $Id: mysqli.c,v 1.120 2008/02/12 10:54:27 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -75,7 +75,6 @@
 void php_mysqli_dtor_p_elements(void *data)
 {
MYSQL *mysql = (MYSQL *) data;
-   TSRMLS_FETCH();
 #if defined(HAVE_MYSQLND)
mysqlnd_end_psession(mysql);
 #endif

-- 
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

2008-02-12 Thread Johannes Schlüter
johannesTue Feb 12 20:18:56 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Fix build with TSRM and mysqlnd
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.120r2=1.121diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.120 php-src/ext/mysqli/mysqli.c:1.121
--- php-src/ext/mysqli/mysqli.c:1.120   Tue Feb 12 10:54:27 2008
+++ php-src/ext/mysqli/mysqli.c Tue Feb 12 20:18:56 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.120 2008/02/12 10:54:27 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.121 2008/02/12 20:18:56 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -76,6 +76,8 @@
 {
MYSQL *mysql = (MYSQL *) data;
 #if defined(HAVE_MYSQLND)
+   TSRMLS_FETCH();
+
mysqlnd_end_psession(mysql);
 #endif
mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT);

-- 
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

2008-02-12 Thread Andrey Hristov
andrey  Tue Feb 12 22:06:06 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fix Windows build. VC doesn't like nested macros - expansion + #if
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.121r2=1.122diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.121 php-src/ext/mysqli/mysqli.c:1.122
--- php-src/ext/mysqli/mysqli.c:1.121   Tue Feb 12 20:18:56 2008
+++ php-src/ext/mysqli/mysqli.c Tue Feb 12 22:06:06 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.121 2008/02/12 20:18:56 johannes Exp $ 
+  $Id: mysqli.c,v 1.122 2008/02/12 22:06:06 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -778,17 +778,16 @@
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_ALL, MYSQLI_REPORT_ALL, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_OFF, 0, CONST_CS | 
CONST_PERSISTENT);
 
-   REGISTER_LONG_CONSTANT(MYSQLI_DEBUG_TRACE_ENABLED, 
+   /* We use non-nested macros with expansion, as VC has problems */
 #ifdef HAVE_MYSQLND
-   MYSQLND_DBG_ENABLED
+   REGISTER_LONG_CONSTANT(MYSQLI_DEBUG_TRACE_ENABLED, 
MYSQLND_DBG_ENABLED, CONST_CS | CONST_PERSISTENT);
 #else
 #ifndef DBUG_OFF
-   0
+   REGISTER_LONG_CONSTANT(MYSQLI_DEBUG_TRACE_ENABLED, 0, CONST_CS | 
CONST_PERSISTENT);
 #else
-   1
+   REGISTER_LONG_CONSTANT(MYSQLI_DEBUG_TRACE_ENABLED, 1, CONST_CS | 
CONST_PERSISTENT);
 #endif
 #endif
-   , CONST_CS | CONST_PERSISTENT);
 
return SUCCESS;
 }

-- 
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 /ext/mysqlnd mysqlnd.c mysqlnd.h mysqlnd_debug.c mysqlnd_debug.h mysqlnd_enum_n_def.h mysqlnd_structs.h

2008-02-11 Thread Andrey Hristov
andrey  Mon Feb 11 16:45:15 2008 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
/php-src/ext/mysqlndmysqlnd.c mysqlnd.h mysqlnd_debug.c 
mysqlnd_debug.h mysqlnd_enum_n_def.h 
mysqlnd_structs.h 
  Log:
  cvs sync
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.117r2=1.118diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.117 php-src/ext/mysqli/mysqli.c:1.118
--- php-src/ext/mysqli/mysqli.c:1.117   Wed Feb  6 11:35:44 2008
+++ php-src/ext/mysqli/mysqli.c Mon Feb 11 16:45:15 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.117 2008/02/06 11:35:44 andrey Exp $ 
+  $Id: mysqli.c,v 1.118 2008/02/11 16:45:15 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -722,6 +722,13 @@
REGISTER_LONG_CONSTANT(MYSQLI_NUM_FLAG, NUM_FLAG, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_PART_KEY_FLAG, PART_KEY_FLAG, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_GROUP_FLAG, GROUP_FLAG, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(MYSQLI_ENUM_FLAG, ENUM_FLAG, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(MYSQLI_BINARY_FLAG, BINARY_FLAG, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(MYSQLI_NO_DEFAULT_VALUE_FLAG, 
NO_DEFAULT_VALUE_FLAG, CONST_CS | CONST_PERSISTENT);
+
+#if (MYSQL_VERSION_ID  51122  MYSQL_VERSION_ID  6) || 
(MYSQLI_VERSION_ID  60003) || defined(HAVE_MYSQLND)
+   REGISTER_LONG_CONSTANT(MYSQLI_ON_UPDATE_NOW_FLAG, ON_UPDATE_NOW_FLAG, 
CONST_CS | CONST_PERSISTENT);
+#endif
 
REGISTER_LONG_CONSTANT(MYSQLI_TYPE_DECIMAL, FIELD_TYPE_DECIMAL, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_TYPE_TINY, FIELD_TYPE_TINY, CONST_CS | 
CONST_PERSISTENT);
@@ -770,6 +777,18 @@
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_ALL, MYSQLI_REPORT_ALL, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_OFF, 0, CONST_CS | 
CONST_PERSISTENT);
 
+   REGISTER_LONG_CONSTANT(MYSQLI_DEBUG_TRACE_ENABLED, 
+#ifdef HAVE_MYSQLND
+   MYSQLND_DBG_ENABLED
+#else
+#ifndef DBUG_OFF
+   0
+#else
+   1
+#endif
+#endif
+   , CONST_CS | CONST_PERSISTENT);
+
return SUCCESS;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.c?r1=1.17r2=1.18diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd.c
diff -u php-src/ext/mysqlnd/mysqlnd.c:1.17 php-src/ext/mysqlnd/mysqlnd.c:1.18
--- php-src/ext/mysqlnd/mysqlnd.c:1.17  Mon Feb  4 17:55:51 2008
+++ php-src/ext/mysqlnd/mysqlnd.c   Mon Feb 11 16:45:15 2008
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: mysqlnd.c,v 1.17 2008/02/04 17:55:51 andrey Exp $ */
+/* $Id: mysqlnd.c,v 1.18 2008/02/11 16:45:15 andrey Exp $ */
 #include php.h
 #include mysqlnd.h
 #include mysqlnd_wireprotocol.h
@@ -28,6 +28,8 @@
 #include mysqlnd_charset.h
 #include mysqlnd_debug.h
 #include mysqlnd_block_alloc.h
+/* for php_get_current_user() */
+#include ext/standard/basic_functions.h 
 
 /* the server doesn't support 4byte utf8, but let's make it forward compatible 
*/
 #define MYSQLND_MAX_ALLOWED_USER_LEN   256  /* 64 char * 4byte */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.h?r1=1.10r2=1.11diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd.h
diff -u php-src/ext/mysqlnd/mysqlnd.h:1.10 php-src/ext/mysqlnd/mysqlnd.h:1.11
--- php-src/ext/mysqlnd/mysqlnd.h:1.10  Tue Jan 29 18:13:12 2008
+++ php-src/ext/mysqlnd/mysqlnd.h   Mon Feb 11 16:45:15 2008
@@ -18,12 +18,12 @@
   +--+
 */
 
-/* $Id: mysqlnd.h,v 1.10 2008/01/29 18:13:12 andrey Exp $ */
+/* $Id: mysqlnd.h,v 1.11 2008/02/11 16:45:15 andrey Exp $ */
 
 #ifndef MYSQLND_H
 #define MYSQLND_H
 
-#define MYSQLND_VERSION mysqlnd 5.0.3-dev - 080129 - $Revision: 1.10 $
+#define MYSQLND_VERSION mysqlnd 5.0.3-dev - 080129 - $Revision: 1.11 $
 #define MYSQLND_VERSION_ID 50002
 
 /* This forces inlining of some accessor functions */
@@ -46,6 +46,12 @@
 #define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
 #endif
 
+#if PHP_DEBUG  !defined(PHP_WIN32)
+#define MYSQLND_DBG_ENABLED 1
+#else
+#define MYSQLND_DBG_ENABLED 0
+#endif
+
 #ifdef ZTS
 #include TSRM.h
 #endif
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd_debug.c?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/mysqlnd/mysqlnd_debug.c
diff -u php-src/ext/mysqlnd/mysqlnd_debug.c:1.3 
php-src/ext/mysqlnd/mysqlnd_debug.c:1.4
--- php-src/ext/mysqlnd/mysqlnd_debug.c:1.3 Mon Dec 31 07:12:12 2007
+++ php-src/ext/mysqlnd/mysqlnd_debug.c Mon Feb 11 16:45:15 2008
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: mysqlnd_debug.c,v 1.3 2007/12/31 

[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

2008-02-06 Thread Andrey Hristov
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 /ext/mysqli/tests mysqli_master_query.phpt

2008-01-03 Thread Johannes Schlüter
johannesThu Jan  3 14:32:52 2008 UTC

  Removed files:   
/php-src/ext/mysqli/tests   mysqli_master_query.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Remove more replication stuff
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.114r2=1.115diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.114 php-src/ext/mysqli/mysqli.c:1.115
--- php-src/ext/mysqli/mysqli.c:1.114   Mon Dec 31 07:12:11 2007
+++ php-src/ext/mysqli/mysqli.c Thu Jan  3 14:32:52 2008
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.114 2007/12/31 07:12:11 sebastian Exp $ 
+  $Id: mysqli.c,v 1.115 2008/01/03 14:32:52 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -757,13 +757,6 @@
 
REGISTER_LONG_CONSTANT(MYSQLI_SET_CHARSET_NAME, 
MYSQL_SET_CHARSET_NAME, CONST_CS | CONST_PERSISTENT);
 
-   /* replication */
-#if !defined(HAVE_MYSQLND)
-   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);
-   REGISTER_LONG_CONSTANT(MYSQLI_RPL_ADMIN, MYSQL_RPL_ADMIN, CONST_CS | 
CONST_PERSISTENT);
-#endif
-   
/* bind support */
REGISTER_LONG_CONSTANT(MYSQLI_NO_DATA, MYSQL_NO_DATA, CONST_CS | 
CONST_PERSISTENT);
 #ifdef MYSQL_DATA_TRUNCATED

-- 
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_structs.h

2007-11-09 Thread Andrey Hristov
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

2007-10-17 Thread Antony Dovgal
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



[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2007-10-16 Thread Antony Dovgal
tony2001Tue Oct 16 13:18:56 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  use zval_dtor() instead of efree() + FREE_ZVAL()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.110r2=1.111diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.110 php-src/ext/mysqli/mysqli.c:1.111
--- php-src/ext/mysqli/mysqli.c:1.110   Sun Oct  7 05:15:04 2007
+++ php-src/ext/mysqli/mysqli.c Tue Oct 16 13:18:55 2007
@@ -17,7 +17,7 @@
   |  Ulf Wendel [EMAIL PROTECTED]
 |
   +--+
 
-  $Id: mysqli.c,v 1.110 2007/10/07 05:15:04 davidw Exp $ 
+  $Id: mysqli.c,v 1.111 2007/10/16 13:18:55 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -205,8 +205,7 @@
mysql-hash_key = NULL;
}
if (mysql-li_read) {
-   efree(Z_STRVAL_P(mysql-li_read));
-   FREE_ZVAL(mysql-li_read);
+   zval_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



[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2007-02-16 Thread Stanislav Malyshev
stasFri Feb 16 18:49:06 2007 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  use error message size
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.101r2=1.102diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.101 php-src/ext/mysqli/mysqli.c:1.102
--- php-src/ext/mysqli/mysqli.c:1.101   Mon Jan  1 09:29:25 2007
+++ php-src/ext/mysqli/mysqli.c Fri Feb 16 18:49:06 2007
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.101 2007/01/01 09:29:25 sebastian Exp $ 
+  $Id: mysqli.c,v 1.102 2007/02/16 18:49:06 stas Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1151,10 +1151,10 @@
mysqli_local_infile *data = (mysqli_local_infile *) ptr;
 
if (data) {
-   strcpy(error_msg, data-error_msg);
+   strlcpy(error_msg, data-error_msg, error_msg_len);
return 2000;
} 
-   strcpy(error_msg, ER(CR_OUT_OF_MEMORY));
+   strlcpy(error_msg, ER(CR_OUT_OF_MEMORY), error_msg_len);
return CR_OUT_OF_MEMORY;
 }
 /* }}} */

-- 
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

2006-10-02 Thread Andrei Zmievski

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

2006-10-01 Thread Georg Richter
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

2006-09-29 Thread Georg Richter
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

2006-09-28 Thread Andrei Zmievski

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

2006-09-27 Thread Georg Richter
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

2006-09-26 Thread Antony Dovgal


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

2006-07-27 Thread Antony Dovgal
tony2001Thu Jul 27 10:53:03 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix leak in php_local_infile_init() handler
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.96r2=1.97diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.96 php-src/ext/mysqli/mysqli.c:1.97
--- php-src/ext/mysqli/mysqli.c:1.96Mon Jul 10 13:16:07 2006
+++ php-src/ext/mysqli/mysqli.c Thu Jul 27 10:53:03 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.96 2006/07/10 13:16:07 mike Exp $ 
+  $Id: mysqli.c,v 1.97 2006/07/27 10:53:03 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1142,11 +1142,15 @@
 
data= (mysqli_local_infile *)ptr;
 
-   if (!(mysql = data-userdata)) {
+   if (!data || !(mysql = data-userdata)) {
+   if (data) {
+   free(data);
+   }
return;
}
 
php_stream_close(mysql-li_stream);
+   free(data);
return; 
 }
 /* }}} */

-- 
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

2006-07-10 Thread Dmitry Stogov
dmitry  Mon Jul 10 10:05:35 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fixed bug #38019 (segfault extending mysqli class)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.91r2=1.92diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.91 php-src/ext/mysqli/mysqli.c:1.92
--- php-src/ext/mysqli/mysqli.c:1.91Wed Jul  5 11:48:17 2006
+++ php-src/ext/mysqli/mysqli.c Mon Jul 10 10:05:35 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.91 2006/07/05 11:48:17 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.92 2006/07/10 10:05:35 dmitry Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -132,13 +132,15 @@
 }
 /* }}} */
 
-/* {{{ mysqli_objects_free_storage
+/* {{{ mysqli_objects_destroy_object
  */
-static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_objects_destroy_object(zend_object *object, 
zend_object_handle handle TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
+   zend_objects_destroy_object(object, handle TSRMLS_CC);
+
/* link object */
if (instanceof_function(intern-zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {
if (my_res  my_res-ptr) {
@@ -164,9 +166,17 @@
php_clear_warnings((MYSQLI_WARNING *)my_res-info);
}
}
-   intern-ptr = NULL;
-   my_efree(my_res);
-   
+}
+/* }}} */
+
+/* {{{ mysqli_objects_free_storage
+ */
+static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
+{
+   mysqli_object   *intern = (mysqli_object *)object;
+   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
+
+   my_efree(my_res);   
zend_object_std_dtor(intern-zo TSRMLS_CC);
efree(intern);
 }
@@ -352,7 +362,7 @@
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 
-   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) mysqli_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
retval.handlers = mysqli_object_handlers;
 
return retval;

-- 
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

2006-07-10 Thread Dmitry Stogov
dmitry  Mon Jul 10 12:46:46 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Another fix for #38019
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.92r2=1.93diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.92 php-src/ext/mysqli/mysqli.c:1.93
--- php-src/ext/mysqli/mysqli.c:1.92Mon Jul 10 10:05:35 2006
+++ php-src/ext/mysqli/mysqli.c Mon Jul 10 12:46:46 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.92 2006/07/10 10:05:35 dmitry Exp $ 
+  $Id: mysqli.c,v 1.93 2006/07/10 12:46:46 dmitry Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -132,53 +132,79 @@
 }
 /* }}} */
 
-/* {{{ mysqli_objects_destroy_object
+/* {{{ mysqli_objects_free_storage
  */
-static void mysqli_objects_destroy_object(zend_object *object, 
zend_object_handle handle TSRMLS_DC)
+static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
-   zend_objects_destroy_object(object, handle TSRMLS_CC);
+   my_efree(my_res);   
+   zend_object_std_dtor(intern-zo TSRMLS_CC);
+   efree(intern);
+}
+/* }}} */
 
-   /* link object */
-   if (instanceof_function(intern-zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {
-   if (my_res  my_res-ptr) {
-   MY_MYSQL *mysql = (MY_MYSQL *)my_res-ptr;
-   if (mysql-mysql) {
-   mysql_close(mysql-mysql);
-   }
-   php_clear_mysql(mysql);
-   efree(mysql);
-   my_res-ptr = NULL;
-   }
-   } 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 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 object */
-   if (my_res  my_res-ptr) {
-   php_clear_warnings((MYSQLI_WARNING *)my_res-info);
+/* {{{ mysqli_link_free_storage
+ */
+static void mysqli_link_free_storage(zend_object *object TSRMLS_DC)
+{
+   mysqli_object   *intern = (mysqli_object *)object;
+   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
+
+   if (my_res  my_res-ptr) {
+   MY_MYSQL *mysql = (MY_MYSQL *)my_res-ptr;
+   if (mysql-mysql) {
+   mysql_close(mysql-mysql);
}
+   php_clear_mysql(mysql);
+   efree(mysql);
}
+   mysqli_objects_free_storage(object TSRMLS_CC);
 }
 /* }}} */
 
-/* {{{ mysqli_objects_free_storage
+/* {{{ mysqli_stmt_free_storage
  */
-static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_stmt_free_storage(zend_object *object TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
-   my_efree(my_res);   
-   zend_object_std_dtor(intern-zo TSRMLS_CC);
-   efree(intern);
+   if (my_res  my_res-ptr) {
+   MY_STMT *stmt = (MY_STMT *)my_res-ptr;
+   php_clear_stmt_bind(stmt);
+   }
+   mysqli_objects_free_storage(object TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ mysqli_result_free_storage
+ */
+static void mysqli_result_free_storage(zend_object *object TSRMLS_DC)
+{
+   mysqli_object   *intern = (mysqli_object *)object;
+   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
+
+   if (my_res  my_res-ptr) {
+   mysql_free_result(my_res-ptr);
+   }
+   mysqli_objects_free_storage(object TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ mysqli_warning_free_storage
+ */
+static void mysqli_warning_free_storage(zend_object *object TSRMLS_DC)
+{
+   mysqli_object   *intern = (mysqli_object *)object;
+   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
+
+   if (my_res  my_res-ptr) {
+   php_clear_warnings((MYSQLI_WARNING *)my_res-info);
+   my_res-ptr = NULL;
+   }
+   mysqli_objects_free_storage(object TSRMLS_CC);
 }
 /* }}} */
 
@@ -343,6 +369,7 @@
mysqli_object *intern;
zval *tmp;
zend_class_entry *mysqli_base_class;
+   zend_objects_free_object_storage_t free_storage;
 
intern = emalloc(sizeof(mysqli_object));
memset(intern, 0, 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2006-07-10 Thread Antony Dovgal
tony2001Mon Jul 10 13:02:31 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix mysqli_*_free_storage() funcs to conform with their prototypes 
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.93r2=1.94diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.93 php-src/ext/mysqli/mysqli.c:1.94
--- php-src/ext/mysqli/mysqli.c:1.93Mon Jul 10 12:46:46 2006
+++ php-src/ext/mysqli/mysqli.c Mon Jul 10 13:02:31 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.93 2006/07/10 12:46:46 dmitry Exp $ 
+  $Id: mysqli.c,v 1.94 2006/07/10 13:02:31 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -134,9 +134,10 @@
 
 /* {{{ mysqli_objects_free_storage
  */
-static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_objects_free_storage(void *object TSRMLS_DC)
 {
-   mysqli_object   *intern = (mysqli_object *)object;
+   zend_object *zo = (zend_object *)object;
+   mysqli_object   *intern = (mysqli_object *)zo;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
my_efree(my_res);   
@@ -147,9 +148,10 @@
 
 /* {{{ mysqli_link_free_storage
  */
-static void mysqli_link_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_link_free_storage(void *object TSRMLS_DC)
 {
-   mysqli_object   *intern = (mysqli_object *)object;
+   zend_object *zo = (zend_object *)object;
+   mysqli_object   *intern = (mysqli_object *)zo;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
if (my_res  my_res-ptr) {
@@ -166,9 +168,10 @@
 
 /* {{{ mysqli_stmt_free_storage
  */
-static void mysqli_stmt_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_stmt_free_storage(void *object TSRMLS_DC)
 {
-   mysqli_object   *intern = (mysqli_object *)object;
+   zend_object *zo = (zend_object *)object;
+   mysqli_object   *intern = (mysqli_object *)zo;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
if (my_res  my_res-ptr) {
@@ -181,9 +184,10 @@
 
 /* {{{ mysqli_result_free_storage
  */
-static void mysqli_result_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_result_free_storage(void *object TSRMLS_DC)
 {
-   mysqli_object   *intern = (mysqli_object *)object;
+   zend_object *zo = (zend_object *)object;
+   mysqli_object   *intern = (mysqli_object *)zo;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
if (my_res  my_res-ptr) {
@@ -195,9 +199,10 @@
 
 /* {{{ mysqli_warning_free_storage
  */
-static void mysqli_warning_free_storage(zend_object *object TSRMLS_DC)
+static void mysqli_warning_free_storage(void *object TSRMLS_DC)
 {
-   mysqli_object   *intern = (mysqli_object *)object;
+   zend_object *zo = (zend_object *)object;
+   mysqli_object   *intern = (mysqli_object *)zo;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
if (my_res  my_res-ptr) {

-- 
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

2006-07-10 Thread Michael Wallner
mikeMon Jul 10 13:08:11 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - fix 5.2 build
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.94r2=1.95diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.94 php-src/ext/mysqli/mysqli.c:1.95
--- php-src/ext/mysqli/mysqli.c:1.94Mon Jul 10 13:02:31 2006
+++ php-src/ext/mysqli/mysqli.c Mon Jul 10 13:08:11 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.94 2006/07/10 13:02:31 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.95 2006/07/10 13:08:11 mike Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -255,7 +255,7 @@
}
 
if (ret == SUCCESS) {
-   if (strcmp(obj-zo.ce-name.s, mysqli_driver) 
+   if (strcmp(obj-zo.ce-name, mysqli_driver) 
 (!obj-ptr || ((MYSQLI_RESOURCE *)(obj-ptr))-status  
MYSQLI_STATUS_INITIALIZED)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't 
fetch %s, obj-zo.ce-name );
retval = EG(uninitialized_zval_ptr);
@@ -359,7 +359,7 @@
} else if (obj-zo.ce == mysqli_driver_class_entry) {
f.handler = ZEND_FN(mysqli_driver_construct);
} else if (obj-zo.ce == mysqli_warning_class_entry) {
-   f.handler = ZEND_FN(mysqli_warning_construct);
+   f.handler = ZEND_MN(mysqli_warning___construct);
}

return (union _zend_function*)f;
@@ -387,7 +387,7 @@
mysqli_base_class = mysqli_base_class-parent;
}
 
-   zend_hash_find(classes, mysqli_base_class-name.s, 
mysqli_base_class-name_length + 1, 
+   zend_hash_find(classes, mysqli_base_class-name, 
mysqli_base_class-name_length + 1, 
(void **) intern-prop_handler);
 
zend_object_std_init(intern-zo, class_type TSRMLS_CC);
@@ -506,33 +506,33 @@
ce = mysqli_driver_class_entry;
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);
+   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
ce-ce_flags |= ZEND_ACC_FINAL_CLASS;
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli, mysqli_link_class_entry, 
mysqli_link_methods);
ce = mysqli_link_class_entry;
zend_hash_init(mysqli_link_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_link_properties, 
mysqli_link_property_entries);
-   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
+   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
 
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;
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);
+   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_result, mysqli_result_class_entry, 
mysqli_result_methods);
ce = mysqli_result_class_entry;
zend_hash_init(mysqli_result_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_result_properties, 
mysqli_result_property_entries);
-   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
+   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_stmt, mysqli_stmt_class_entry, 
mysqli_stmt_methods);
ce = mysqli_stmt_class_entry;
zend_hash_init(mysqli_stmt_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_stmt_properties, 
mysqli_stmt_property_entries);
-   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
+   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);

/* mysqli_options */
REGISTER_LONG_CONSTANT(MYSQLI_READ_DEFAULT_GROUP, 
MYSQL_READ_DEFAULT_GROUP, CONST_CS | 

RE: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2006-07-10 Thread Dmitry Stogov
Are you sure?
Are you fixing 5.2 build in 6.0 CVS???

Dmitry.


 -Original Message-
 From: Michael Wallner [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 10, 2006 5:08 PM
 To: php-cvs@lists.php.net
 Subject: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c 
 
 
 mike  Mon Jul 10 13:08:11 2006 UTC
 
   Modified files:  
 /php-src/ext/mysqli   mysqli.c 
   Log:
   - fix 5.2 build
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1
 .94r2=1.95diff_format=u
 Index: php-src/ext/mysqli/mysqli.c
 diff -u php-src/ext/mysqli/mysqli.c:1.94 
 php-src/ext/mysqli/mysqli.c:1.95
 --- php-src/ext/mysqli/mysqli.c:1.94  Mon Jul 10 13:02:31 2006
 +++ php-src/ext/mysqli/mysqli.c   Mon Jul 10 13:08:11 2006
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |

 +-
 -+
  
 -  $Id: mysqli.c,v 1.94 2006/07/10 13:02:31 tony2001 Exp $ 
 +  $Id: mysqli.c,v 1.95 2006/07/10 13:08:11 mike Exp $
  */
  
  #ifdef HAVE_CONFIG_H
 @@ -255,7 +255,7 @@
   }
  
   if (ret == SUCCESS) {
 - if (strcmp(obj-zo.ce-name.s, mysqli_driver) 
 + if (strcmp(obj-zo.ce-name, mysqli_driver) 
  (!obj-ptr || ((MYSQLI_RESOURCE 
 *)(obj-ptr))-status  MYSQLI_STATUS_INITIALIZED)) {
   php_error_docref(NULL TSRMLS_CC, 
 E_WARNING, Couldn't fetch %s, obj-zo.ce-name );
   retval = EG(uninitialized_zval_ptr);
 @@ -359,7 +359,7 @@
   } else if (obj-zo.ce == mysqli_driver_class_entry) {
   f.handler = ZEND_FN(mysqli_driver_construct);
   } else if (obj-zo.ce == mysqli_warning_class_entry) {
 - f.handler = ZEND_FN(mysqli_warning_construct);
 + f.handler = ZEND_MN(mysqli_warning___construct);
   }
   
   return (union _zend_function*)f;
 @@ -387,7 +387,7 @@
   mysqli_base_class = mysqli_base_class-parent;
   }
  
 - zend_hash_find(classes, mysqli_base_class-name.s, 
 mysqli_base_class-name_length + 1, 
 + zend_hash_find(classes, mysqli_base_class-name, 
 +mysqli_base_class-name_length + 1,
   (void **) 
 intern-prop_handler);
  
   zend_object_std_init(intern-zo, class_type TSRMLS_CC);
 @@ -506,33 +506,33 @@
   ce = mysqli_driver_class_entry;
   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);
 + zend_hash_add(classes, ce-name, ce-name_length+1, 
 +mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
   ce-ce_flags |= ZEND_ACC_FINAL_CLASS;
  
   REGISTER_MYSQLI_CLASS_ENTRY(mysqli, 
 mysqli_link_class_entry, mysqli_link_methods);
   ce = mysqli_link_class_entry;
   zend_hash_init(mysqli_link_properties, 0, NULL, NULL, 1);
   MYSQLI_ADD_PROPERTIES(mysqli_link_properties, 
 mysqli_link_property_entries);
 - zend_hash_add(classes, ce-name.s, ce-name_length+1, 
 mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
 + zend_hash_add(classes, ce-name, ce-name_length+1, 
 +mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
  
   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;
   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);
 + zend_hash_add(classes, ce-name, ce-name_length+1, 
 +mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
  
   REGISTER_MYSQLI_CLASS_ENTRY(mysqli_result, 
 mysqli_result_class_entry, mysqli_result_methods);
   ce = mysqli_result_class_entry;
   zend_hash_init(mysqli_result_properties, 0, NULL, NULL, 1);
   MYSQLI_ADD_PROPERTIES(mysqli_result_properties, 
 mysqli_result_property_entries);
 - zend_hash_add(classes, ce-name.s, ce-name_length+1, 
 mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
 + zend_hash_add(classes, ce-name, ce-name_length+1, 
 +mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
  
   REGISTER_MYSQLI_CLASS_ENTRY(mysqli_stmt, 
 mysqli_stmt_class_entry, mysqli_stmt_methods);
   ce = mysqli_stmt_class_entry;
   zend_hash_init(mysqli_stmt_properties, 0, NULL, NULL, 1);
   MYSQLI_ADD_PROPERTIES(mysqli_stmt_properties, 
 mysqli_stmt_property_entries);
 - zend_hash_add(classes, ce-name.s, ce-name_length+1, 
 mysqli_stmt_properties

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2006-07-10 Thread Michael Wallner
mikeMon Jul 10 13:16:07 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - revert messed up patch
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.95r2=1.96diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.95 php-src/ext/mysqli/mysqli.c:1.96
--- php-src/ext/mysqli/mysqli.c:1.95Mon Jul 10 13:08:11 2006
+++ php-src/ext/mysqli/mysqli.c Mon Jul 10 13:16:07 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.95 2006/07/10 13:08:11 mike Exp $ 
+  $Id: mysqli.c,v 1.96 2006/07/10 13:16:07 mike Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -255,7 +255,7 @@
}
 
if (ret == SUCCESS) {
-   if (strcmp(obj-zo.ce-name, mysqli_driver) 
+   if (strcmp(obj-zo.ce-name.s, mysqli_driver) 
 (!obj-ptr || ((MYSQLI_RESOURCE *)(obj-ptr))-status  
MYSQLI_STATUS_INITIALIZED)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't 
fetch %s, obj-zo.ce-name );
retval = EG(uninitialized_zval_ptr);
@@ -359,7 +359,7 @@
} else if (obj-zo.ce == mysqli_driver_class_entry) {
f.handler = ZEND_FN(mysqli_driver_construct);
} else if (obj-zo.ce == mysqli_warning_class_entry) {
-   f.handler = ZEND_MN(mysqli_warning___construct);
+   f.handler = ZEND_FN(mysqli_warning_construct);
}

return (union _zend_function*)f;
@@ -387,7 +387,7 @@
mysqli_base_class = mysqli_base_class-parent;
}
 
-   zend_hash_find(classes, mysqli_base_class-name, 
mysqli_base_class-name_length + 1, 
+   zend_hash_find(classes, mysqli_base_class-name.s, 
mysqli_base_class-name_length + 1, 
(void **) intern-prop_handler);
 
zend_object_std_init(intern-zo, class_type TSRMLS_CC);
@@ -506,33 +506,33 @@
ce = mysqli_driver_class_entry;
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, ce-name_length+1, 
mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
+   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;
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli, mysqli_link_class_entry, 
mysqli_link_methods);
ce = mysqli_link_class_entry;
zend_hash_init(mysqli_link_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_link_properties, 
mysqli_link_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
 
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;
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, ce-name_length+1, 
mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_result, mysqli_result_class_entry, 
mysqli_result_methods);
ce = mysqli_result_class_entry;
zend_hash_init(mysqli_result_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_result_properties, 
mysqli_result_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_stmt, mysqli_stmt_class_entry, 
mysqli_stmt_methods);
ce = mysqli_stmt_class_entry;
zend_hash_init(mysqli_stmt_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_stmt_properties, 
mysqli_stmt_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);

/* mysqli_options */
REGISTER_LONG_CONSTANT(MYSQLI_READ_DEFAULT_GROUP, 
MYSQL_READ_DEFAULT_GROUP, 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2006-07-05 Thread Antony Dovgal
tony2001Wed Jul  5 11:48:17 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix bug #38003(in classes inherited from mysqli it's possible to call private 
constructors from invalid context)
  also, use appropriate macro instead of accessing structure elements directly
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.90r2=1.91diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.90 php-src/ext/mysqli/mysqli.c:1.91
--- php-src/ext/mysqli/mysqli.c:1.90Tue Jun 13 13:12:19 2006
+++ php-src/ext/mysqli/mysqli.c Wed Jul  5 11:48:17 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.90 2006/06/13 13:12:19 dmitry Exp $ 
+  $Id: mysqli.c,v 1.91 2006/07/05 11:48:17 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -293,11 +293,12 @@
 static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC)
 {
mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object 
TSRMLS_CC);
+   zend_class_entry * ce = Z_OBJCE_P(object);
 
-   if (obj-zo.ce != mysqli_link_class_entry  obj-zo.ce != 
mysqli_stmt_class_entry 
-   obj-zo.ce != mysqli_result_class_entry  obj-zo.ce != 
mysqli_driver_class_entry  
-   obj-zo.ce != mysqli_warning_class_entry) {
-   return obj-zo.ce-constructor;
+   if (ce != mysqli_link_class_entry  ce != mysqli_stmt_class_entry 
+   ce != mysqli_result_class_entry  ce != 
mysqli_driver_class_entry  
+   ce != mysqli_warning_class_entry) {
+   return zend_std_get_constructor(object TSRMLS_CC);
} else {
static zend_internal_function f;
 

-- 
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 /ext/mysqli/tests bug36949.phpt

2006-05-29 Thread Michael Wallner
mikeMon May 29 16:55:40 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
/php-src/ext/mysqli/tests   bug36949.phpt 
  Log:
  MFB: Fixed bug #36949 (invalid internal mysqli objects dtor)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.88r2=1.89diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.88 php-src/ext/mysqli/mysqli.c:1.89
--- php-src/ext/mysqli/mysqli.c:1.88Wed May 10 12:29:09 2006
+++ php-src/ext/mysqli/mysqli.c Mon May 29 16:55:40 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.88 2006/05/10 12:29:09 andrey Exp $ 
+  $Id: mysqli.c,v 1.89 2006/05/29 16:55:40 mike Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -135,22 +135,7 @@
 static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
-
-   zend_object_std_dtor(intern-zo TSRMLS_CC);
-   efree(intern);
-}
-/* }}} */
-
-/* {{{ mysqli_objects_destroy_object
- */
-static void mysqli_objects_destroy_object(void *object, zend_object_handle 
handle TSRMLS_DC)
-{
-   mysqli_object   *intern = (mysqli_object *)object;
-   MYSQLI_RESOURCE *my_res;
-
-   zend_objects_destroy_object(object, handle TSRMLS_CC);
-   
-   my_res = (MYSQLI_RESOURCE *)intern-ptr;
+   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
/* link object */
if (instanceof_function(intern-zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {
@@ -179,6 +164,9 @@
}
intern-ptr = NULL;
my_efree(my_res);
+   
+   zend_object_std_dtor(intern-zo TSRMLS_CC);
+   efree(intern);
 }
 /* }}} */
 
@@ -361,7 +349,7 @@
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 
-   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) mysqli_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
retval.handlers = mysqli_object_handlers;
 
return retval;
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/tests/bug36949.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/mysqli/tests/bug36949.phpt
diff -u /dev/null php-src/ext/mysqli/tests/bug36949.phpt:1.2
--- /dev/null   Mon May 29 16:55:40 2006
+++ php-src/ext/mysqli/tests/bug36949.phpt  Mon May 29 16:55:40 2006
@@ -0,0 +1,50 @@
+--TEST--
+bug #36949
+--SKIPIF--
+?php require_once('skipif.inc'); ?
+--FILE--
+?php
+include connect.inc;
+
+class A {
+
+   private $mysqli;
+
+   public function __construct() {
+   global $user, $host, $passwd;
+   $this-mysqli = new mysqli($host, $user, $passwd);
+   $result = $this-mysqli-query(SELECT NOW() AS my_time FROM 
DUAL);
+   $row = $result-fetch_object();
+   echo $row-my_time.br\n;
+   $result-close();
+   }
+
+   public function __destruct() {
+   $this-mysqli-close();
+   }
+}
+
+class B {
+
+   private $mysqli;
+
+   public function __construct() {
+   global $user, $host, $passwd;
+   $this-mysqli = new mysqli($host, $user, $passwd);
+   $result = $this-mysqli-query(SELECT NOW() AS my_time FROM 
DUAL);
+   $row = $result-fetch_object();
+   echo $row-my_time.br\n;
+   $result-close();
+   }
+
+   public function __destruct() {
+   $this-mysqli-close();
+   }
+}
+
+$A = new A();
+$B = new B();
+?
+--EXPECTF--
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%dbr
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%dbr

-- 
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

2006-05-10 Thread Andrey Hristov
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

2006-03-30 Thread Antony Dovgal
tony2001Thu Mar 30 11:23:11 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  MF51: fix #36922 (missing MYSQLI_REPORT_STRICT constant in userspace)
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.85r2=1.86diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.85 php-src/ext/mysqli/mysqli.c:1.86
--- php-src/ext/mysqli/mysqli.c:1.85Wed Mar 29 16:30:54 2006
+++ php-src/ext/mysqli/mysqli.c Thu Mar 30 11:23:11 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.85 2006/03/29 16:30:54 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.86 2006/03/30 11:23:11 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -581,6 +581,7 @@
/* reporting */
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_INDEX, MYSQLI_REPORT_INDEX, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_ERROR, MYSQLI_REPORT_ERROR, 
CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(MYSQLI_REPORT_STRICT, MYSQLI_REPORT_STRICT, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_ALL, MYSQLI_REPORT_ALL, CONST_CS 
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_REPORT_OFF, 0, CONST_CS | 
CONST_PERSISTENT);
 

-- 
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

2006-03-29 Thread Antony Dovgal
tony2001Wed Mar 29 16:30:54 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix typo
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.84r2=1.85diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.84 php-src/ext/mysqli/mysqli.c:1.85
--- php-src/ext/mysqli/mysqli.c:1.84Wed Mar 29 15:08:52 2006
+++ php-src/ext/mysqli/mysqli.c Wed Mar 29 16:30:54 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.84 2006/03/29 15:08:52 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.85 2006/03/29 16:30:54 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -358,7 +358,7 @@
zend_hash_find(classes, mysqli_base_class-name.s, 
mysqli_base_class-name_length + 1, 
(void **) intern-prop_handler);
 
-   zend_object_std_init(intern-std, class_type TSRMLS_CC);
+   zend_object_std_init(intern-zo, class_type TSRMLS_CC);
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 

-- 
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

2006-03-05 Thread Johannes Schl
johannesSun Mar  5 15:49:55 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Fix build after unicode changes
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.80r2=1.81diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.80 php-src/ext/mysqli/mysqli.c:1.81
--- php-src/ext/mysqli/mysqli.c:1.80Wed Mar  1 18:37:25 2006
+++ php-src/ext/mysqli/mysqli.c Sun Mar  5 15:49:55 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.80 2006/03/01 18:37:25 iliaa Exp $ 
+  $Id: mysqli.c,v 1.81 2006/03/05 15:49:55 johannes Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -215,7 +215,7 @@
if (ret == SUCCESS) {
 
/* check if mysqli object is still valid */
-   if (!strcmp(obj-zo.ce-name, mysqli)) {
+   if (!strcmp(obj-zo.ce-name.s, mysqli)) {
if (!obj-ptr ||
!((MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-mysql)-thread_id) {
retval = EG(uninitialized_zval_ptr);
@@ -223,7 +223,7 @@
}
} else
/* check if stmt object is still valid */
-   if (!strcmp(obj-zo.ce-name, mysqli_stmt)) {
+   if (!strcmp(obj-zo.ce-name.s, mysqli_stmt)) {
if (!obj-ptr ||
!((MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-stmt)-mysql) {
retval = EG(uninitialized_zval_ptr);
@@ -356,7 +356,7 @@
{
mysqli_base_class = mysqli_base_class-parent;
}
-   zend_hash_find(classes, mysqli_base_class-name, 
mysqli_base_class-name_length + 1, 
+   zend_hash_find(classes, mysqli_base_class-name.s, 
mysqli_base_class-name_length + 1, 
(void **) intern-prop_handler);
 
ALLOC_HASHTABLE(intern-zo.properties);
@@ -460,33 +460,33 @@
ce = mysqli_driver_class_entry;
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, ce-name_length+1, 
mysqli_driver_properties, sizeof(mysqli_driver_properties), NULL);
+   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;
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli, mysqli_link_class_entry, 
mysqli_link_methods);
ce = mysqli_link_class_entry;
zend_hash_init(mysqli_link_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_link_properties, 
mysqli_link_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_link_properties, sizeof(mysqli_link_properties), NULL);
 
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;
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, ce-name_length+1, 
mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_warning_properties, sizeof(mysqli_warning_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_result, mysqli_result_class_entry, 
mysqli_result_methods);
ce = mysqli_result_class_entry;
zend_hash_init(mysqli_result_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_result_properties, 
mysqli_result_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_result_properties, sizeof(mysqli_result_properties), NULL);
 
REGISTER_MYSQLI_CLASS_ENTRY(mysqli_stmt, mysqli_stmt_class_entry, 
mysqli_stmt_methods);
ce = mysqli_stmt_class_entry;
zend_hash_init(mysqli_stmt_properties, 0, NULL, NULL, 1);
MYSQLI_ADD_PROPERTIES(mysqli_stmt_properties, 
mysqli_stmt_property_entries);
-   zend_hash_add(classes, ce-name, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);
+   zend_hash_add(classes, ce-name.s, ce-name_length+1, 
mysqli_stmt_properties, sizeof(mysqli_stmt_properties), NULL);

/* mysqli_options */
REGISTER_LONG_CONSTANT(MYSQLI_READ_DEFAULT_GROUP, 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c php_mysqli.h

2006-03-05 Thread Marcus Boerger
helly   Sun Mar  5 17:27:45 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c php_mysqli.h 
  Log:
  - Fix build
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.81r2=1.82diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.81 php-src/ext/mysqli/mysqli.c:1.82
--- php-src/ext/mysqli/mysqli.c:1.81Sun Mar  5 15:49:55 2006
+++ php-src/ext/mysqli/mysqli.c Sun Mar  5 17:27:45 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.81 2006/03/05 15:49:55 johannes Exp $ 
+  $Id: mysqli.c,v 1.82 2006/03/05 17:27:45 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -327,7 +327,7 @@
} else if (obj-zo.ce == mysqli_driver_class_entry) {
f.handler = ZEND_FN(mysqli_driver_construct);
} else if (obj-zo.ce == mysqli_warning_class_entry) {
-   f.handler = ZEND_FN(mysqli_warning___construct);
+   f.handler = ZEND_MN(mysqli_warning___construct);
}

return (union _zend_function*)f;
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/php_mysqli.h?r1=1.58r2=1.59diff_format=u
Index: php-src/ext/mysqli/php_mysqli.h
diff -u php-src/ext/mysqli/php_mysqli.h:1.58 
php-src/ext/mysqli/php_mysqli.h:1.59
--- php-src/ext/mysqli/php_mysqli.h:1.58Sun Jan  1 13:09:52 2006
+++ php-src/ext/mysqli/php_mysqli.h Sun Mar  5 17:27:45 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: php_mysqli.h,v 1.58 2006/01/01 13:09:52 sniper Exp $ 
+  $Id: php_mysqli.h,v 1.59 2006/03/05 17:27:45 helly Exp $ 
 */
 
 /* A little hack to prevent build break, when mysql is used together with
@@ -411,7 +411,7 @@
 ZEND_FUNCTION(mysqli_stmt_construct);
 ZEND_FUNCTION(mysqli_result_construct);
 ZEND_FUNCTION(mysqli_driver_construct);
-ZEND_METHOD(mysqli_warning,__construct);
+PHP_METHOD(mysqli_warning, __construct);
 
 ZEND_BEGIN_MODULE_GLOBALS(mysqli)
longdefault_link;

-- 
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

2006-03-01 Thread Ilia Alshanetsky
iliaa   Wed Mar  1 18:37:25 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  MFB51: Remove no longer needed check (checked at a higher level now).
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.79r2=1.80diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.79 php-src/ext/mysqli/mysqli.c:1.80
--- php-src/ext/mysqli/mysqli.c:1.79Thu Feb 16 16:05:02 2006
+++ php-src/ext/mysqli/mysqli.c Wed Mar  1 18:37:25 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.79 2006/02/16 16:05:02 iliaa Exp $ 
+  $Id: mysqli.c,v 1.80 2006/03/01 18:37:25 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -200,11 +200,6 @@
 
ret = FAILURE;
obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
-   /* object was already destroyed */
-   if (!obj-ptr) {
-   retval = EG(uninitialized_zval_ptr);
-   return(retval);
-   }
 
if (member-type != IS_STRING) {
tmp_member = *member;

-- 
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

2006-02-16 Thread Ilia Alshanetsky
iliaa   Thu Feb 16 16:05:02 2006 UTC

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  MFB51: Fixed bug #36420 (segfault when access result-num_rows after calling 
  result-close())
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/mysqli/mysqli.c?r1=1.78r2=1.79diff_format=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.78 php-src/ext/mysqli/mysqli.c:1.79
--- php-src/ext/mysqli/mysqli.c:1.78Sun Jan  1 13:09:52 2006
+++ php-src/ext/mysqli/mysqli.c Thu Feb 16 16:05:02 2006
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.78 2006/01/01 13:09:52 sniper Exp $ 
+  $Id: mysqli.c,v 1.79 2006/02/16 16:05:02 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -200,6 +200,11 @@
 
ret = FAILURE;
obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
+   /* object was already destroyed */
+   if (!obj-ptr) {
+   retval = EG(uninitialized_zval_ptr);
+   return(retval);
+   }
 
if (member-type != IS_STRING) {
tmp_member = *member;

-- 
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_warning.c

2005-10-12 Thread Antony Dovgal
tony2001Wed Oct 12 09:33:33 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c mysqli_warning.c 
  Log:
  MF51: fix TS build
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.75r2=1.76ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.75 php-src/ext/mysqli/mysqli.c:1.76
--- php-src/ext/mysqli/mysqli.c:1.75Mon Oct 10 16:14:31 2005
+++ php-src/ext/mysqli/mysqli.c Wed Oct 12 09:33:33 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.75 2005/10/10 20:14:31 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.76 2005/10/12 13:33:33 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -663,7 +663,7 @@
switch (ZEND_NUM_ARGS())
{
case 1:  /* mysql_stmt_init */
-   if (zend_parse_parameters(1, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
+   if (zend_parse_parameters(1 TSRMLS_CC, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
@@ -673,7 +673,7 @@
stmt-stmt = mysql_stmt_init(mysql-mysql);
break;
case 2:
-   if (zend_parse_parameters(2, Os, mysql_link, 
mysqli_link_class_entry, statement, stmt_len)==FAILURE) {
+   if (zend_parse_parameters(2 TSRMLS_CC, Os, mysql_link, 
mysqli_link_class_entry, statement, stmt_len)==FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
@@ -717,12 +717,12 @@
 
switch (ZEND_NUM_ARGS()) {
case 1:
-   if (zend_parse_parameters(1, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
+   if (zend_parse_parameters(1 TSRMLS_CC, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
return;
}
break;
case 2:
-   if (zend_parse_parameters(2, Ol, mysql_link, 
mysqli_link_class_entry, resmode)==FAILURE) {
+   if (zend_parse_parameters(2 TSRMLS_CC, Ol, mysql_link, 
mysqli_link_class_entry, resmode)==FAILURE) {
return;
}
break;
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_warning.c?r1=1.7r2=1.8ty=u
Index: php-src/ext/mysqli/mysqli_warning.c
diff -u php-src/ext/mysqli/mysqli_warning.c:1.7 
php-src/ext/mysqli/mysqli_warning.c:1.8
--- php-src/ext/mysqli/mysqli_warning.c:1.7 Mon Oct 10 16:14:31 2005
+++ php-src/ext/mysqli/mysqli_warning.c Wed Oct 12 09:33:33 2005
@@ -175,7 +175,7 @@
if (ZEND_NUM_ARGS() != 1) {
WRONG_PARAM_COUNT;
}
-   if (zend_parse_parameters(1, o, z)==FAILURE) {
+   if (zend_parse_parameters(1 TSRMLS_CC, o, z)==FAILURE) {
return;
}
obj = (mysqli_object *)zend_object_store_get_object(z TSRMLS_CC);\

-- 
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_warning.c

2005-10-10 Thread Antony Dovgal
tony2001Mon Oct 10 16:14:33 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c mysqli_warning.c 
  Log:
  MF51: fix #34818
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.74r2=1.75ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.74 php-src/ext/mysqli/mysqli.c:1.75
--- php-src/ext/mysqli/mysqli.c:1.74Tue Sep 13 05:19:58 2005
+++ php-src/ext/mysqli/mysqli.c Mon Oct 10 16:14:31 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.74 2005/09/13 09:19:58 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.75 2005/10/10 20:14:31 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -654,33 +654,34 @@
 ZEND_FUNCTION(mysqli_stmt_construct)
 {
MY_MYSQL*mysql;
-   zval**mysql_link, **statement;
+   zval*mysql_link;
MY_STMT *stmt;
MYSQLI_RESOURCE *mysqli_resource;
+   char*statement;
+   int stmt_len;
 
switch (ZEND_NUM_ARGS())
{
case 1:  /* mysql_stmt_init */
-   if (zend_get_parameters_ex(1, mysql_link)==FAILURE) {
+   if (zend_parse_parameters(1, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
return;
}
-   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
 
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
 
stmt-stmt = mysql_stmt_init(mysql-mysql);
break;
case 2:
-   if (zend_get_parameters_ex(2, mysql_link, 
statement)==FAILURE) {
+   if (zend_parse_parameters(2, Os, mysql_link, 
mysqli_link_class_entry, statement, stmt_len)==FAILURE) {
return;
}
-   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
-   convert_to_string_ex(statement);
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
 
stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));

if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
-   mysql_stmt_prepare(stmt-stmt, 
Z_STRVAL_PP(statement), strlen(Z_STRVAL_PP(statement)));
+   mysql_stmt_prepare(stmt-stmt, statement, 
stmt_len);
}
break;
default:
@@ -710,27 +711,26 @@
 {
MY_MYSQL*mysql;
MYSQL_RES   *result;
-   zval**mysql_link, **mode;
+   zval*mysql_link;
MYSQLI_RESOURCE *mysqli_resource;
-   int resmode = MYSQLI_STORE_RESULT;
+   longresmode = MYSQLI_STORE_RESULT;
 
switch (ZEND_NUM_ARGS()) {
case 1:
-   if (zend_get_parameters_ex(1, mysql_link)==FAILURE) {
+   if (zend_parse_parameters(1, O, mysql_link, 
mysqli_link_class_entry)==FAILURE) {
return;
}
break;
case 2:
-   if (zend_get_parameters_ex(2, mysql_link, mode)==FAILURE) {
+   if (zend_parse_parameters(2, Ol, mysql_link, 
mysqli_link_class_entry, resmode)==FAILURE) {
return;
}
-   resmode = Z_LVAL_PP(mode);
break;
default:
WRONG_PARAM_COUNT;
}
 
-   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, mysqli_link);
 
result = (resmode == MYSQLI_STORE_RESULT) ? 
mysql_store_result(mysql-mysql) :

mysql_use_result(mysql-mysql);
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_warning.c?r1=1.6r2=1.7ty=u
Index: php-src/ext/mysqli/mysqli_warning.c
diff -u php-src/ext/mysqli/mysqli_warning.c:1.6 
php-src/ext/mysqli/mysqli_warning.c:1.7
--- php-src/ext/mysqli/mysqli_warning.c:1.6 Mon Oct 10 08:59:47 2005
+++ php-src/ext/mysqli/mysqli_warning.c Mon Oct 10 16:14:31 2005
@@ -166,7 +166,7 @@
 /* {{{ mysqli_warning_construct(object obj) */
 PHP_METHOD(mysqli_warning, __construct)
 {
-   zval**z;
+   zval*z;
mysqli_object   *obj;

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c

2005-09-13 Thread Antony Dovgal
tony2001Tue Sep 13 05:20:01 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix #34450 (Segfault when calling mysqli_close() in destructor)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.73r2=1.74ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.73 php-src/ext/mysqli/mysqli.c:1.74
--- php-src/ext/mysqli/mysqli.c:1.73Fri Aug 12 10:08:23 2005
+++ php-src/ext/mysqli/mysqli.c Tue Sep 13 05:19:58 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.73 2005/08/12 14:08:23 sebastian Exp $ 
+  $Id: mysqli.c,v 1.74 2005/09/13 09:19:58 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -133,9 +133,11 @@
 static void mysqli_objects_destroy_object(void *object, zend_object_handle 
handle TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
-   MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
+   MYSQLI_RESOURCE *my_res;
 
zend_objects_destroy_object(object, handle TSRMLS_CC);
+   
+   my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
/* link object */
if (instanceof_function(intern-zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {

-- 
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

2005-06-27 Thread Antony Dovgal
tony2001Mon Jun 27 13:40:38 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix #33491 (crash after extending MySQLi internal class)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.70r2=1.71ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.70 php-src/ext/mysqli/mysqli.c:1.71
--- php-src/ext/mysqli/mysqli.c:1.70Wed Jun 22 05:12:43 2005
+++ php-src/ext/mysqli/mysqli.c Mon Jun 27 13:40:37 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.70 2005/06/22 09:12:43 georg Exp $ 
+  $Id: mysqli.c,v 1.71 2005/06/27 17:40:37 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -123,10 +123,19 @@
 static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
 {
mysqli_object   *intern = (mysqli_object *)object;
+   
+   zend_objects_free_object_storage((intern-zo) TSRMLS_CC);
+}
+/* }}} */
+
+/* {{{ mysqli_objects_destroy_object
+ */
+static void mysqli_objects_destroy_object(void *object, zend_object_handle 
handle TSRMLS_DC)
+{
+   mysqli_object   *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern-ptr;
 
-   zend_hash_destroy(intern-zo.properties);
-   FREE_HASHTABLE(intern-zo.properties);
+   zend_objects_destroy_object(object, handle TSRMLS_CC);
 
/* link object */
if (instanceof_function(intern-zo.ce, mysqli_link_class_entry 
TSRMLS_CC)) {
@@ -155,8 +164,8 @@
php_clear_warnings((MYSQLI_WARNING *)my_res-info);
}
}
+   intern-ptr = NULL;
my_efree(my_res);
-   efree(object);
 }
 /* }}} */
 
@@ -354,7 +363,7 @@
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 
-   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) mysqli_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
retval.handlers = mysqli_object_handlers;
 
return retval;

-- 
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_warning.c php_mysqli.h

2005-06-22 Thread Georg Richter
georg   Wed Jun 22 05:12:45 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_warning.c mysqli.c php_mysqli.h 
  Log:
  changed/fixed mysqli_warning class
  added prefetch support for cursors
  
  http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_warning.c?r1=1.3r2=1.4ty=u
Index: php-src/ext/mysqli/mysqli_warning.c
diff -u php-src/ext/mysqli/mysqli_warning.c:1.3 
php-src/ext/mysqli/mysqli_warning.c:1.4
--- php-src/ext/mysqli/mysqli_warning.c:1.3 Thu Apr 28 19:49:04 2005
+++ php-src/ext/mysqli/mysqli_warning.c Wed Jun 22 05:12:43 2005
@@ -30,88 +30,81 @@
 /* {{{ void php_clear_warnings() */
 void php_clear_warnings(MYSQLI_WARNING *w)
 {
-   if (w-result) {
-   mysql_free_result(w-result);
-   }
-   efree(w);
+   MYSQLI_WARNING  *n;
+
+   while (w) {
+   n = w;
+   efree(w-reason);
+   w = w-next;
+   efree(n);
+   } 
 }
 /* }}} */
 
-/* {{{ void php_get_warnings(MYSQL *mysql) */
-MYSQLI_WARNING *php_get_warnings(MYSQL *mysql)
+/* {{{ MYSQLI_WARNING *php_new_warning */
+MYSQLI_WARNING *php_new_warning(char *reason, char *sqlstate, int errorno)
 {
-   MYSQLI_WARNING *w;
-   int cwarnings;
+   MYSQLI_WARNING  *w;
 
-   if (!(cwarnings = mysql_warning_count(mysql))) {
-   return NULL;
-   }
+   w = (MYSQLI_WARNING *)ecalloc(1, sizeof(MYSQLI_WARNING));
 
-   if (mysql_query(mysql, SHOW WARNINGS)) {
-   return NULL;
-   }
-
-   w = (MYSQLI_WARNING *)ecalloc(sizeof(MYSQLI_WARNING), 1);
-
-   w-warning_count = cwarnings;
-   w-result = mysql_store_result(mysql);
-   if (!(w-row = mysql_fetch_row(w-result))) {
-   mysql_free_result(w-result);
-   efree(w);
-   return NULL;
+   w-reason = safe_estrdup(reason);
+   if (sqlstate) {
+   strcpy(w-sqlstate, sqlstate);
+   } else {
+   strcpy(w-sqlstate, 0);
}
+   w-errorno = errorno;
 
return w;
 }
 /* }}} */
 
-/* {{{ mysqli_warning::__construct */
-ZEND_FUNCTION(mysqli_warning_construct)
+/* {{{ MYSQLI_WARNING *php_get_warnings(MYSQL *mysql) */
+MYSQLI_WARNING *php_get_warnings(MYSQL *mysql)
 {
-   MYSQL   *mysql = NULL;
-   MYSQLI_WARNING  *w;
-   MYSQLI_RESOURCE *mysqli_resource;
-   mysqli_object   *obj;
+   MYSQLI_WARNING  *w, *first = NULL, *prev = NULL;
+   MYSQL_RES   *result;
+   MYSQL_ROW   row;
 
-   if (!getThis()) {
-   RETURN_FALSE;
-   } 
-
-   obj = (mysqli_object *)zend_objects_get_address(getThis() TSRMLS_CC);
-
-   if (obj-zo.ce == mysqli_link_class_entry) {
-   mysql = (MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-mysql;
-   } else if (obj-zo.ce == mysqli_stmt_class_entry) {
-   mysql = (MYSQL *)((MY_STMT *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-stmt-mysql;
+   if (mysql_query(mysql, SHOW WARNINGS)) {
+   return NULL;
}
 
-   if ((w = php_get_warnings(mysql))) {
-   mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
-   mysqli_resource-ptr = (void *)w;
-   obj-valid = 1;
-
-   MYSQLI_RETURN_RESOURCE(mysqli_resource, 
mysqli_warning_class_entry);
-   } else {
-   RETURN_FALSE;
+   result = mysql_store_result(mysql);
+   while ((row = mysql_fetch_row(result))) {
+   w = php_new_warning(row[2], HY000, atoi(row[1]));
+   if (!first) {
+   first = w;
+   }
+   if (prev) {
+   prev-next = (void *)w;
+   }
+   prev = w;
}
+   mysql_free_result(result);
+   return first;
 }
 /* }}} */
 
-/* {{{ bool mysqli_warning::next */
-ZEND_FUNCTION(mysqli_warning_next) {
+/* {{{ bool mysqli_warning::next() */
+PHP_METHOD(mysqli_warning, next) 
+{
MYSQLI_WARNING  *w;
-   zval*mysql_warning;
+   zval*mysqli_warning;
mysqli_object *obj = (mysqli_object 
*)zend_objects_get_address(getThis() TSRMLS_CC);
 
-   if (obj-valid) {
+   if (obj-ptr) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), O, 
-   
 mysql_warning, mysqli_warning_class_entry) == FAILURE) {
+   
 mysqli_warning, mysqli_warning_class_entry) == FAILURE) {
return;
}
 
-   MYSQLI_FETCH_RESOURCE(w, MYSQLI_WARNING *, mysql_warning, 
mysqli_warning);
+   MYSQLI_FETCH_RESOURCE(w, MYSQLI_WARNING *, mysqli_warning, 
mysqli_warning);
 
-   if (w-warning_count  (w-row = mysql_fetch_row(w-result))) {
+   

Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c mysqli_warning.c php_mysqli.h

2005-06-22 Thread Ilia Alshanetsky

Hi Georg,

After your change that eliminated 
ZEND_FUNCTION(mysqli_warning_construct), mysqli no longer compiles, 
since it tries to alias that function inside mysqli_fe.c


Ilia

--
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

2005-05-09 Thread Andrey Hristov
andrey  Mon May  9 18:29:22 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  mysqli won't compile with Zend2 API before 2001 - in these days there was
  no Zend2
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.68r2=1.69ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.68 php-src/ext/mysqli/mysqli.c:1.69
--- php-src/ext/mysqli/mysqli.c:1.68Thu May  5 09:02:31 2005
+++ php-src/ext/mysqli/mysqli.c Mon May  9 18:29:21 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.68 2005/05/05 13:02:31 georg Exp $ 
+  $Id: mysqli.c,v 1.69 2005/05/09 22:29:21 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -364,19 +364,15 @@
 /* {{{ mysqli_module_entry
  */
 zend_module_entry mysqli_module_entry = {
-#if ZEND_MODULE_API_NO = 20010901
STANDARD_MODULE_HEADER,
-#endif
mysqli,
mysqli_functions,
PHP_MINIT(mysqli),
PHP_MSHUTDOWN(mysqli),
-   PHP_RINIT(mysqli),  /* Replace with NULL if there's nothing 
to do at request start */
-   PHP_RSHUTDOWN(mysqli),  /* Replace with NULL if there's nothing to do 
at request end */
+   PHP_RINIT(mysqli),
+   PHP_RSHUTDOWN(mysqli),
PHP_MINFO(mysqli),
-#if ZEND_MODULE_API_NO = 20010901
0.1, /* Replace with version number for your extension */
-#endif
STANDARD_MODULE_PROPERTIES
 };
 /* }}} */

-- 
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 /ext/mysqli/tests 064.phpt

2005-05-05 Thread Georg Richter
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

2005-04-29 Thread Andrey Hristov
andrey  Fri Apr 29 06:23:55 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  multi_query is no more global
  #thanks Sebastian!
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.66r2=1.67ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.66 php-src/ext/mysqli/mysqli.c:1.67
--- php-src/ext/mysqli/mysqli.c:1.66Wed Apr 20 09:03:01 2005
+++ php-src/ext/mysqli/mysqli.c Fri Apr 29 06:23:55 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.66 2005/04/20 13:03:01 georg Exp $ 
+  $Id: mysqli.c,v 1.67 2005/04/29 10:23:55 andrey Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -408,7 +408,6 @@
mysqli_globals-reconnect = 0;
mysqli_globals-report_mode = 0;
mysqli_globals-report_ht = 0;
-   mysqli_globals-multi_query = 0;
 #ifdef HAVE_EMBEDDED_MYSQLI
mysqli_globals-embedded = 1;
 #else

-- 
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

2005-04-20 Thread Georg Richter
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 /ext/mysqli/tests 009.phpt

2005-04-20 Thread Georg Richter
georg   Wed Apr 20 09:03:01 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
/php-src/ext/mysqli/tests   009.phpt 
  Log:
  fixed typo in last commit :(
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.65r2=1.66ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.65 php-src/ext/mysqli/mysqli.c:1.66
--- php-src/ext/mysqli/mysqli.c:1.65Wed Apr 20 08:50:13 2005
+++ php-src/ext/mysqli/mysqli.c Wed Apr 20 09:03:01 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.65 2005/04/20 12:50:13 georg Exp $ 
+  $Id: mysqli.c,v 1.66 2005/04/20 13:03:01 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -563,8 +563,8 @@

/* 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);
+#ifdef MYSQL_DATA_TRUNCATED
+   REGISTER_LONG_CONSTANT(MYSQLI_DATA_TRUNCATED, MYSQL_DATA_TRUNCATED, 
CONST_CS | CONST_PERSISTENT);
 #endif
 
/* reporting */
http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/009.phpt?r1=1.4r2=1.5ty=u
Index: php-src/ext/mysqli/tests/009.phpt
diff -u php-src/ext/mysqli/tests/009.phpt:1.4 
php-src/ext/mysqli/tests/009.phpt:1.5
--- php-src/ext/mysqli/tests/009.phpt:1.4   Sat Dec  4 03:50:33 2004
+++ php-src/ext/mysqli/tests/009.phpt   Wed Apr 20 09:03:01 2005
@@ -25,7 +25,7 @@
$stmt = mysqli_prepare($link, SELECT * FROM test_bind_fetch);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
-   mysqli_fetch($stmt);
+   $rc = mysqli_fetch($stmt);
 
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
 

-- 
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

2005-04-18 Thread Georg Richter
georg   Mon Apr 18 02:03:32 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  cursor support for 5.0.4 (STMT_ATTR_CURSOR_TYPE changed to enum)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.63r2=1.64ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.63 php-src/ext/mysqli/mysqli.c:1.64
--- php-src/ext/mysqli/mysqli.c:1.63Wed Apr  6 02:47:12 2005
+++ php-src/ext/mysqli/mysqli.c Mon Apr 18 02:03:29 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.63 2005/04/06 06:47:12 georg Exp $ 
+  $Id: mysqli.c,v 1.64 2005/04/18 06:03:29 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -506,7 +506,7 @@
/* for mysqli_stmt_set_attr */
REGISTER_LONG_CONSTANT(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 
STMT_ATTR_UPDATE_MAX_LENGTH, CONST_CS | CONST_PERSISTENT);
 
-#ifdef STMT_ATTR_CURSOR_TYPE
+#if MYSQL_VERSION_ID  50003
REGISTER_LONG_CONSTANT(MYSQLI_STMT_ATTR_CURSOR_TYPE, 
STMT_ATTR_CURSOR_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_CURSOR_TYPE_NO_CURSOR, 
CURSOR_TYPE_NO_CURSOR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_CURSOR_TYPE_READ_ONLY, 
CURSOR_TYPE_READ_ONLY, CONST_CS | CONST_PERSISTENT);

-- 
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

2005-04-06 Thread Georg Richter
georg   Wed Apr  6 02:47:13 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix for bug #32282 (segfault in mysqli_fetch_array on 64-bit)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.62r2=1.63ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.62 php-src/ext/mysqli/mysqli.c:1.63
--- php-src/ext/mysqli/mysqli.c:1.62Sun Mar  6 16:40:01 2005
+++ php-src/ext/mysqli/mysqli.c Wed Apr  6 02:47:12 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.62 2005/03/06 21:40:01 helly Exp $ 
+  $Id: mysqli.c,v 1.63 2005/04/06 06:47:12 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -737,7 +737,7 @@
 {
MYSQL_RES   *result;
zval*mysql_result;
-   int fetchtype;
+   longfetchtype;
unsigned inti;
MYSQL_FIELD *fields;
MYSQL_ROW   row;

-- 
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

2005-03-06 Thread Marcus Boerger
helly   Sun Mar  6 16:40:01 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Bugfix #28840 __destruct of a class that extends mysqli not called
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.61r2=1.62ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.61 php-src/ext/mysqli/mysqli.c:1.62
--- php-src/ext/mysqli/mysqli.c:1.61Thu Jan 27 09:41:48 2005
+++ php-src/ext/mysqli/mysqli.c Sun Mar  6 16:40:01 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.61 2005/01/27 14:41:48 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.62 2005/03/06 21:40:01 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -349,7 +349,7 @@
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 
-   retval.handle = zend_objects_store_put(intern, NULL, 
mysqli_objects_free_storage, NULL TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, 
(zend_objects_store_dtor_t) zend_objects_destroy_object, 
(zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL 
TSRMLS_CC);
retval.handlers = mysqli_object_handlers;
 
return retval;

-- 
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

2005-01-27 Thread Antony Dovgal
tony2001Thu Jan 27 09:41:48 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  MFB: fix leak in mysqli_fetch_array()
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.60r2=1.61ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.60 php-src/ext/mysqli/mysqli.c:1.61
--- php-src/ext/mysqli/mysqli.c:1.60Sat Jan  8 08:34:03 2005
+++ php-src/ext/mysqli/mysqli.c Thu Jan 27 09:41:48 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.60 2005/01/08 13:34:03 helly Exp $ 
+  $Id: mysqli.c,v 1.61 2005/01/27 14:41:48 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -777,6 +777,11 @@
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, 
mysqli_result); 
 
+   if ((fetchtype  MYSQLI_BOTH) == 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The result type 
should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH);
+   RETURN_FALSE;
+   }
+
if (!(row = mysql_fetch_row(result))) {
RETURN_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

2005-01-08 Thread Marcus Boerger
helly   Sat Jan  8 08:34:05 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Remove double destroy (which is definitively wrong and prevents php from
normal execution).
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.59r2=1.60ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.59 php-src/ext/mysqli/mysqli.c:1.60
--- php-src/ext/mysqli/mysqli.c:1.59Fri Jan  7 11:34:55 2005
+++ php-src/ext/mysqli/mysqli.c Sat Jan  8 08:34:03 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.59 2005/01/07 16:34:55 georg Exp $ 
+  $Id: mysqli.c,v 1.60 2005/01/08 13:34:03 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -579,7 +579,6 @@
 PHP_MSHUTDOWN_FUNCTION(mysqli)
 {
zend_hash_destroy(mysqli_driver_properties);
-   zend_hash_destroy(mysqli_driver_properties);
zend_hash_destroy(mysqli_result_properties);
zend_hash_destroy(mysqli_stmt_properties);
zend_hash_destroy(mysqli_warning_properties);

-- 
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

2005-01-07 Thread Georg Richter
georg   Fri Jan  7 11:34:55 2005 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  forgot to remove some comments in last commit:(
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.58r2=1.59ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.58 php-src/ext/mysqli/mysqli.c:1.59
--- php-src/ext/mysqli/mysqli.c:1.58Fri Jan  7 09:59:59 2005
+++ php-src/ext/mysqli/mysqli.c Fri Jan  7 11:34:55 2005
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.58 2005/01/07 14:59:59 georg Exp $ 
+  $Id: mysqli.c,v 1.59 2005/01/07 16:34:55 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -578,7 +578,8 @@
  */
 PHP_MSHUTDOWN_FUNCTION(mysqli)
 {
-// zend_hash_destroy(mysqli_driver_properties);
+   zend_hash_destroy(mysqli_driver_properties);
+   zend_hash_destroy(mysqli_driver_properties);
zend_hash_destroy(mysqli_result_properties);
zend_hash_destroy(mysqli_stmt_properties);
zend_hash_destroy(mysqli_warning_properties);
@@ -750,7 +751,6 @@
int class_name_len;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), O|sz, mysql_result, mysqli_result_class_entry, class_name, 
class_name_len, ctor_params) == FAILURE) {
-   //  php_std_error_handling();
return;
}
if (ZEND_NUM_ARGS()  (getThis() ? 1 : 2)) {
@@ -766,14 +766,12 @@
} else {
if (override_flags) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS() 
TSRMLS_CC, getThis(), O, mysql_result, mysqli_result_class_entry) == 
FAILURE) {
-   //php_std_error_handling();
return;
}
fetchtype = override_flags;
} else {
fetchtype = MYSQLI_BOTH;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() 
TSRMLS_CC, getThis(), O|l, mysql_result, mysqli_result_class_entry, 
fetchtype) == FAILURE) {
-   //  php_std_error_handling();
return;
}
}

-- 
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

2005-01-07 Thread Derick Rethans
On Fri, 7 Jan 2005, Georg Richter wrote:

  PHP_MSHUTDOWN_FUNCTION(mysqli)
  {
 -//   zend_hash_destroy(mysqli_driver_properties);
 + zend_hash_destroy(mysqli_driver_properties);
 + zend_hash_destroy(mysqli_driver_properties);

Should it be there twice?

regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

-- 
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

2005-01-07 Thread Georg Richter
Am Sa, den 08.01.2005 schrieb Derick Rethans um 0:45:
 On Fri, 7 Jan 2005, Georg Richter wrote:
 
   PHP_MSHUTDOWN_FUNCTION(mysqli)
   {
  -// zend_hash_destroy(mysqli_driver_properties);
  +   zend_hash_destroy(mysqli_driver_properties);
  +   zend_hash_destroy(mysqli_driver_properties);

No, that is fixed already - but not checked in. 
Still waiting for Sebastian Bergmanns reply - I also fixed some Win32
compiler bugs. Will checkin later today.

/Georg

-- 
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 php_mysqli.h /ext/mysqli/tests 062.phpt 063.phpt

2004-12-26 Thread Georg Richter
georg   Sun Dec 26 08:16:40 2004 EDT

  Added files: 
/php-src/ext/mysqli/tests   062.phpt 063.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli.c php_mysqli.h 
  Log:
  added constructors for mysqli_stmt and mysqli_result classes
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.56r2=1.57ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.56 php-src/ext/mysqli/mysqli.c:1.57
--- php-src/ext/mysqli/mysqli.c:1.56Sat Dec 25 11:42:53 2004
+++ php-src/ext/mysqli/mysqli.c Sun Dec 26 08:16:38 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.56 2004/12/25 16:42:53 georg Exp $ 
+  $Id: mysqli.c,v 1.57 2004/12/26 13:16:38 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -281,23 +281,31 @@
 {
mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object 
TSRMLS_CC);
 
-   if (obj-zo.ce != mysqli_link_class_entry) {
+   if (obj-zo.ce != mysqli_link_class_entry  obj-zo.ce != 
mysqli_stmt_class_entry 
+   obj-zo.ce != mysqli_result_class_entry) {
return obj-zo.ce-constructor;
} else {
static zend_internal_function f;
 
-   f.function_name = mysqli_link_class_entry-name;
-   f.scope = mysqli_link_class_entry;
+   f.function_name = obj-zo.ce-name;
+   f.scope = obj-zo.ce;
f.arg_info = NULL;
f.num_args = 0;
f.fn_flags = 0;
 
f.type = ZEND_INTERNAL_FUNCTION;
-   f.handler = ZEND_FN(mysqli_connect);
+   if (obj-zo.ce == mysqli_link_class_entry) {
+   f.handler = ZEND_FN(mysqli_connect);
+   } 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) {
+   f.handler = ZEND_FN(mysqli_result_construct);
+   }

return (union _zend_function*)f;
}
 }
+
 /* {{{ mysqli_objects_new
  */
 PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry 
*class_type TSRMLS_DC)
@@ -578,6 +586,109 @@
 }
 /* }}} */
 
+/* {{{ mixed mysqli_stmt_construct() 
+constructor for statement object.
+Parameters: 
+  object - mysqli_init
+  object, query - mysqli_prepare
+*/
+ZEND_FUNCTION(mysqli_stmt_construct)
+{
+   MY_MYSQL*mysql;
+   zval**mysql_link, **statement;
+   MY_STMT *stmt;
+   MYSQLI_RESOURCE *mysqli_resource;
+
+   switch (ZEND_NUM_ARGS())
+   {
+   case 1:  /* mysql_stmt_init */
+   if (zend_get_parameters_ex(1, mysql_link)==FAILURE) {
+   return;
+   }
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
+
+   stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
+
+   stmt-stmt = mysql_stmt_init(mysql-mysql);
+   break;
+   case 2:
+   if (zend_get_parameters_ex(2, mysql_link, 
statement)==FAILURE) {
+   return;
+   }
+   MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, mysql_link, 
mysqli_link);
+   convert_to_string_ex(statement);
+
+   stmt = (MY_STMT *)ecalloc(1,sizeof(MY_STMT));
+   
+   if ((stmt-stmt = mysql_stmt_init(mysql-mysql))) {
+   mysql_stmt_prepare(stmt-stmt, 
Z_STRVAL_PP(statement), strlen(Z_STRVAL_PP(statement)));
+   }
+   break;
+   default:
+   WRONG_PARAM_COUNT;
+   break;
+   }
+
+   if (!stmt-stmt) {
+   efree(stmt);
+   RETURN_FALSE;
+   }
+
+   mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, 
sizeof(MYSQLI_RESOURCE));
+   mysqli_resource-ptr = (void *)stmt;
+   
+   ((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-ptr = mysqli_resource;
+   ((mysqli_object *) zend_object_store_get_object(getThis() 
TSRMLS_CC))-valid = 1;
+}
+/* }}} */
+
+/* {{{ mixed mysqli_result_construct() 
+constructor for result object.
+Parameters: 
+  object [, mode] - mysqli_store/use_result
+*/
+ZEND_FUNCTION(mysqli_result_construct)
+{
+   MY_MYSQL*mysql;
+   MYSQL_RES   *result;
+   zval**mysql_link, **mode;
+   MYSQLI_RESOURCE *mysqli_resource;
+   int resmode = MYSQLI_STORE_RESULT;
+
+   switch (ZEND_NUM_ARGS()) {
+   case 

[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c /ext/mysqli/tests bug31141.phpt

2004-12-25 Thread Georg Richter
georg   Sat Dec 25 11:42:53 2004 EDT

  Added files: 
/php-src/ext/mysqli/tests   bug31141.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix for bug 31141
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.55r2=1.56ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.55 php-src/ext/mysqli/mysqli.c:1.56
--- php-src/ext/mysqli/mysqli.c:1.55Thu Dec  9 03:22:06 2004
+++ php-src/ext/mysqli/mysqli.c Sat Dec 25 11:42:53 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.55 2004/12/09 08:22:06 tony2001 Exp $ 
+  $Id: mysqli.c,v 1.56 2004/12/25 16:42:53 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -218,7 +218,6 @@
} else {
std_hnd = zend_get_std_object_handlers();
retval = std_hnd-read_property(object, member, type TSRMLS_CC);
-   retval-refcount = 1;
}
 
if (member == tmp_member) {
@@ -398,6 +397,8 @@
 PHP_MINIT_FUNCTION(mysqli)
 {
zend_class_entry *ce;
+   zend_object_handlers *std_hnd = zend_get_std_object_handlers();
+

ZEND_INIT_MODULE_GLOBALS(mysqli, php_mysqli_init_globals, NULL);
REGISTER_INI_ENTRIES();
@@ -406,7 +407,7 @@
mysqli_object_handlers.clone_obj = NULL;
mysqli_object_handlers.read_property = mysqli_read_property;
mysqli_object_handlers.write_property = mysqli_write_property;
-   mysqli_object_handlers.get_property_ptr_ptr = NULL;
+   mysqli_object_handlers.get_property_ptr_ptr = 
std_hnd-get_property_ptr_ptr;
mysqli_object_handlers.get_constructor = php_mysqli_constructor_get;
 
zend_hash_init(classes, 0, NULL, NULL, 1);

http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug31141.phpt?r=1.1p=1
Index: php-src/ext/mysqli/tests/bug31141.phpt
+++ php-src/ext/mysqli/tests/bug31141.phpt
--TEST--
Bug #31141 testcase (properties)
--SKIPIF--
?php require_once('skipif.inc'); ?
--FILE--
?php
class Test extends mysqli
{
public $test = array();

function foo()
{
$ar_test = array(foo, bar);
$this-test = $ar_test;
}
}

$my_test = new Test;
$my_test-foo();
var_dump($my_test-test);
?
--EXPECTF--
array(2) {
  [0]=
  string(3) foo
  [1]=
  string(3) bar
}

-- 
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

2004-12-09 Thread Antony Dovgal
tony2001Thu Dec  9 03:22:06 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fix buffer overrun and remove debug printf() call
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.54r2=1.55ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.54 php-src/ext/mysqli/mysqli.c:1.55
--- php-src/ext/mysqli/mysqli.c:1.54Sat Dec  4 03:16:03 2004
+++ php-src/ext/mysqli/mysqli.c Thu Dec  9 03:22:06 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.54 2004/12/04 08:16:03 georg Exp $ 
+  $Id: mysqli.c,v 1.55 2004/12/09 08:22:06 tony2001 Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -108,7 +108,6 @@
 /* {{{ php_clear_mysql */
 void php_clear_mysql(MY_MYSQL *mysql) {
if (mysql-li_read) {
-   printf(freeing...\n);
efree(Z_STRVAL_P(mysql-li_read));
FREE_ZVAL(mysql-li_read);
mysql-li_read = NULL;
@@ -920,12 +919,10 @@
data= (mysqli_local_infile *)ptr;
 
if (!(mysql = data-userdata)) {
-   efree(data);
return;
}
 
php_stream_close(mysql-li_stream);
-   //efree(data);
return; 
 }
 /* }}} */

-- 
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_prop.c /ext/mysqli/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt 008.phpt 009.phpt 010.phpt 011.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.phpt 017.phpt 018.phpt 019.phpt 020.phpt 021.phpt 022.phpt 023.phpt 024.phpt 025.phpt 026.phpt 027.phpt 028.phpt 029.phpt 030.phpt 031.phpt 032.phpt 033.phpt 034.phpt 035.phpt 036.phpt 037.phpt 038.phpt 039.phpt 040.phpt 041.phpt 042.phpt 043.phpt 044.phpt 045.phpt 046.phpt 047.phpt 048.phpt 049.phpt 050.phpt 051.phpt 052.phpt 053.phpt 054.phpt 055.phpt 056.phpt 057.phpt 058.phpt 059.phpt 060.phpt 061.phpt bug28817.phpt bug29311.phpt bug30967.phpt

2004-12-04 Thread Georg Richter
georg   Sat Dec  4 03:16:05 2004 EDT

  Added files: 
/php-src/ext/mysqli/tests   bug28817.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli.c mysqli_prop.c 
/php-src/ext/mysqli/tests   001.phpt 002.phpt 003.phpt 004.phpt 
005.phpt 006.phpt 007.phpt 008.phpt 
009.phpt 010.phpt 011.phpt 012.phpt 
013.phpt 014.phpt 015.phpt 016.phpt 
017.phpt 018.phpt 019.phpt 020.phpt 
021.phpt 022.phpt 023.phpt 024.phpt 
025.phpt 026.phpt 027.phpt 028.phpt 
029.phpt 030.phpt 031.phpt 032.phpt 
033.phpt 034.phpt 035.phpt 036.phpt 
037.phpt 038.phpt 039.phpt 040.phpt 
041.phpt 042.phpt 043.phpt 044.phpt 
045.phpt 046.phpt 047.phpt 048.phpt 
049.phpt 050.phpt 051.phpt 052.phpt 
053.phpt 054.phpt 055.phpt 056.phpt 
057.phpt 058.phpt 059.phpt 060.phpt 
061.phpt bug29311.phpt bug30967.phpt 
  Log:
  Fixed bug #30890 (testsuite)
  Fixed bug #28817 (property problems in extended class)
  
  http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.53r2=1.54ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.53 php-src/ext/mysqli/mysqli.c:1.54
--- php-src/ext/mysqli/mysqli.c:1.53Fri Dec  3 02:56:18 2004
+++ php-src/ext/mysqli/mysqli.c Sat Dec  4 03:16:03 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.53 2004/12/03 07:56:18 georg Exp $ 
+  $Id: mysqli.c,v 1.54 2004/12/04 08:16:03 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -179,11 +179,6 @@
ret = FAILURE;
obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
 
-   if (!obj-valid) {
-   retval = EG(uninitialized_zval_ptr);
-   return(retval);
-   }
-
if (member-type != IS_STRING) {
tmp_member = *member;
zval_copy_ctor(tmp_member);
@@ -194,6 +189,7 @@
if (obj-prop_handler != NULL) {
ret = zend_hash_find(obj-prop_handler, Z_STRVAL_P(member), 
Z_STRLEN_P(member)+1, (void **) hnd);
}
+
if (ret == SUCCESS) {
 
/* check if mysqli object is still valid */
@@ -223,6 +219,7 @@
} else {
std_hnd = zend_get_std_object_handlers();
retval = std_hnd-read_property(object, member, type TSRMLS_CC);
+   retval-refcount = 1;
}
 
if (member == tmp_member) {
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_prop.c?r1=1.15r2=1.16ty=u
Index: php-src/ext/mysqli/mysqli_prop.c
diff -u php-src/ext/mysqli/mysqli_prop.c:1.15 
php-src/ext/mysqli/mysqli_prop.c:1.16
--- php-src/ext/mysqli/mysqli_prop.c:1.15   Mon Jul 26 01:44:06 2004
+++ php-src/ext/mysqli/mysqli_prop.cSat Dec  4 03:16:04 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_prop.c,v 1.15 2004/07/26 05:44:06 georg Exp $ 
+  $Id: mysqli_prop.c,v 1.16 2004/12/04 08:16:04 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -29,6 +29,13 @@
 #include ext/standard/info.h
 #include php_mysqli.h
 
+#define CHECK_OBJECT() \
+   if (!obj-valid) { \
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Property access is 
not allowed yet. Call the default constructor of the object first); \
+   ZVAL_NULL(*retval); \
+   return SUCCESS; \
+   } \
+
 #define MYSQLI_GET_MYSQL() \
 MYSQL *p = (MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE *)(obj-ptr))-ptr)-mysql;
 
@@ -41,9 +48,10 @@
 #define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, 
__ret_type)\
 int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \
 {\
+   ALLOC_ZVAL(*retval); \
+   CHECK_OBJECT(); \
__ret_type l;\
__get_type;\
-   ALLOC_ZVAL(*retval);\
if (!p) {\
ZVAL_NULL(*retval);\
} else {\
@@ -63,8 +71,9 @@
 int __func(mysqli_object *obj, zval **retval TSRMLS_DC)\
 {\
char *c;\
+   ALLOC_ZVAL(*retval); \
+   CHECK_OBJECT(); \
__get_type;\
-   ALLOC_ZVAL(*retval);\
if (!p) {\
ZVAL_NULL(*retval);\
} else {\
@@ -95,18 +104,6 @@
return SUCCESS;
 }
 /* }}} */
-/* {{{ property link_test_read */
-int link_test_read(mysqli_object *obj, zval **retval TSRMLS_DC)
-{
-   longi;
-   ALLOC_ZVAL(*retval);
-   array_init(*retval);
-
-   for (i=0; i  10; 

Re: [PHP-CVS] cvs: php-src /ext/mysqli mysqli.c /ext/mysqli/tests bug30967.phpt

2004-12-04 Thread Georg Richter
Am Fr, den 03.12.2004 schrieb [EMAIL PROTECTED] um 9:31:
 Hi Georg,
 
 Would such a fix (in combination with the fix for #28430) also fix the problem
 described in #28817 (http://bugs.php.net/bug.php?id=28817)?
 
Bug #28817 is fixed in CVS now (mysqli part). I sent a patch to Rob for
ext/dom.

/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 /ext/mysqli/tests bug30967.phpt

2004-12-03 Thread D . Kingma
Hi Georg,

Would such a fix (in combination with the fix for #28430) also fix the problem
described in #28817 (http://bugs.php.net/bug.php?id=28817)?

Kind regards,

David

Quoting Georg Richter [EMAIL PROTECTED]:

 georg Fri Dec  3 02:56:19 2004 EDT
 
   Added files: 
 /php-src/ext/mysqli/tests bug30967.phpt 
 
   Modified files:  
 /php-src/ext/mysqli   mysqli.c 
   Log:
   Fixed bug #30967 (properties in extended mysqli classes don't work)
   
   
 http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.52r2=1.53ty=u
 Index: php-src/ext/mysqli/mysqli.c
 diff -u php-src/ext/mysqli/mysqli.c:1.52 php-src/ext/mysqli/mysqli.c:1.53
 --- php-src/ext/mysqli/mysqli.c:1.52  Wed Aug 25 09:57:35 2004
 +++ php-src/ext/mysqli/mysqli.c   Fri Dec  3 02:56:18 2004
 @@ -15,7 +15,7 @@
| Author: Georg Richter [EMAIL PROTECTED]
 |
+--+
  
 -  $Id: mysqli.c,v 1.52 2004/08/25 13:57:35 georg Exp $ 
 +  $Id: mysqli.c,v 1.53 2004/12/03 07:56:18 georg Exp $ 
  */
  
  #ifdef HAVE_CONFIG_H
 @@ -310,7 +310,7 @@
   zend_object_value retval;
   mysqli_object *intern;
   zval *tmp;
 - zend_class_entry *parent;
 + zend_class_entry *mysqli_base_class;
  
   intern = emalloc(sizeof(mysqli_object));
   memset(intern, 0, sizeof(mysqli_object));
 @@ -320,11 +320,14 @@
   intern-ptr = NULL;
   intern-valid = 0;
   intern-prop_handler = NULL;
 - if ((parent = class_type-parent))
 +
 + mysqli_base_class = class_type;
 + while (mysqli_base_class-type != ZEND_INTERNAL_CLASS 
 mysqli_base_class-parent != NULL)
   {
 - zend_hash_find(classes, parent-name, parent-name_length + 1, 
 (void **)
 intern-prop_handler);
 + mysqli_base_class = mysqli_base_class-parent;
   }
 - zend_hash_find(classes, class_type-name, class_type-name_length + 1,
 (void **) intern-prop_handler);
 + zend_hash_find(classes, mysqli_base_class-name,
 mysqli_base_class-name_length + 1, 
 + (void **) intern-prop_handler);
  
   ALLOC_HASHTABLE(intern-zo.properties);
   zend_hash_init(intern-zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
 
 http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug30967.phpt?r=1.1p=1
 Index: php-src/ext/mysqli/tests/bug30967.phpt
 +++ php-src/ext/mysqli/tests/bug30967.phpt
 --TEST--
 Bug #30967 testcase (properties)
 --FILE--
 ?php
   include connect.inc;
   
   class mysql1 extends mysqli {
   }
 
   class mysql2 extends mysql1 {
   }
 
   $mysql = new mysql2(localhost, root, , test);
 
   $mysql-query(THIS DOES NOT WORK);
   printf(%d\n, $mysql-errno);
 
   $mysql-close();
 ?
 --EXPECTF--
 1064
 
 -- 
 PHP CVS Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





This message was sent using IMP, the Internet Messaging Program.

-- 
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 /ext/mysqli/tests bug30967.phpt

2004-12-03 Thread Georg Richter
Am Fr, den 03.12.2004 schrieb [EMAIL PROTECTED] um 9:31:

Hi!

 Would such a fix (in combination with the fix for #28430) also fix the problem
 described in #28817 (http://bugs.php.net/bug.php?id=28817)?
 

No, sorry.
I have a fix already for that, but it works in HEAD only, not in 5_0
branch (for dom and mysqli). Will still need some time.

/Georg

-- 
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 /ext/mysqli/tests bug30967.phpt

2004-12-02 Thread Georg Richter
georg   Fri Dec  3 02:56:19 2004 EDT

  Added files: 
/php-src/ext/mysqli/tests   bug30967.phpt 

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Fixed bug #30967 (properties in extended mysqli classes don't work)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.52r2=1.53ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.52 php-src/ext/mysqli/mysqli.c:1.53
--- php-src/ext/mysqli/mysqli.c:1.52Wed Aug 25 09:57:35 2004
+++ php-src/ext/mysqli/mysqli.c Fri Dec  3 02:56:18 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.52 2004/08/25 13:57:35 georg Exp $ 
+  $Id: mysqli.c,v 1.53 2004/12/03 07:56:18 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -310,7 +310,7 @@
zend_object_value retval;
mysqli_object *intern;
zval *tmp;
-   zend_class_entry *parent;
+   zend_class_entry *mysqli_base_class;
 
intern = emalloc(sizeof(mysqli_object));
memset(intern, 0, sizeof(mysqli_object));
@@ -320,11 +320,14 @@
intern-ptr = NULL;
intern-valid = 0;
intern-prop_handler = NULL;
-   if ((parent = class_type-parent))
+
+   mysqli_base_class = class_type;
+   while (mysqli_base_class-type != ZEND_INTERNAL_CLASS  
mysqli_base_class-parent != NULL)
{
-   zend_hash_find(classes, parent-name, parent-name_length + 1, 
(void **) intern-prop_handler);
+   mysqli_base_class = mysqli_base_class-parent;
}
-   zend_hash_find(classes, class_type-name, class_type-name_length + 1, 
(void **) intern-prop_handler);
+   zend_hash_find(classes, mysqli_base_class-name, 
mysqli_base_class-name_length + 1, 
+   (void **) intern-prop_handler);
 
ALLOC_HASHTABLE(intern-zo.properties);
zend_hash_init(intern-zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0);

http://cvs.php.net/co.php/php-src/ext/mysqli/tests/bug30967.phpt?r=1.1p=1
Index: php-src/ext/mysqli/tests/bug30967.phpt
+++ php-src/ext/mysqli/tests/bug30967.phpt
--TEST--
Bug #30967 testcase (properties)
--FILE--
?php
include connect.inc;

class mysql1 extends mysqli {
}

class mysql2 extends mysql1 {
}

$mysql = new mysql2(localhost, root, , test);

$mysql-query(THIS DOES NOT WORK);
printf(%d\n, $mysql-errno);

$mysql-close();
?
--EXPECTF--
1064

-- 
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

2004-08-25 Thread Georg Richter
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

2004-08-14 Thread Georg Richter
georg   Sun Aug 15 01:48:17 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fixed default for mysqli_fetch_array
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.50r2=1.51ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.50 php-src/ext/mysqli/mysqli.c:1.51
--- php-src/ext/mysqli/mysqli.c:1.50Fri Aug 13 12:25:29 2004
+++ php-src/ext/mysqli/mysqli.c Sun Aug 15 01:48:16 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.50 2004/08/13 16:25:29 georg Exp $ 
+  $Id: mysqli.c,v 1.51 2004/08/15 05:48:16 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -621,7 +621,7 @@
}
fetchtype = override_flags;
} else {
-   fetchtype = MYSQLI_ASSOC;
+   fetchtype = MYSQLI_BOTH;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
getThis(), O|l, mysql_result, mysqli_result_class_entry, fetchtype) == FAILURE) {
return;
}

-- 
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

2004-08-13 Thread Georg Richter
georg   Fri Aug 13 12:25:30 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fixed bug #29656 (segfault on result and statement properties)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.49r2=1.50ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.49 php-src/ext/mysqli/mysqli.c:1.50
--- php-src/ext/mysqli/mysqli.c:1.49Mon Aug  9 00:34:01 2004
+++ php-src/ext/mysqli/mysqli.c Fri Aug 13 12:25:29 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.49 2004/08/09 04:34:01 georg Exp $ 
+  $Id: mysqli.c,v 1.50 2004/08/13 16:25:29 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -200,11 +200,22 @@
ret = zend_hash_find(obj-prop_handler, Z_STRVAL_P(member), 
Z_STRLEN_P(member)+1, (void **) hnd);
}
if (ret == SUCCESS) {
-   /* check if connection is still valid */
-   if (!obj-ptr ||
-   !((MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-mysql)-thread_id) {
-   retval = EG(uninitialized_zval_ptr);
-   return(retval);
+
+   /* check if mysqli object is still valid */
+   if (!strcmp(obj-zo.ce-name, mysqli)) {
+   if (!obj-ptr ||
+   !((MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-mysql)-thread_id) {
+   retval = EG(uninitialized_zval_ptr);
+   return(retval);
+   }
+   } else
+   /* check if stmt object is still valid */
+   if (!strcmp(obj-zo.ce-name, mysqli_stmt)) {
+   if (!obj-ptr ||
+   !((MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-stmt)-mysql) {
+   retval = EG(uninitialized_zval_ptr);
+   return(retval);
+   }
}
 
ret = hnd-read_func(obj, retval TSRMLS_CC);

-- 
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

2004-08-08 Thread Georg Richter
georg   Mon Aug  9 00:34:01 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fixed bug #29577 (MYSQLI_CLIENT_FOUND_ROWS undefined)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.48 php-src/ext/mysqli/mysqli.c:1.49
--- php-src/ext/mysqli/mysqli.c:1.48Wed Aug  4 09:15:48 2004
+++ php-src/ext/mysqli/mysqli.c Mon Aug  9 00:34:01 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.48 2004/08/04 13:15:48 georg Exp $ 
+  $Id: mysqli.c,v 1.49 2004/08/09 04:34:01 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -438,6 +438,7 @@
REGISTER_LONG_CONSTANT(MYSQLI_CLIENT_INTERACTIVE, CLIENT_INTERACTIVE, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_CLIENT_IGNORE_SPACE, CLIENT_IGNORE_SPACE, 
CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(MYSQLI_CLIENT_NO_SCHEMA, CLIENT_NO_SCHEMA, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(MYSQLI_CLIENT_FOUND_ROWS, CLIENT_FOUND_ROWS, CONST_CS 
| CONST_PERSISTENT);
 
/* for mysqli_query */
REGISTER_LONG_CONSTANT(MYSQLI_STORE_RESULT, 0, CONST_CS | CONST_PERSISTENT);

-- 
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

2004-08-04 Thread Georg Richter
georg   Wed Aug  4 08:28:13 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fixed bug #29522
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.45r2=1.46ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.45 php-src/ext/mysqli/mysqli.c:1.46
--- php-src/ext/mysqli/mysqli.c:1.45Mon Jul 26 03:19:05 2004
+++ php-src/ext/mysqli/mysqli.c Wed Aug  4 08:28:09 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.45 2004/07/26 07:19:05 georg Exp $ 
+  $Id: mysqli.c,v 1.46 2004/08/04 12:28:09 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -200,6 +200,12 @@
ret = zend_hash_find(obj-prop_handler, Z_STRVAL_P(member), 
Z_STRLEN_P(member)+1, (void **) hnd);
}
if (ret == SUCCESS) {
+   /* check if connection is still valid */
+   if (!obj-ptr) {
+   retval = EG(uninitialized_zval_ptr);
+   return(retval);
+   }
+
ret = hnd-read_func(obj, retval TSRMLS_CC);
if (ret == SUCCESS) {
/* ensure we're creating a temporary variable */

-- 
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

2004-08-04 Thread Georg Richter
georg   Wed Aug  4 08:59:09 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  fixed properties when connect wasn't called
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.46r2=1.47ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.46 php-src/ext/mysqli/mysqli.c:1.47
--- php-src/ext/mysqli/mysqli.c:1.46Wed Aug  4 08:28:09 2004
+++ php-src/ext/mysqli/mysqli.c Wed Aug  4 08:59:09 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.46 2004/08/04 12:28:09 georg Exp $ 
+  $Id: mysqli.c,v 1.47 2004/08/04 12:59:09 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -171,6 +171,8 @@
 }
 /* }}} */
 
+MYSQL *p;
+
 /* {{{ mysqli_read_property */
 zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC)
 {
@@ -201,7 +203,8 @@
}
if (ret == SUCCESS) {
/* check if connection is still valid */
-   if (!obj-ptr) {
+   if (!obj-ptr ||
+   !((MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE 
*)(obj-ptr))-ptr)-mysql)-thread_id) {
retval = EG(uninitialized_zval_ptr);
return(retval);
}

-- 
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

2004-08-04 Thread Georg Richter
georg   Wed Aug  4 09:15:48 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  forgot to remove debug variable :(  (Thx to Derick)
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.47r2=1.48ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.47 php-src/ext/mysqli/mysqli.c:1.48
--- php-src/ext/mysqli/mysqli.c:1.47Wed Aug  4 08:59:09 2004
+++ php-src/ext/mysqli/mysqli.c Wed Aug  4 09:15:48 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.47 2004/08/04 12:59:09 georg Exp $ 
+  $Id: mysqli.c,v 1.48 2004/08/04 13:15:48 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -170,8 +170,6 @@
return FAILURE;
 }
 /* }}} */
-
-MYSQL *p;
 
 /* {{{ mysqli_read_property */
 zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC)

-- 
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

2004-08-04 Thread Georg Richter
Am Mi, den 04.08.2004 schrieb Derick Rethans um 15:02:

Him

  +MYSQL *p;
  +
 
 What's this? :)
 

That's modern coding style :)
Thx, I didn't delete all lines from a debug macro before - it's fixed
now!

/Georg

-- 
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_fe.c

2004-06-23 Thread Georg Richter
georg   Wed Jun 23 12:47:26 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c mysqli_fe.c 
  Log:
  added php_mysqli_construct_get to support __construct in extended classes
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.40r2=1.41ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.40 php-src/ext/mysqli/mysqli.c:1.41
--- php-src/ext/mysqli/mysqli.c:1.40Sun Jun  6 02:40:19 2004
+++ php-src/ext/mysqli/mysqli.c Wed Jun 23 12:47:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.40 2004/06/06 06:40:19 sebastian Exp $ 
+  $Id: mysqli.c,v 1.41 2004/06/23 16:47:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -269,6 +269,27 @@
 }
 /* }}} */
 
+static union _zend_function *php_mysqli_constructor_get(zval *object TSRMLS_DC)
+{
+   mysqli_object *obj = (mysqli_object *)zend_objects_get_address(object 
TSRMLS_CC);
+
+   if (obj-zo.ce != mysqli_link_class_entry) {
+   return obj-zo.ce-constructor;
+   } else {
+   static zend_internal_function f;
+
+   f.function_name = mysqli_link_class_entry-name;
+   f.scope = mysqli_link_class_entry;
+   f.arg_info = NULL;
+   f.num_args = 0;
+   f.fn_flags = 0;
+
+   f.type = ZEND_INTERNAL_FUNCTION;
+   f.handler = ZEND_FN(mysqli_connect);
+   
+   return (union _zend_function*)f;
+   }
+}
 /* {{{ mysqli_objects_new
  */
 PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_type 
TSRMLS_DC)
@@ -374,6 +395,7 @@
mysqli_object_handlers.read_property = mysqli_read_property;
mysqli_object_handlers.write_property = mysqli_write_property;
mysqli_object_handlers.get_property_ptr_ptr = NULL;
+   mysqli_object_handlers.get_constructor = php_mysqli_constructor_get;
 
zend_hash_init(classes, 0, NULL, NULL, 1);
 
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_fe.c?r1=1.38r2=1.39ty=u
Index: php-src/ext/mysqli/mysqli_fe.c
diff -u php-src/ext/mysqli/mysqli_fe.c:1.38 php-src/ext/mysqli/mysqli_fe.c:1.39
--- php-src/ext/mysqli/mysqli_fe.c:1.38 Mon Jun  7 04:34:52 2004
+++ php-src/ext/mysqli/mysqli_fe.c  Wed Jun 23 12:47:25 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_fe.c,v 1.38 2004/06/07 08:34:52 georg Exp $ 
+  $Id: mysqli_fe.c,v 1.39 2004/06/23 16:47:25 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -206,7 +206,6 @@
PHP_FALIAS(set_local_infile_default,mysqli_set_local_infile_default,NULL)
PHP_FALIAS(set_local_infile_handler,mysqli_set_local_infile_handler,NULL)
PHP_FALIAS(master_query,mysqli_master_query,NULL)
-   PHP_FALIAS(mysqli, mysqli_connect, NULL)
PHP_FALIAS(multi_query,mysqli_multi_query,NULL)
PHP_FALIAS(more_results,mysqli_more_results, NULL)
PHP_FALIAS(next_result, mysqli_next_result, 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

2004-04-15 Thread Andi Gutmans
andiThu Apr 15 13:25:51 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  - Temporary fix for bug #27869 
  - George, you need to implement clone in order for clone and
  - compatibility mode to work.
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.37r2=1.38ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.37 php-src/ext/mysqli/mysqli.c:1.38
--- php-src/ext/mysqli/mysqli.c:1.37Sun Mar 21 13:27:23 2004
+++ php-src/ext/mysqli/mysqli.c Thu Apr 15 13:25:51 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.37 2004/03/21 18:27:23 stas Exp $ 
+  $Id: mysqli.c,v 1.38 2004/04/15 17:25:51 andi Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -280,7 +280,7 @@
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref,
(void *) tmp, sizeof(zval *));
 
-   retval.handle = zend_objects_store_put(intern, NULL, 
mysqli_objects_free_storage, mysqli_objects_clone TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, NULL, 
mysqli_objects_free_storage, NULL /*mysqli_objects_clone*/ TSRMLS_CC);
retval.handlers = mysqli_object_handlers;
 
return retval;
@@ -353,7 +353,7 @@
REGISTER_INI_ENTRIES();
 
memcpy(mysqli_object_handlers, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
-   mysqli_object_handlers.clone_obj = zend_objects_store_clone_obj;
+   mysqli_object_handlers.clone_obj = NULL /*zend_objects_store_clone_obj*/;
mysqli_object_handlers.read_property = mysqli_read_property;
mysqli_object_handlers.write_property = mysqli_write_property;
mysqli_object_handlers.get_property_ptr_ptr = 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

2004-03-18 Thread Georg Richter
georg   Thu Mar 18 08:03:20 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  removed if type=string: val is allocated for any type of data
  
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.35r2=1.36ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.35 php-src/ext/mysqli/mysqli.c:1.36
--- php-src/ext/mysqli/mysqli.c:1.35Tue Mar 16 16:43:25 2004
+++ php-src/ext/mysqli/mysqli.c Thu Mar 18 08:03:17 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.35 2004/03/16 21:43:25 georg Exp $ 
+  $Id: mysqli.c,v 1.36 2004/03/18 13:03:17 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -67,9 +67,7 @@
 
/* free temporary bind buffer */
if (type == FETCH_RESULT) {
-   if (bbuf.buf[i].type == IS_STRING) {
-   efree(bbuf.buf[i].val);
-   }
+   efree(bbuf.buf[i].val);
}
 
if (bbuf.vars[i]) {

-- 
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_prop.c mysqli_report.c php_mysqli.h

2004-03-16 Thread Georg Richter
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

2004-03-09 Thread Marcus Boerger
helly   Tue Mar  9 09:29:22 2004 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Missing buffer-val change
  
http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli.c?r1=1.33r2=1.34ty=u
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.33 php-src/ext/mysqli/mysqli.c:1.34
--- php-src/ext/mysqli/mysqli.c:1.33Thu Feb 26 06:40:35 2004
+++ php-src/ext/mysqli/mysqli.c Tue Mar  9 09:29:20 2004
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.33 2004/02/26 11:40:35 georg Exp $ 
+  $Id: mysqli.c,v 1.34 2004/03/09 14:29:20 helly Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -66,7 +66,7 @@
for (i=0; i  bbuf.var_cnt; i++) {
if (type == FETCH_RESULT) {
if (bbuf.buf[i].type == IS_STRING) {
-   efree(bbuf.buf[i].buffer);
+   efree(bbuf.buf[i].val);
}
}
if (bbuf.vars[i]) {

-- 
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

2004-02-11 Thread Georg Richter
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

2004-02-10 Thread Georg Richter
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 /ext/sqlite sqlite.c

2003-12-31 Thread Ilia Alshanetsky
iliaa   Wed Dec 31 14:45:47 2003 EDT

  Modified files:  
/php-src/ext/sqlite sqlite.c 
/php-src/ext/mysqli mysqli.c 
  Log:
  emalloc() - safe_emalloc()
  
  
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.108 php-src/ext/sqlite/sqlite.c:1.109
--- php-src/ext/sqlite/sqlite.c:1.108   Sun Dec 28 11:26:04 2003
+++ php-src/ext/sqlite/sqlite.c Wed Dec 31 14:45:45 2003
@@ -17,7 +17,7 @@
|  Marcus Boerger [EMAIL PROTECTED]  |
+--+
 
-   $Id: sqlite.c,v 1.108 2003/12/28 16:26:04 helly Exp $ 
+   $Id: sqlite.c,v 1.109 2003/12/31 19:45:45 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1076,7 +1076,7 @@
 {
php_info_print_table_start();
php_info_print_table_header(2, SQLite support, enabled);
-   php_info_print_table_row(2, PECL Module version, PHP_SQLITE_MODULE_VERSION  
$Id: sqlite.c,v 1.108 2003/12/28 16:26:04 helly Exp $);
+   php_info_print_table_row(2, PECL Module version, PHP_SQLITE_MODULE_VERSION  
$Id: sqlite.c,v 1.109 2003/12/31 19:45:45 iliaa Exp $);
php_info_print_table_row(2, SQLite Library, sqlite_libversion());
php_info_print_table_row(2, SQLite Encoding, sqlite_libencoding());
php_info_print_table_end();
@@ -1942,7 +1942,7 @@
Bucket *p;
 
fci.param_count = 0;
-   fci.params = emalloc(sizeof(zval*) * 
ht-nNumOfElements);
+   fci.params = safe_emalloc(sizeof(zval*), 
ht-nNumOfElements, 0);
p = ht-pListHead;
while (p != NULL) {
fci.params[fci.param_count++] = 
(zval**)p-pData;
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.23 php-src/ext/mysqli/mysqli.c:1.24
--- php-src/ext/mysqli/mysqli.c:1.23Wed Dec 31 03:34:02 2003
+++ php-src/ext/mysqli/mysqli.c Wed Dec 31 14:45:46 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.23 2003/12/31 08:34:02 georg Exp $ 
+  $Id: mysqli.c,v 1.24 2003/12/31 19:45:46 iliaa Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -630,7 +630,7 @@
Bucket *p;

fci.param_count = 0;
-   fci.params = emalloc(sizeof(zval*) * 
ht-nNumOfElements);
+   fci.params = safe_emalloc(sizeof(zval*), 
ht-nNumOfElements, 0);
p = ht-pListHead;
while (p != NULL) {
fci.params[fci.param_count++] = 
(zval**)p-pData;

-- 
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

2003-12-10 Thread Georg Richter
georg   Wed Dec 10 05:06:08 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  freeing result and stmt properties in MSHUTDOWN
  
  
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.20 php-src/ext/mysqli/mysqli.c:1.21
--- php-src/ext/mysqli/mysqli.c:1.20Mon Nov 24 06:31:26 2003
+++ php-src/ext/mysqli/mysqli.c Wed Dec 10 05:06:07 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.20 2003/11/24 11:31:26 georg Exp $ 
+  $Id: mysqli.c,v 1.21 2003/12/10 10:06:07 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -343,9 +343,6 @@
mysqli_object_handlers.read_property = mysqli_read_property;
mysqli_object_handlers.write_property = mysqli_write_property;
mysqli_object_handlers.get_property_ptr_ptr = NULL;
-// mysqli_object_handlers.call_method = php_mysqli_connect;
-
-/* todo: call method */
 
zend_hash_init(classes, 0, NULL, NULL, 1);
 
@@ -464,6 +461,8 @@
 PHP_MSHUTDOWN_FUNCTION(mysqli)
 {
zend_hash_destroy(mysqli_link_properties);
+   zend_hash_destroy(mysqli_result_properties);
+   zend_hash_destroy(mysqli_stmt_properties);
zend_hash_destroy(classes);
 
UNREGISTER_INI_ENTRIES();

-- 
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

2003-11-24 Thread Georg Richter
georg   Mon Nov 24 06:31:27 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  added/fixed write property
  
  
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.19 php-src/ext/mysqli/mysqli.c:1.20
--- php-src/ext/mysqli/mysqli.c:1.19Sat Nov 22 16:20:06 2003
+++ php-src/ext/mysqli/mysqli.c Mon Nov 24 06:31:26 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.19 2003/11/22 21:20:06 georg Exp $ 
+  $Id: mysqli.c,v 1.20 2003/11/24 11:31:26 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -44,7 +44,7 @@
 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 *member, zval *newval 
TSRMLS_DC);
+typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval TSRMLS_DC);
 
 typedef struct _mysqli_prop_handler {
mysqli_read_t read_func;
@@ -149,7 +149,7 @@
 /* }}} */
 
 /* {{{ mysqli_write_na */
-static int mysqli_write_na(mysqli_object *obj, zval *member, zval *newval TSRMLS_DC)
+static int mysqli_write_na(mysqli_object *obj, zval *newval TSRMLS_DC)
 {
php_error_docref(NULL TSRMLS_CC, E_ERROR, Cannot write property);
return FAILURE;
@@ -195,19 +195,50 @@
if (member == tmp_member) {
zval_dtor(member);
}
-
-
return(retval);
 }
 /* }}} */
 
-/* {{{ mysqli_write_property */
+/* {{{ mysqli_read_property */
 void mysqli_write_property(zval *object, zval *member, zval *value TSRMLS_DC)
 {
-   return;
+   zval tmp_member;
+   mysqli_object *obj;
+   mysqli_prop_handler *hnd;
+   zend_object_handlers *std_hnd;
+   int ret;
+
+   if (member-type != IS_STRING) {
+   tmp_member = *member;
+   zval_copy_ctor(tmp_member);
+   convert_to_string(tmp_member);
+   member = tmp_member;
+   }
+
+   ret = FAILURE;
+   obj = (mysqli_object *)zend_objects_get_address(object TSRMLS_CC);
+
+   if (obj-prop_handler != NULL) {
+   ret = zend_hash_find((HashTable *)obj-prop_handler, 
Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) hnd);
+   }
+   if (ret == SUCCESS) {
+   hnd-write_func(obj, value TSRMLS_CC);
+   if (! PZVAL_IS_REF(value)  value-refcount == 0) {
+   value-refcount++;
+   zval_ptr_dtor(value);
+   }
+   } else {
+   std_hnd = zend_get_std_object_handlers();
+   std_hnd-write_property(object, member, value TSRMLS_CC);
+   }
+
+   if (member == tmp_member) {
+   zval_dtor(member);
+   }
 }
 /* }}} */
 
+
 void mysqli_add_property(HashTable *h, char *pname, mysqli_read_t r_func, 
mysqli_write_t w_func TSRMLS_DC) {
mysqli_prop_handler p;
 

-- 
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

2003-10-30 Thread Zak Greant
zak Thu Oct 30 08:32:19 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli.c 
  Log:
  Ensure that INI entries are unregistered on shutdown
  
  
Index: php-src/ext/mysqli/mysqli.c
diff -u php-src/ext/mysqli/mysqli.c:1.16 php-src/ext/mysqli/mysqli.c:1.17
--- php-src/ext/mysqli/mysqli.c:1.16Sat Sep  6 15:34:48 2003
+++ php-src/ext/mysqli/mysqli.c Thu Oct 30 08:32:18 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli.c,v 1.16 2003/09/06 19:34:48 helly Exp $ 
+  $Id: mysqli.c,v 1.17 2003/10/30 13:32:18 zak Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -310,9 +310,7 @@
  */
 PHP_MSHUTDOWN_FUNCTION(mysqli)
 {
-   /* uncomment this line if you have INI entries
UNREGISTER_INI_ENTRIES();
-   */
return SUCCESS;
 }
 /* }}} */

-- 
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 php_mysqli.h

2003-07-15 Thread Georg Richter
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