[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2012-02-02 Thread Andrey Hristov
andrey   Thu, 02 Feb 2012 15:00:42 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=323020

Log:
assert

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2012-02-02 13:40:16 UTC (rev 323019)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2012-02-02 15:00:42 UTC (rev 323020)
@@ -958,7 +958,11 @@
BAIL_IF_NO_MORE_DATA;
}

-   /* 1 byte filler */
+   /* 1 byte length */
+   if (12 != *p) {
+   DBG_ERR_FMT(Protocol error. Server sent false length. Expected 
12 got %d, (int) *p);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol error. 
Server sent false length. Expected 12);
+   }
p++;
BAIL_IF_NO_MORE_DATA;


Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c 
2012-02-02 13:40:16 UTC (rev 323019)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c 
2012-02-02 15:00:42 UTC (rev 323020)
@@ -1177,7 +1177,11 @@
BAIL_IF_NO_MORE_DATA;
}

-   /* 1 byte filler */
+   /* 1 byte length */
+   if (12 != *p) {
+   DBG_ERR_FMT(Protocol error. Server sent false length. Expected 
12 got %d, (int) *p);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol error. 
Server sent false length. Expected 12);
+   }
p++;
BAIL_IF_NO_MORE_DATA;


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2012-02-02 
13:40:16 UTC (rev 323019)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2012-02-02 
15:00:42 UTC (rev 323020)
@@ -1177,7 +1177,11 @@
BAIL_IF_NO_MORE_DATA;
}

-   /* 1 byte filler */
+   /* 1 byte length */
+   if (12 != *p) {
+   DBG_ERR_FMT(Protocol error. Server sent false length. Expected 
12 got %d, (int) *p);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol error. 
Server sent false length. Expected 12);
+   }
p++;
BAIL_IF_NO_MORE_DATA;


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/config9.m4 branches/PHP_5_4/ext/mysqlnd/config9.m4 trunk/ext/mysqlnd/config9.m4

2012-01-12 Thread Christopher Jones
sixd Thu, 12 Jan 2012 23:23:05 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=322156

Log:
Fix configuration message typo and alignment (5.4 merge approved by Stas)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4
U   php/php-src/trunk/ext/mysqlnd/config9.m4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2012-01-12 21:30:30 UTC 
(rev 322155)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2012-01-12 23:23:05 UTC 
(rev 322156)
@@ -3,8 +3,8 @@
 dnl config.m4 for mysqlnd driver

 PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd,
-  [  --enable-mysqlnd   Enable mysqlnd expliciely, will be done implicitly
- when required by other extensions], no, yes)
+  [  --enable-mysqlndEnable mysqlnd explicitly, will be done implicitly
+  when required by other extensions], no, yes)

 PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4 2012-01-12 21:30:30 UTC 
(rev 322155)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4 2012-01-12 23:23:05 UTC 
(rev 322156)
@@ -3,8 +3,8 @@
 dnl config.m4 for mysqlnd driver

 PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd,
-  [  --enable-mysqlnd   Enable mysqlnd expliciely, will be done implicitly
- when required by other extensions], no, yes)
+  [  --enable-mysqlndEnable mysqlnd explicitly, will be done implicitly
+  when required by other extensions], no, yes)

 PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support

Modified: php/php-src/trunk/ext/mysqlnd/config9.m4
===
--- php/php-src/trunk/ext/mysqlnd/config9.m42012-01-12 21:30:30 UTC (rev 
322155)
+++ php/php-src/trunk/ext/mysqlnd/config9.m42012-01-12 23:23:05 UTC (rev 
322156)
@@ -3,8 +3,8 @@
 dnl config.m4 for mysqlnd driver

 PHP_ARG_ENABLE(mysqlnd, whether to enable mysqlnd,
-  [  --enable-mysqlnd   Enable mysqlnd expliciely, will be done implicitly
- when required by other extensions], no, yes)
+  [  --enable-mysqlndEnable mysqlnd explicitly, will be done implicitly
+  when required by other extensions], no, yes)

 PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h trunk/ext/mysqlnd/mysqlnd_priv.h

2011-11-22 Thread Andrey Hristov
andrey   Tue, 22 Nov 2011 16:38:06 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=319690

Log:
use the method in all builds. Thus it can be used for detection
of state transitioning in every case

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h 2011-11-22 
16:27:35 UTC (rev 319689)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h 2011-11-22 
16:38:06 UTC (rev 319690)
@@ -147,16 +147,9 @@

 #define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR((stmt)-error_info, a, 
b, c)

-
-#ifdef ZTS
 #define CONN_GET_STATE(c)  (c)-m-get_state((c) TSRMLS_CC)
 #define CONN_SET_STATE(c, s)   (c)-m-set_state((c), (s) TSRMLS_CC)
-#else
-#define CONN_GET_STATE(c)  ((c)-state)
-#define CONN_SET_STATE(c, s)   ((c)-state = (s))
-#endif

-
 /* PS stuff */
 typedef void (*ps_field_fetch_func)(zval *zv, const MYSQLND_FIELD * const 
field,

unsigned int pack_len, zend_uchar **row,

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h 2011-11-22 
16:27:35 UTC (rev 319689)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h 2011-11-22 
16:38:06 UTC (rev 319690)
@@ -170,16 +170,9 @@

 #define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR(*(stmt)-error_info, 
a, b, c)

-
-#ifdef ZTS
 #define CONN_GET_STATE(c)  (c)-m-get_state((c) TSRMLS_CC)
 #define CONN_SET_STATE(c, s)   (c)-m-set_state((c), (s) TSRMLS_CC)
-#else
-#define CONN_GET_STATE(c)  ((c)-state)
-#define CONN_SET_STATE(c, s)   ((c)-state = (s))
-#endif

-
 /* PS stuff */
 typedef void (*ps_field_fetch_func)(zval *zv, const MYSQLND_FIELD * const 
field,

unsigned int pack_len, zend_uchar **row,

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h2011-11-22 16:27:35 UTC 
(rev 319689)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h2011-11-22 16:38:06 UTC 
(rev 319690)
@@ -170,16 +170,9 @@

 #define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR(*(stmt)-error_info, 
a, b, c)

-
-#ifdef ZTS
 #define CONN_GET_STATE(c)  (c)-m-get_state((c) TSRMLS_CC)
 #define CONN_SET_STATE(c, s)   (c)-m-set_state((c), (s) TSRMLS_CC)
-#else
-#define CONN_GET_STATE(c)  ((c)-state)
-#define CONN_SET_STATE(c, s)   ((c)-state = (s))
-#endif

-
 /* PS stuff */
 typedef void (*ps_field_fetch_func)(zval *zv, const MYSQLND_FIELD * const 
field,

unsigned int pack_len, zend_uchar **row,

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.c

2011-10-18 Thread Andrey Hristov
andrey   Tue, 18 Oct 2011 14:10:44 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=318185

Log:
move change_user closer to connect

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2011-10-18 14:04:13 UTC (rev 318184)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2011-10-18 14:10:44 UTC (rev 318185)
@@ -886,6 +886,144 @@
 /* }}} */


+/* {{{ mysqlnd_conn::change_user */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn,
+		  const char *user,
+		  const char *passwd,
+		  const char *db,
+		  zend_bool silent TSRMLS_DC)
+{
+	size_t user_len;
+	enum_func_status ret = FAIL;
+	MYSQLND_PACKET_CHG_USER_RESPONSE * chg_user_resp;
+	char buffer[MYSQLND_MAX_ALLOWED_USER_LEN + 1 + 1 + SCRAMBLE_LENGTH + MYSQLND_MAX_ALLOWED_DB_LEN + 1 + 2 /* charset*/ + 2];
+	char *p = buffer;
+	const MYSQLND_CHARSET * old_cs = conn-charset;
+
+	DBG_ENTER(mysqlnd_conn::change_user);
+	DBG_INF_FMT(conn=%llu user=%s passwd=%s db=%s silent=%u,
+conn-thread_id, user?user:, passwd?***:null, db?db:, (silent == TRUE)?1:0 );
+
+	SET_ERROR_AFF_ROWS(conn);
+
+	if (!user) {
+		user = ;
+	}
+	if (!passwd) {
+		passwd = ;
+	}
+	if (!db) {
+		db = ;
+	}
+
+	/* 1. user ASCIIZ */
+	user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_USER_LEN);
+	memcpy(p, user, user_len);
+	p += user_len;
+	*p++ = '\0';
+
+	/* 2. password SCRAMBLE_LENGTH followed by the scramble or \0 */
+	if (passwd[0]) {
+		*p++ = SCRAMBLE_LENGTH;
+		php_mysqlnd_scramble((unsigned char *)p, conn-scramble, (unsigned char *)passwd);
+		p += SCRAMBLE_LENGTH;
+	} else {
+		*p++ = '\0';
+	}
+
+	/* 3. db ASCIIZ */
+	if (db[0]) {
+		size_t db_len = MIN(strlen(db), MYSQLND_MAX_ALLOWED_DB_LEN);
+		memcpy(p, db, db_len);
+		p += db_len;
+	}
+	*p++ = '\0';
+
+	/*
+	  4. request the current charset, or it will be reset to the system one.
+	  5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug :
+	  Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call
+	*/
+	if (mysqlnd_get_server_version(conn) = 50123) {
+		int2store(p, conn-charset-nr);
+		p+=2;
+	}
+
+	if (PASS != conn-m-simple_command(conn, COM_CHANGE_USER, buffer, p - buffer,
+	   PROT_LAST /* we will handle the OK packet*/,
+	   silent, TRUE TSRMLS_CC)) {
+		DBG_RETURN(FAIL);
+	}
+
+	chg_user_resp = conn-protocol-m.get_change_user_response_packet(conn-protocol, FALSE TSRMLS_CC);
+	if (!chg_user_resp) {
+		SET_OOM_ERROR(conn-error_info);
+		goto end;
+	}
+	ret = PACKET_READ(chg_user_resp, conn);
+	conn-error_info = chg_user_resp-error_info;
+
+	if (conn-error_info.error_no) {
+		ret = FAIL;
+		/*
+		  COM_CHANGE_USER is broken in 5.1. At least in 5.1.15 and 5.1.14, 5.1.11 is immune.
+		  bug#25371 mysql_change_user() triggers packets out of sync
+		  When it gets fixed, there should be one more check here
+		*/
+		if (mysqlnd_get_server_version(conn)  50113L  mysqlnd_get_server_version(conn)  50118L) {
+			MYSQLND_PACKET_OK * redundant_error_packet = conn-protocol-m.get_ok_packet(conn-protocol, FALSE TSRMLS_CC);
+			if (redundant_error_packet) {
+PACKET_READ(redundant_error_packet, conn);
+PACKET_FREE(redundant_error_packet);
+DBG_INF_FMT(Server is %u, buggy, sends two ERR messages, mysqlnd_get_server_version(conn));
+			} else {
+SET_OOM_ERROR(conn-error_info);
+			}
+		}
+	}
+	if (ret == PASS) {
+		char * tmp = NULL;
+		/* if we get conn-user as parameter and then we first free it, then estrndup it, we will crash */
+		tmp = mnd_pestrndup(user, user_len, conn-persistent);
+		if (conn-user) {
+			mnd_pefree(conn-user, conn-persistent);
+		}
+		conn-user = tmp;
+
+		tmp = mnd_pestrdup(passwd, conn-persistent);
+		if (conn-passwd) {
+			mnd_pefree(conn-passwd, conn-persistent);
+		}
+		conn-passwd = tmp;
+
+		if (conn-last_message) {
+			mnd_pefree(conn-last_message, conn-persistent);
+			conn-last_message = NULL;
+		}
+		memset(conn-upsert_status, 0, sizeof(conn-upsert_status));
+		/* set charset for old servers */
+		if (mysqlnd_get_server_version(conn)  50123) {
+			ret = conn-m-set_charset(conn, old_cs-name TSRMLS_CC);
+		}
+	} else if (ret == FAIL  chg_user_resp-server_asked_323_auth == TRUE) {
+		/* old authentication with new server  !*/
+		DBG_ERR(mysqlnd_old_passwd);
+		SET_CLIENT_ERROR(conn-error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
+	}
+end:
+	PACKET_FREE(chg_user_resp);
+
+	/*
+	  Here we should close all statements. Unbuffered queries should not be a
+	  problem as we won't allow sending COM_CHANGE_USER.
+	*/
+	DBG_INF(ret == PASS? PASS:FAIL);
+	DBG_RETURN(ret);
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_conn::query */
 /*
   If conn-error_info.error_no is not zero, then we had an 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.h

2011-10-14 Thread Andrey Hristov
andrey   Fri, 14 Oct 2011 14:12:16 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=318113

Log:
this should be decided by configure

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-10-14 14:03:06 UTC 
(rev 318112)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-10-14 14:12:16 UTC 
(rev 318113)
@@ -28,7 +28,6 @@
 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0
 #define AUTOCOMMIT_TX_COMMIT_ROLLBACK
-#define MYSQLND_SSL_SUPPORTED

 #define MYSQLND_STRING_TO_INT_CONVERSION
 /*

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2011-09-25 Thread Johannes Schlüter
johannes Sun, 25 Sep 2011 13:06:09 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=317275

Log:
- Fix folding

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-09-25 13:03:27 UTC 
(rev 317274)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-09-25 13:06:09 UTC 
(rev 317275)
@@ -1043,8 +1043,8 @@

return ret;
 }
+/* }}} */

-
 #ifndef PHP_WIN32
 #define php_select(m, r, w, e, t)  select(m, r, w, e, t)
 #else

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-09-25 13:03:27 UTC 
(rev 317274)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-09-25 13:06:09 UTC 
(rev 317275)
@@ -1161,8 +1161,8 @@

return ret;
 }
+/* }}} */

-
 #ifndef PHP_WIN32
 #define php_select(m, r, w, e, t)  select(m, r, w, e, t)
 #else

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-09-25 13:03:27 UTC (rev 
317274)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-09-25 13:06:09 UTC (rev 
317275)
@@ -1161,8 +1161,8 @@

return ret;
 }
+/* }}} */

-
 #ifndef PHP_WIN32
 #define php_select(m, r, w, e, t)  select(m, r, w, e, t)
 #else

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_result.c

2011-09-05 Thread Andrey Hristov
andrey   Mon, 05 Sep 2011 15:37:58 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=316189

Log:
missing from previous commit for #55582

Bug: https://bugs.php.net/55582 (Closed) mysqli_num_rows() returns always 0 for 
unbuffered, when mysqlnd is used
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-09-05 
15:29:45 UTC (rev 316188)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-09-05 
15:37:58 UTC (rev 316189)
@@ -616,19 +616,18 @@
 static unsigned long *
 mysqlnd_fetch_lengths_unbuffered(MYSQLND_RES * const result TSRMLS_DC)
 {
-   return result-lengths;
+   /* simulate output of libmysql */
+   return (!result-unbuf || result-unbuf-last_row_data || 
result-unbuf-eof_reached)? result-lengths:NULL;
 }
 /* }}} */


-#if !defined(MYSQLND_USE_OPTIMISATIONS) || MYSQLND_USE_OPTIMISATIONS == 0
 /* {{{ mysqlnd_res::fetch_lengths */
 PHPAPI unsigned long * _mysqlnd_fetch_lengths(MYSQLND_RES * const result 
TSRMLS_DC)
 {
return result-m.fetch_lengths? result-m.fetch_lengths(result 
TSRMLS_CC) : NULL;
 }
 /* }}} */
-#endif


 /* {{{ mysqlnd_fetch_row_unbuffered_c */

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2011-09-04 Thread Gustavo André dos Santos Lopes
cataphract   Mon, 05 Sep 2011 00:39:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=316124

Log:
- Fixed bad xor in signed types due to integer promotion.
- Replaced undefined signed overflow with char - unsigned char conversion.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-09-04 
23:44:00 UTC (rev 316123)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-09-05 
00:39:39 UTC (rev 316124)
@@ -122,11 +122,11 @@
  [F4][80..8F][80..BF][80..BF]
*/

-   if (!((start[1] ^ 0x80)  0x40 
-   (start[2] ^ 0x80)  0x40 
-   (start[3] ^ 0x80)  0x40 
-   (c = 0xf1 || start[1] = (char)0x90) 
-   (c = 0xf3 || start[1] = (char)0x8F)))
+   if (!(((zend_uchar)start[1] ^ 0x80)  0x40 
+   ((zend_uchar)start[2] ^ 0x80)  0x40 
+   ((zend_uchar)start[3] ^ 0x80)  0x40 
+   (c = 0xf1 || (zend_uchar)start[1] = 0x90) 
+   (c = 0xf3 || (zend_uchar)start[1] = 0x8F)))
{
return 0;   /* invalid utf8 character */
}

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c  2011-09-04 
23:44:00 UTC (rev 316123)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c  2011-09-05 
00:39:39 UTC (rev 316124)
@@ -123,11 +123,11 @@
  [F4][80..8F][80..BF][80..BF]
*/

-   if (!((start[1] ^ 0x80)  0x40 
-   (start[2] ^ 0x80)  0x40 
-   (start[3] ^ 0x80)  0x40 
-   (c = 0xf1 || start[1] = (char)0x90) 
-   (c = 0xf3 || start[1] = (char)0x8F)))
+   if (!(((zend_uchar)start[1] ^ 0x80)  0x40 
+   ((zend_uchar)start[2] ^ 0x80)  0x40 
+   ((zend_uchar)start[3] ^ 0x80)  0x40 
+   (c = 0xf1 || (zend_uchar)start[1] = 0x90) 
+   (c = 0xf3 || (zend_uchar)start[1] = 0x8F)))
{
return 0;   /* invalid utf8 character */
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-09-04 23:44:00 UTC 
(rev 316123)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-09-05 00:39:39 UTC 
(rev 316124)
@@ -123,11 +123,11 @@
  [F4][80..8F][80..BF][80..BF]
*/

-   if (!((start[1] ^ 0x80)  0x40 
-   (start[2] ^ 0x80)  0x40 
-   (start[3] ^ 0x80)  0x40 
-   (c = 0xf1 || start[1] = (char)0x90) 
-   (c = 0xf3 || start[1] = (char)0x8F)))
+   if (!(((zend_uchar)start[1] ^ 0x80)  0x40 
+   ((zend_uchar)start[2] ^ 0x80)  0x40 
+   ((zend_uchar)start[3] ^ 0x80)  0x40 
+   (c = 0xf1 || (zend_uchar)start[1] = 0x90) 
+   (c = 0xf3 || (zend_uchar)start[1] = 0x8F)))
{
return 0;   /* invalid utf8 character */
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-09-02 Thread Andrey Hristov
andrey   Fri, 02 Sep 2011 11:22:41 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=316035

Log:
function rename to comply with the schema of other callbacks

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-09-02 
11:06:51 UTC (rev 316034)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-09-02 
11:22:41 UTC (rev 316035)
@@ -41,7 +41,7 @@
 /* Exported by mysqlnd_ps_codec.c */
 enum_func_status mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * const s, 
zend_uchar ** request, size_t *request_len, zend_bool * free_buffer TSRMLS_DC);

-enum_func_status mysqlnd_fetch_stmt_row_buffered(MYSQLND_RES *result, void 
*param,
+enum_func_status mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES *result, void 
*param,

unsigned int flags,

zend_bool *fetched_anything TSRMLS_DC);

@@ -97,7 +97,7 @@

result = stmt-result;
result-type= MYSQLND_RES_PS_BUF;
-   result-m.fetch_row = mysqlnd_fetch_stmt_row_buffered;
+   result-m.fetch_row = mysqlnd_stmt_fetch_row_buffered;
result-m.fetch_lengths = NULL;/* makes no sense */

result-result_set_memory_pool = 
mysqlnd_mempool_create(MYSQLND_G(mempool_default_size) TSRMLS_CC);
@@ -724,16 +724,16 @@
 /* }}} */


-/* {{{ mysqlnd_fetch_stmt_row_buffered */
+/* {{{ mysqlnd_stmt_fetch_row_buffered */
 enum_func_status
-mysqlnd_fetch_stmt_row_buffered(MYSQLND_RES *result, void *param, unsigned int 
flags, zend_bool *fetched_anything TSRMLS_DC)
+mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES *result, void *param, unsigned int 
flags, zend_bool *fetched_anything TSRMLS_DC)
 {
MYSQLND_STMT * s = (MYSQLND_STMT *) param;
MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
MYSQLND_RES_BUFFERED *set = result-stored_data;
unsigned int field_count = result-meta-field_count;

-   DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
+   DBG_ENTER(mysqlnd_stmt_fetch_row_buffered);
*fetched_anything = FALSE;
DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);


Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_ps.c   2011-09-02 
11:06:51 UTC (rev 316034)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_ps.c   2011-09-02 
11:22:41 UTC (rev 316035)
@@ -41,7 +41,7 @@
 /* Exported by mysqlnd_ps_codec.c */
 enum_func_status mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * const s, 
zend_uchar ** request, size_t *request_len, zend_bool * free_buffer TSRMLS_DC);

-enum_func_status mysqlnd_fetch_stmt_row_buffered(MYSQLND_RES *result, void 
*param,
+enum_func_status mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES *result, void 
*param,

unsigned int flags,

zend_bool *fetched_anything TSRMLS_DC);

@@ -112,7 +112,7 @@

result = stmt-result;
result-type= MYSQLND_RES_PS_BUF;
-   result-m.fetch_row = mysqlnd_fetch_stmt_row_buffered;
+   result-m.fetch_row = mysqlnd_stmt_fetch_row_buffered;
result-m.fetch_lengths = NULL;/* makes no sense */
result-m.row_decoder = php_mysqlnd_rowp_read_binary_protocol;

@@ -720,16 +720,16 @@
 /* }}} */


-/* {{{ mysqlnd_fetch_stmt_row_buffered */
+/* {{{ mysqlnd_stmt_fetch_row_buffered */
 enum_func_status
-mysqlnd_fetch_stmt_row_buffered(MYSQLND_RES *result, void *param, unsigned int 
flags, zend_bool *fetched_anything TSRMLS_DC)
+mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES *result, void *param, unsigned int 
flags, zend_bool *fetched_anything TSRMLS_DC)
 {
MYSQLND_STMT * s = (MYSQLND_STMT *) param;
MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
MYSQLND_RES_BUFFERED *set = result-stored_data;
unsigned int field_count = result-meta-field_count;

-   DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
+   DBG_ENTER(mysqlnd_stmt_fetch_row_buffered);
*fetched_anything = FALSE;
DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-09-02 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/config9.m4 branches/PHP_5_4/ext/mysqlnd/config9.m4 trunk/ext/mysqlnd/config9.m4

2011-09-02 Thread Andrey Hristov
andrey   Fri, 02 Sep 2011 12:59:32 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=316036

Log:
fix message

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4
U   php/php-src/trunk/ext/mysqlnd/config9.m4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-09-02 11:22:41 UTC 
(rev 316035)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-09-02 12:59:32 UTC 
(rev 316036)
@@ -3,7 +3,7 @@
 dnl config.m4 for mysqlnd driver


-PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed 
protocol support in mysqlnd,
+PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
 Disable support for the MySQL compressed protocol 
in mysqlnd], yes, no)


Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4 2011-09-02 11:22:41 UTC 
(rev 316035)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/config9.m4 2011-09-02 12:59:32 UTC 
(rev 316036)
@@ -3,7 +3,7 @@
 dnl config.m4 for mysqlnd driver


-PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed 
protocol support in mysqlnd,
+PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
 Disable support for the MySQL compressed protocol 
in mysqlnd], yes, no)


Modified: php/php-src/trunk/ext/mysqlnd/config9.m4
===
--- php/php-src/trunk/ext/mysqlnd/config9.m42011-09-02 11:22:41 UTC (rev 
316035)
+++ php/php-src/trunk/ext/mysqlnd/config9.m42011-09-02 12:59:32 UTC (rev 
316036)
@@ -3,7 +3,7 @@
 dnl config.m4 for mysqlnd driver


-PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed 
protocol support in mysqlnd,
+PHP_ARG_ENABLE(mysqlnd_compression_support, whether to disable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
 Disable support for the MySQL compressed protocol 
in mysqlnd], yes, no)


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_s

2011-08-31 Thread Andrey Hristov
andrey   Wed, 31 Aug 2011 18:18:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315911

Log:
Fix valgrind error (sending of initialized bytes over the network).
When the compression was successful the compressed data + uninitialized data
at the end was sent to the server, because the length of the compressed payload
wasn't correctly calculated (actually the length of the uncompressed payload as 
assumed).
However, the uncompress() function has internally the length of the real 
payload and skips
the binary trash at the end - thus no data damage occurs!

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2011-08-31 18:13:04 UTC (rev 315910)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c	2011-08-31 18:18:23 UTC (rev 315911)
@@ -265,7 +265,7 @@
 			STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
 			int3store(uncompressed_payload, to_be_sent);
 			int1store(uncompressed_payload + 3, net-packet_no);
-			if (PASS == net-m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), tmp_complen,
+			if (PASS == net-m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), tmp_complen,
 	   uncompressed_payload, to_be_sent + MYSQLND_HEADER_SIZE TSRMLS_CC))
 			{
 int3store(compress_buf + MYSQLND_HEADER_SIZE, to_be_sent + MYSQLND_HEADER_SIZE);
@@ -491,20 +491,22 @@

 /* {{{ mysqlnd_net::encode */
 static enum_func_status
-MYSQLND_METHOD(mysqlnd_net, encode)(zend_uchar * compress_buffer, size_t compress_buffer_len,
+MYSQLND_METHOD(mysqlnd_net, encode)(zend_uchar * compress_buffer, size_t * compress_buffer_len,
 	const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC)
 {
 #ifdef MYSQLND_COMPRESSION_ENABLED
 	int error;
-	uLongf tmp_complen = compress_buffer_len;
+	uLongf tmp_complen = *compress_buffer_len;
 	DBG_ENTER(mysqlnd_net::encode);
 	error = compress(compress_buffer, tmp_complen, uncompressed_data, uncompressed_data_len);

 	if (error != Z_OK) {
 		DBG_INF_FMT(compression NOT successful. error=%d Z_OK=%d Z_BUF_ERROR=%d Z_MEM_ERROR=%d, error, Z_OK, Z_BUF_ERROR, Z_MEM_ERROR);
 	} else {
+		*compress_buffer_len = tmp_complen;
 		DBG_INF_FMT(compression successful. compressed size=%lu, tmp_complen);
 	}
+
 	DBG_RETURN(error == Z_OK? PASS:FAIL);
 #else
 	DBG_ENTER(mysqlnd_net::encode);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2011-08-31 18:13:04 UTC (rev 315910)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2011-08-31 18:18:23 UTC (rev 315911)
@@ -258,7 +258,7 @@
 typedef enum_func_status	(*func_mysqlnd_net__network_read)(MYSQLND * conn, zend_uchar * buffer, size_t count TSRMLS_DC);
 typedef size_t(*func_mysqlnd_net__network_write)(MYSQLND * const conn, const zend_uchar * const buf, size_t count TSRMLS_DC);
 typedef enum_func_status	(*func_mysqlnd_net__decode)(zend_uchar * uncompressed_data, size_t uncompressed_data_len, const zend_uchar * const compressed_data, size_t compressed_data_len TSRMLS_DC);
-typedef enum_func_status	(*func_mysqlnd_net__encode)(zend_uchar * compress_buffer, size_t compress_buffer_len, const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC);
+typedef enum_func_status	(*func_mysqlnd_net__encode)(zend_uchar * compress_buffer, size_t * compress_buffer_len, const zend_uchar * const uncompressed_data, size_t uncompressed_data_len TSRMLS_DC);
 typedef size_t(*func_mysqlnd_net__consume_uneaten_data)(MYSQLND_NET * const net, enum php_mysqlnd_server_command cmd TSRMLS_DC);
 typedef void(*func_mysqlnd_net__free_contents)(MYSQLND_NET * net TSRMLS_DC);
 typedef enum_func_status	(*func_mysqlnd_net__enable_ssl)(MYSQLND_NET * const net TSRMLS_DC);

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c	2011-08-31 18:13:04 UTC (rev 315910)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c	2011-08-31 18:18:23 UTC (rev 315911)
@@ -272,7 +272,7 @@
 			STORE_HEADER_SIZE(safe_storage, uncompressed_payload);
 			int3store(uncompressed_payload, to_be_sent);
 			int1store(uncompressed_payload + 3, net-packet_no);
-			if (PASS == net-m.encode((compress_buf + COMPRESSED_HEADER_SIZE + 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2011-08-26 Thread Andrey Hristov
andrey   Fri, 26 Aug 2011 12:14:31 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315549

Log:
fix valgrind warnings in debug builds

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-08-26 11:34:18 UTC 
(rev 315548)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-08-26 12:14:31 UTC 
(rev 315549)
@@ -1407,7 +1407,7 @@
char buff[4];

DBG_ENTER(mysqlnd_conn::kill);
-   DBG_INF_FMT(conn=%llu pid=%lu, conn-thread_id, pid);
+   DBG_INF_FMT(conn=%llu pid=%u, conn-thread_id, pid);

int4store(buff, pid);


Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-08-26 11:34:18 UTC 
(rev 315548)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-08-26 12:14:31 UTC 
(rev 315549)
@@ -1523,7 +1523,7 @@
zend_uchar buff[4];

DBG_ENTER(mysqlnd_conn::kill);
-   DBG_INF_FMT(conn=%llu pid=%lu, conn-thread_id, pid);
+   DBG_INF_FMT(conn=%llu pid=%u, conn-thread_id, pid);

int4store(buff, pid);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-08-26 11:34:18 UTC (rev 
315548)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-08-26 12:14:31 UTC (rev 
315549)
@@ -1523,7 +1523,7 @@
zend_uchar buff[4];

DBG_ENTER(mysqlnd_conn::kill);
-   DBG_INF_FMT(conn=%llu pid=%lu, conn-thread_id, pid);
+   DBG_INF_FMT(conn=%llu pid=%u, conn-thread_id, pid);

int4store(buff, pid);


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h branches/PHP_5_4/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h

2011-08-10 Thread Andrey Hristov
andrey   Wed, 10 Aug 2011 14:12:24 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=314740

Log:
relax constraint

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-08-10 14:10:44 UTC 
(rev 314739)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-08-10 14:12:24 UTC 
(rev 314740)
@@ -1288,7 +1288,7 @@

 /* {{{ mysqlnd_conn::escape_string */
 static ulong
-MYSQLND_METHOD(mysqlnd_conn, escape_string)(const MYSQLND * const conn, char 
*newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC)
+MYSQLND_METHOD(mysqlnd_conn, escape_string)(MYSQLND * const conn, char 
*newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC)
 {
DBG_ENTER(mysqlnd_conn::escape_string);
DBG_INF_FMT(conn=%llu, conn-thread_id);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-08-10 
14:10:44 UTC (rev 314739)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-08-10 
14:12:24 UTC (rev 314740)
@@ -338,7 +338,7 @@

 typedef enum_func_status   (*func_mysqlnd_conn__init)(MYSQLND * conn 
TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__connect)(MYSQLND *conn, 
const char *host, const char * user, const char * passwd, unsigned int 
passwd_len, const char * db, unsigned int db_len, unsigned int port, const char 
* socket_or_pipe, unsigned int mysql_flags TSRMLS_DC);
-typedef ulong  
(*func_mysqlnd_conn__escape_string)(const MYSQLND * const conn, char *newstr, 
const char *escapestr, size_t escapestr_len TSRMLS_DC);
+typedef ulong  
(*func_mysqlnd_conn__escape_string)(MYSQLND * const conn, char *newstr, const 
char *escapestr, size_t escapestr_len TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__set_charset)(MYSQLND * 
const conn, const char * const charset TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__query)(MYSQLND *conn, 
const char *query, unsigned int query_len TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__send_query)(MYSQLND *conn, 
const char *query, unsigned int query_len TSRMLS_DC);

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-08-10 14:10:44 UTC 
(rev 314739)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-08-10 14:12:24 UTC 
(rev 314740)
@@ -1404,7 +1404,7 @@

 /* {{{ mysqlnd_conn::escape_string */
 static ulong
-MYSQLND_METHOD(mysqlnd_conn, escape_string)(const MYSQLND * const conn, char 
*newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC)
+MYSQLND_METHOD(mysqlnd_conn, escape_string)(MYSQLND * const conn, char 
*newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC)
 {
DBG_ENTER(mysqlnd_conn::escape_string);
DBG_INF_FMT(conn=%llu, conn-thread_id);

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h  2011-08-10 
14:10:44 UTC (rev 314739)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_structs.h  2011-08-10 
14:12:24 UTC (rev 314740)
@@ -352,7 +352,7 @@

 typedef enum_func_status   (*func_mysqlnd_conn__init)(MYSQLND * conn 
TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__connect)(MYSQLND *conn, 
const char *host, const char * user, const char * passwd, unsigned int 
passwd_len, const char * db, unsigned int db_len, unsigned int port, const char 
* socket_or_pipe, unsigned int mysql_flags TSRMLS_DC);
-typedef ulong  
(*func_mysqlnd_conn__escape_string)(const MYSQLND * const conn, char *newstr, 
const char *escapestr, size_t escapestr_len TSRMLS_DC);
+typedef ulong  
(*func_mysqlnd_conn__escape_string)(MYSQLND * const conn, char *newstr, const 
char *escapestr, size_t escapestr_len TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__set_charset)(MYSQLND * 
const conn, const char * const charset TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__query)(MYSQLND *conn, 
const char *query, unsigned int query_len TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__send_query)(MYSQLND *conn, 
const char *query, 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2011-07-27 Thread Andrey Hristov
andrey   Wed, 27 Jul 2011 10:26:59 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=313767

Log:
longer error messages, don't cut them

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-07-27 09:41:33 UTC 
(rev 313766)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-07-27 10:26:59 UTC 
(rev 313767)
@@ -831,9 +831,9 @@
PACKET_FREE(greet_packet);

if (errstr) {
-   DBG_ERR_FMT([%u] %.64s (trying to connect via %s), errcode, 
errstr, conn-scheme);
+   DBG_ERR_FMT([%u] %.128s (trying to connect via %s), errcode, 
errstr, conn-scheme);
SET_CLIENT_ERROR(conn-error_info, errcode? 
errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr);
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.64s (trying 
to connect via %s), errcode, errstr, conn-scheme);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.128s 
(trying to connect via %s), errcode, errstr, conn-scheme);
/* no mnd_ since we don't allocate it */
efree(errstr);
}

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-07-27 09:41:33 UTC 
(rev 313766)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-07-27 10:26:59 UTC 
(rev 313767)
@@ -931,9 +931,9 @@
PACKET_FREE(greet_packet);

if (errstr) {
-   DBG_ERR_FMT([%u] %.64s (trying to connect via %s), errcode, 
errstr, conn-scheme);
+   DBG_ERR_FMT([%u] %.128s (trying to connect via %s), errcode, 
errstr, conn-scheme);
SET_CLIENT_ERROR(conn-error_info, errcode? 
errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr);
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.64s (trying 
to connect via %s), errcode, errstr, conn-scheme);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.128s 
(trying to connect via %s), errcode, errstr, conn-scheme);
/* no mnd_ since we don't allocate it */
efree(errstr);
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-27 09:41:33 UTC (rev 
313766)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-27 10:26:59 UTC (rev 
313767)
@@ -931,9 +931,9 @@
PACKET_FREE(greet_packet);

if (errstr) {
-   DBG_ERR_FMT([%u] %.64s (trying to connect via %s), errcode, 
errstr, conn-scheme);
+   DBG_ERR_FMT([%u] %.128s (trying to connect via %s), errcode, 
errstr, conn-scheme);
SET_CLIENT_ERROR(conn-error_info, errcode? 
errcode:CR_CONNECTION_ERROR, UNKNOWN_SQLSTATE, errstr);
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.64s (trying 
to connect via %s), errcode, errstr, conn-scheme);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, [%u] %.128s 
(trying to connect via %s), errcode, errstr, conn-scheme);
/* no mnd_ since we don't allocate it */
efree(errstr);
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2011-07-05 Thread Andrey Hristov
andrey   Tue, 05 Jul 2011 20:31:53 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=312953

Log:
free data in case of failure in the callee not in the caller

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-07-05 20:10:45 UTC 
(rev 312952)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-07-05 20:31:53 UTC 
(rev 312953)
@@ -156,6 +156,7 @@
mnd_pefree(conn-unix_socket, pers);
conn-unix_socket = NULL;
}
+   DBG_INF_FMT(scheme=%s, conn-scheme);
if (conn-scheme) {
DBG_INF(Freeing scheme);
mnd_pefree(conn-scheme, pers);
@@ -635,7 +636,7 @@
SET_OOM_ERROR(conn-error_info);
goto err; /* OOM */
}
-   DBG_INF_FMT(transport=%s, transport);
+   DBG_INF_FMT(transport=%s conn-scheme=%s, transport, 
conn-scheme);
conn-scheme = mnd_pestrndup(transport, transport_len, 
conn-persistent);
conn-scheme_len = transport_len;
efree(transport); /* allocated by spprintf */
@@ -836,7 +837,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+   conn-m-free_contents(conn TSRMLS_CC);
MYSQLND_INC_CONN_STATISTIC(conn-stats, STAT_CONNECT_FAILURE);

DBG_RETURN(FAIL);
@@ -877,9 +878,6 @@
  object - we are free to kill it!
*/
conn-m-dtor(conn TSRMLS_CC);
-   } else {
-   /* This will also close conn-net-stream if it has 
been opened */
-   conn-m-free_contents(conn TSRMLS_CC);
}
DBG_RETURN(NULL);
}

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-07-05 20:10:45 UTC 
(rev 312952)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-07-05 20:31:53 UTC 
(rev 312953)
@@ -157,6 +157,7 @@
mnd_pefree(conn-unix_socket, pers);
conn-unix_socket = NULL;
}
+   DBG_INF_FMT(scheme=%s, conn-scheme);
if (conn-scheme) {
mnd_pefree(conn-scheme, pers);
conn-scheme = NULL;
@@ -717,7 +718,7 @@
SET_OOM_ERROR(conn-error_info);
goto err; /* OOM */
}
-   DBG_INF_FMT(transport=%s, transport);
+   DBG_INF_FMT(transport=%s conn-scheme=%s, transport, 
conn-scheme);
conn-scheme = mnd_pestrndup(transport, transport_len, 
conn-persistent);
conn-scheme_len = transport_len;
mnd_sprintf_free(transport);
@@ -936,7 +937,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+   conn-m-free_contents(conn TSRMLS_CC);
MYSQLND_INC_CONN_STATISTIC(conn-stats, STAT_CONNECT_FAILURE);

DBG_RETURN(FAIL);
@@ -977,9 +978,6 @@
  object - we are free to kill it!
*/
conn-m-dtor(conn TSRMLS_CC);
-   } else {
-   /* This will also close conn-net-stream if it has 
been opened */
-   conn-m-free_contents(conn TSRMLS_CC);
}
DBG_RETURN(NULL);
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-05 20:10:45 UTC (rev 
312952)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2011-07-05 20:31:53 UTC (rev 
312953)
@@ -157,6 +157,7 @@
mnd_pefree(conn-unix_socket, pers);
conn-unix_socket = NULL;
}
+   DBG_INF_FMT(scheme=%s, conn-scheme);
if (conn-scheme) {
mnd_pefree(conn-scheme, pers);
conn-scheme = NULL;
@@ -717,7 +718,7 @@
SET_OOM_ERROR(conn-error_info);
goto err; /* OOM */
}
-   DBG_INF_FMT(transport=%s, transport);
+   DBG_INF_FMT(transport=%s conn-scheme=%s, transport, 
conn-scheme);
conn-scheme = mnd_pestrndup(transport, transport_len, 
conn-persistent);
conn-scheme_len = transport_len;
mnd_sprintf_free(transport);
@@ -936,7 +937,7 @@
/* no mnd_ since we don't allocate it */
efree(errstr);
}
-
+   

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h trunk/ext/mysqlnd/mysqlnd_priv.h

2011-05-31 Thread Andrey Hristov
andrey   Tue, 31 May 2011 10:35:07 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311643

Log:
fix macros

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h 2011-05-31 
10:31:23 UTC (rev 311642)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h 2011-05-31 
10:35:07 UTC (rev 311643)
@@ -113,7 +113,7 @@
if ((message)) { \
(buf) = mnd_pestrndup((message), (len), (persistent)); \
} else { \
-   buf = NULL; \
+   (buf) = NULL; \
} \
(buf_len) = (len); \
}
@@ -130,22 +130,22 @@

 #define SET_EMPTY_ERROR(error_info) \
{ \
-   error_info.error_no = 0; \
-   error_info.error[0] = '\0'; \
-   strlcpy(error_info.sqlstate, 0, 
sizeof(error_info.sqlstate)); \
+   (error_info).error_no = 0; \
+   (error_info).error[0] = '\0'; \
+   strlcpy((error_info).sqlstate, 0, 
sizeof((error_info).sqlstate)); \
}

 #define SET_CLIENT_ERROR(error_info, a, b, c) \
{ \
-   error_info.error_no = (a); \
-   strlcpy(error_info.sqlstate, (b), sizeof(error_info.sqlstate)); 
\
-   strlcpy(error_info.error, (c), sizeof(error_info.error)); \
+   (error_info).error_no = (a); \
+   strlcpy((error_info).sqlstate, (b), 
sizeof((error_info).sqlstate)); \
+   strlcpy((error_info).error, (c), sizeof((error_info).error)); \
}

-#define SET_OOM_ERROR(error_info) SET_CLIENT_ERROR(error_info, 
CR_OUT_OF_MEMORY, UNKNOWN_SQLSTATE, mysqlnd_out_of_memory)
+#define SET_OOM_ERROR(error_info) SET_CLIENT_ERROR((error_info), 
CR_OUT_OF_MEMORY, UNKNOWN_SQLSTATE, mysqlnd_out_of_memory)


-#define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR(stmt-error_info, a, 
b, c)
+#define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR((stmt)-error_info, a, 
b, c)


 #ifdef ZTS
@@ -153,7 +153,7 @@
 #define CONN_SET_STATE(c, s)   (c)-m-set_state((c), (s) TSRMLS_CC)
 #else
 #define CONN_GET_STATE(c)  ((c)-state)
-#define CONN_SET_STATE(c, s)   ((c)-state = s)
+#define CONN_SET_STATE(c, s)   ((c)-state = (s))
 #endif



Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h 2011-05-31 
10:31:23 UTC (rev 311642)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_priv.h 2011-05-31 
10:35:07 UTC (rev 311643)
@@ -114,7 +114,7 @@
if ((message)) { \
(buf) = mnd_pestrndup((message), (len), (persistent)); \
} else { \
-   buf = NULL; \
+   (buf) = NULL; \
} \
(buf_len) = (len); \
}
@@ -131,22 +131,22 @@

 #define SET_EMPTY_ERROR(error_info) \
{ \
-   error_info.error_no = 0; \
-   error_info.error[0] = '\0'; \
-   strlcpy(error_info.sqlstate, 0, 
sizeof(error_info.sqlstate)); \
+   (error_info).error_no = 0; \
+   (error_info).error[0] = '\0'; \
+   strlcpy((error_info).sqlstate, 0, 
sizeof((error_info).sqlstate)); \
}

 #define SET_CLIENT_ERROR(error_info, a, b, c) \
{ \
-   error_info.error_no = (a); \
-   strlcpy(error_info.sqlstate, (b), sizeof(error_info.sqlstate)); 
\
-   strlcpy(error_info.error, (c), sizeof(error_info.error)); \
+   (error_info).error_no = (a); \
+   strlcpy((error_info).sqlstate, (b), 
sizeof((error_info).sqlstate)); \
+   strlcpy((error_info).error, (c), sizeof((error_info).error)); \
}

-#define SET_OOM_ERROR(error_info) SET_CLIENT_ERROR(error_info, 
CR_OUT_OF_MEMORY, UNKNOWN_SQLSTATE, mysqlnd_out_of_memory)
+#define SET_OOM_ERROR(error_info) SET_CLIENT_ERROR((error_info), 
CR_OUT_OF_MEMORY, UNKNOWN_SQLSTATE, mysqlnd_out_of_memory)


-#define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR(stmt-error_info, a, 
b, c)
+#define SET_STMT_ERROR(stmt, a, b, c)  SET_CLIENT_ERROR((stmt)-error_info, a, 
b, c)


 #ifdef ZTS
@@ -154,7 +154,7 @@
 #define CONN_SET_STATE(c, s)   (c)-m-set_state((c), (s) TSRMLS_CC)
 #else
 #define CONN_GET_STATE(c)  ((c)-state)
-#define CONN_SET_STATE(c, s)   ((c)-state = s)
+#define CONN_SET_STATE(c, s)   ((c)-state = (s))
 #endif



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_4/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2011-05-31 Thread Andrey Hristov
andrey   Tue, 31 May 2011 20:42:44 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311676

Log:
reuse code

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-05-31 19:04:52 UTC 
(rev 311675)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-05-31 20:42:44 UTC 
(rev 311676)
@@ -896,25 +896,18 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, query)(MYSQLND * conn, const char * query, 
unsigned int query_len TSRMLS_DC)
 {
-   enum_func_status ret;
+   enum_func_status ret = FAIL;
DBG_ENTER(mysqlnd_conn::query);
DBG_INF_FMT(conn=%llu query=%s, conn-thread_id, query);

-   if (PASS != conn-m-simple_command(conn, COM_QUERY, query, query_len,
-  
PROT_LAST /* we will handle the OK packet*/,
-  
FALSE, FALSE TSRMLS_CC)) {
-   DBG_RETURN(FAIL);
+   if (PASS == conn-m-send_query(conn, query, query_len TSRMLS_CC) 
+   PASS == conn-m-reap_query(conn TSRMLS_CC))
+   {
+   ret = PASS;
+   if (conn-last_query_type == QUERY_UPSERT  
conn-upsert_status.affected_rows) {
+   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, 
STAT_ROWS_AFFECTED_NORMAL, conn-upsert_status.affected_rows);
+   }
}
-   CONN_SET_STATE(conn, CONN_QUERY_SENT);
-   /*
- Here read the result set. We don't do it in simple_command because it 
need
- information from the ok packet. We will fetch it ourselves.
-   */
-   ret = conn-m-query_read_result_set_header(conn, NULL TSRMLS_CC);
-   if (ret == PASS  conn-last_query_type == QUERY_UPSERT  
conn-upsert_status.affected_rows) {
-   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, 
STAT_ROWS_AFFECTED_NORMAL, conn-upsert_status.affected_rows);
-   }
-
DBG_RETURN(ret);
 }
 /* }}} */
@@ -931,7 +924,9 @@
ret = conn-m-simple_command(conn, COM_QUERY, query, query_len,
 PROT_LAST /* 
we will handle the OK packet*/,
 FALSE, FALSE 
TSRMLS_CC);
-   CONN_SET_STATE(conn, CONN_QUERY_SENT);
+   if (PASS == ret) {
+   CONN_SET_STATE(conn, CONN_QUERY_SENT);
+   }
DBG_RETURN(ret);
 }
 /* }}} */
@@ -950,6 +945,10 @@
DBG_ERR_FMT(Connection not opened, clear or has been closed. 
State=%u, state);
DBG_RETURN(FAIL);
}
+   /*
+ Here read the result set. We don't do it in simple_command because it 
need
+ information from the ok packet. We will fetch it ourselves.
+   */
DBG_RETURN(conn-m-query_read_result_set_header(conn, NULL TSRMLS_CC));
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-05-31 19:04:52 UTC 
(rev 311675)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd.c  2011-05-31 20:42:44 UTC 
(rev 311676)
@@ -996,25 +996,18 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, query)(MYSQLND * conn, const char * query, 
unsigned int query_len TSRMLS_DC)
 {
-   enum_func_status ret;
+   enum_func_status ret = FAIL;
DBG_ENTER(mysqlnd_conn::query);
DBG_INF_FMT(conn=%llu query=%s, conn-thread_id, query);

-   if (PASS != conn-m-simple_command(conn, COM_QUERY, (zend_uchar *) 
query, query_len,
-  
PROT_LAST /* we will handle the OK packet*/,
-  
FALSE, FALSE TSRMLS_CC)) {
-   DBG_RETURN(FAIL);
+   if (PASS == conn-m-send_query(conn, query, query_len TSRMLS_CC) 
+   PASS == conn-m-reap_query(conn TSRMLS_CC))
+   {
+   ret = PASS;
+   if (conn-last_query_type == QUERY_UPSERT  
conn-upsert_status.affected_rows) {
+   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, 
STAT_ROWS_AFFECTED_NORMAL, conn-upsert_status.affected_rows);
+   }
}
-   CONN_SET_STATE(conn, CONN_QUERY_SENT);
-   /*
- Here read the result set. We don't do it in simple_command because it 
need
- information from the ok packet. We will fetch it ourselves.
-   */
-   ret = conn-m-query_read_result_set_header(conn, NULL TSRMLS_CC);
-   if (ret == PASS  conn-last_query_type == 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-05-17 Thread Andrey Hristov
andrey   Tue, 17 May 2011 09:44:11 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311122

Log:
exchange a trap with an error

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-05-17 
05:16:29 UTC (rev 311121)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-05-17 
09:44:11 UTC (rev 311122)
@@ -1583,7 +1583,7 @@
} else if (result-m.fetch_row == 
result-m.fetch_row_normal_unbuffered) {
DBG_RETURN(mysqlnd_fetch_row_unbuffered_c(result 
TSRMLS_CC));
} else {
-   *((int*)NULL) = 1;
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
result-m.fetch_row has invalid value. Report to the developers);
}
}
DBG_RETURN(ret);

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_result.c   2011-05-17 
05:16:29 UTC (rev 311121)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_result.c   2011-05-17 
09:44:11 UTC (rev 311122)
@@ -1546,7 +1546,7 @@
} else if (result-m.fetch_row == 
result-m.fetch_row_normal_unbuffered) {
DBG_RETURN(mysqlnd_fetch_row_unbuffered_c(result 
TSRMLS_CC));
} else {
-   *((int*)NULL) = 1;
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
result-m.fetch_row has invalid value. Report to the developers);
}
}
DBG_RETURN(ret);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-05-17 05:16:29 UTC 
(rev 311121)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-05-17 09:44:11 UTC 
(rev 311122)
@@ -1546,7 +1546,7 @@
} else if (result-m.fetch_row == 
result-m.fetch_row_normal_unbuffered) {
DBG_RETURN(mysqlnd_fetch_row_unbuffered_c(result 
TSRMLS_CC));
} else {
-   *((int*)NULL) = 1;
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, 
result-m.fetch_row has invalid value. Report to the developers);
}
}
DBG_RETURN(ret);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2011-05-16 Thread Johannes Schlüter
johannes Mon, 16 May 2011 10:15:28 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311072

Log:
- Move the access behind the check.
# I can't find an unsafe call, but let's play safe

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2011-05-16 
08:08:34 UTC (rev 311071)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2011-05-16 
10:15:28 UTC (rev 311072)
@@ -906,11 +906,11 @@
 PHPAPI void
 mysqlnd_net_free(MYSQLND_NET * const net TSRMLS_DC)
 {
-   zend_bool pers = net-persistent;
-
DBG_ENTER(mysqlnd_net_free);

if (net) {
+   zend_bool pers = net-persistent;
+
net-m.free_contents(net TSRMLS_CC);
if (net-cmd_buffer.buffer) {
DBG_INF(Freeing cmd buffer);

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c  2011-05-16 
08:08:34 UTC (rev 311071)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_net.c  2011-05-16 
10:15:28 UTC (rev 311072)
@@ -905,11 +905,11 @@
 PHPAPI void
 mysqlnd_net_free(MYSQLND_NET * const net TSRMLS_DC)
 {
-   zend_bool pers = net-persistent;
-
DBG_ENTER(mysqlnd_net_free);

if (net) {
+   zend_bool pers = net-persistent;
+
net-m.free_contents(net TSRMLS_CC);
if (net-cmd_buffer.buffer) {
DBG_INF(Freeing cmd buffer);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-05-16 08:08:34 UTC (rev 
311071)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-05-16 10:15:28 UTC (rev 
311072)
@@ -905,11 +905,11 @@
 PHPAPI void
 mysqlnd_net_free(MYSQLND_NET * const net TSRMLS_DC)
 {
-   zend_bool pers = net-persistent;
-
DBG_ENTER(mysqlnd_net_free);

if (net) {
+   zend_bool pers = net-persistent;
+
net-m.free_contents(net TSRMLS_CC);
if (net-cmd_buffer.buffer) {
DBG_INF(Freeing cmd buffer);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2011-05-16 Thread Johannes Schlüter
johannes Tue, 17 May 2011 00:16:57 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=311120

Log:
- Move the field access behind the check
# Only called from one place where the connection is checked, but
# playing safe, again (parfait)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-05-16 23:43:12 UTC (rev 39)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-05-17 00:16:57 UTC (rev 311120)
@@ -2112,11 +2112,10 @@
 PHPAPI void
 mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
 {
-   zend_bool pers = protocol-persistent;
-
DBG_ENTER(mysqlnd_protocol_free);

if (protocol) {
+   zend_bool pers = protocol-persistent;
mnd_pefree(protocol, pers);
}
DBG_VOID_RETURN;

Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-05-16 23:43:12 UTC (rev 39)
+++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-05-17 00:16:57 UTC (rev 311120)
@@ -2380,11 +2380,10 @@
 PHPAPI void
 mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
 {
-   zend_bool pers = protocol-persistent;
-
DBG_ENTER(mysqlnd_protocol_free);

if (protocol) {
+   zend_bool pers = protocol-persistent;
mnd_pefree(protocol, pers);
}
DBG_VOID_RETURN;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2011-05-16 
23:43:12 UTC (rev 39)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2011-05-17 
00:16:57 UTC (rev 311120)
@@ -2380,11 +2380,10 @@
 PHPAPI void
 mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
 {
-   zend_bool pers = protocol-persistent;
-
DBG_ENTER(mysqlnd_protocol_free);

if (protocol) {
+   zend_bool pers = protocol-persistent;
mnd_pefree(protocol, pers);
}
DBG_VOID_RETURN;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2011-05-10 Thread Andrey Hristov
andrey   Tue, 10 May 2011 07:15:22 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=310876

Log:
Fix range
(thanks again nihen)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:06:29 UTC (rev 310875)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:15:22 UTC (rev 310876)
@@ -327,7 +327,7 @@

 /* {{{  functions */
 #define valid_sjis_head(c) ((0x81 = (c)  (c) = 0x9F) || (0xE0 = (c) 
 (c) = 0xFC))
-#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0x7C))
+#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:06:29 UTC 
(rev 310875)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:15:22 UTC 
(rev 310876)
@@ -328,7 +328,7 @@

 /* {{{ sjis functions */
 #define valid_sjis_head(c) ((0x81 = (c)  (c) = 0x9F) || (0xE0 = (c) 
 (c) = 0xFC))
-#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0x7C))
+#define valid_sjis_tail(c) ((0x40 = (c)  (c) = 0x7E) || (0x80 = (c) 
 (c) = 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2011-05-04 Thread Andrey Hristov
andrey   Wed, 04 May 2011 19:09:12 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=310768

Log:
add the BLOCK_LEAVE macro for non-gcc and non-win

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:05:19 UTC (rev 310767)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:09:12 UTC (rev 310768)
@@ -136,9 +136,10 @@
 static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
-#define DBG_RETURN_EX(dbg_obj, value) return (value)
-#define DBG_VOID_RETURN_EX(dbg_obj) return
-#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN_EX(dbg_obj, value)  return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj)return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj)}

 #endif /* defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400)) */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:05:19 UTC 
(rev 310767)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:09:12 UTC 
(rev 310768)
@@ -147,9 +147,10 @@
 static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
-#define DBG_RETURN_EX(dbg_obj, value) return (value)
-#define DBG_VOID_RETURN_EX(dbg_obj) return
-#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN_EX(dbg_obj, value)  return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj)return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj)}

 #endif


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2011-05-04 Thread Andrey Hristov
andrey   Wed, 04 May 2011 19:05:19 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=310767

Log:
reorganize the DBG_ macros, add DBG_BLOCK_XXX

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
18:14:25 UTC (rev 310766)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:05:19 UTC (rev 310767)
@@ -90,6 +90,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)
 #define DBG_ERR_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, error: , 
__VA_ARGS__); } while (0)

+#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \
+   { \
+   DBG_ENTER_EX(dbg_obj, (block_name));
+
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) \
+   DBG_LEAVE_EX((dbg_obj), ;) \
+   } \
+
+
 #define DBG_ENTER_EX(dbg_obj, func_name) \
struct timeval __dbg_prof_tp = {0}; \
uint64_t __dbg_prof_start = 0; /* 
initialization is needed */ \
@@ -103,7 +112,7 @@
} \
} while (0);

-#define DBG_RETURN_EX(dbg_obj, value)  \
+#define DBG_LEAVE_EX(dbg_obj, leave)   \
do {\
if ((dbg_obj)) { \
uint64_t this_call_duration = 0; \
@@ -112,20 +121,15 @@
} \
(dbg_obj)-m-func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
} \
-   return (value);\
-   } while (0)
-#define DBG_VOID_RETURN_EX(dbg_obj)\
-   do {\
-   if ((dbg_obj)) { \
-   uint64_t this_call_duration = 0; \
-   if ((dbg_obj)-flags  
MYSQLND_DEBUG_PROFILE_CALLS) { \
-   
DBG_PROFILE_END_TIME(this_call_duration); \
-   } \
-   (dbg_obj)-m-func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
-   } \
-   return;\
-   } while (0)
+   leave \
+   } while (0);

+#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);)
+
+#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;)
+
+
+
 #else
 static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
 static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
@@ -134,6 +138,7 @@
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;

 #endif /* defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400)) */

@@ -145,8 +150,10 @@
 #define DBG_ERR_FMT(...)   DBG_ERR_FMT_EX(MYSQLND_G(dbg), __VA_ARGS__)

 #define DBG_ENTER(func_name)   DBG_ENTER_EX(MYSQLND_G(dbg), (func_name))
+#define DBG_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX(MYSQLND_G(dbg), (bname))
 #define DBG_RETURN(value)  DBG_RETURN_EX(MYSQLND_G(dbg), (value))
 #define DBG_VOID_RETURN
DBG_VOID_RETURN_EX(MYSQLND_G(dbg))
+#define DBG_BLOCK_LEAVE
DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg))

 #elif MYSQLND_DBG_ENABLED == 0

@@ -157,8 +164,10 @@
 static inline void DBG_INF_FMT(const char * const format, ...) {}
 static inline void DBG_ERR_FMT(const char * const format, ...) {}
 static inline void DBG_ENTER(const char * const func_name) {}
-#define DBG_RETURN(value)  return (value)
-#define DBG_VOID_RETURNreturn
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN(value)  return (value)
+#define DBG_VOID_RETURNreturn
+#define DBG_BLOCK_LEAVE}

 #endif


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 18:14:25 UTC 
(rev 310766)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:05:19 UTC 
(rev 310767)
@@ -101,6 +101,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.h

2011-05-03 Thread Andrey Hristov
andrey   Tue, 03 May 2011 09:37:53 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=310735

Log:
extend the API in the backward compatible way

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-05-03 09:11:07 UTC 
(rev 310734)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-05-03 09:37:53 UTC 
(rev 310735)
@@ -27,6 +27,7 @@

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0
+#define AUTOCOMMIT_TX_COMMIT_ROLLBACK

 #define MYSQLND_STRING_TO_INT_CONVERSION
 /*

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/config9.m4 branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/config9.m4 trunk/ext/mysqlnd/mysqlnd.h

2011-03-23 Thread Andrey Hristov
andrey   Wed, 23 Mar 2011 17:14:28 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309609

Log:
Fix compressed build, make it easier

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/config9.m4
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-03-23 16:37:19 UTC 
(rev 309608)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-03-23 17:14:28 UTC 
(rev 309609)
@@ -3,9 +3,9 @@
 dnl config.m4 for mysqlnd driver


-PHP_ARG_ENABLE(disable_mysqlnd_compression_support, whether to disable 
compressed protocol support in mysqlnd,
+PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
-Disable support for the MySQL compressed protocol 
in mysqlnd], yes)
+Disable support for the MySQL compressed protocol 
in mysqlnd], yes, no)

 if test -z $PHP_ZLIB_DIR; then
   PHP_ARG_WITH(zlib-dir, for the location of libz,
@@ -14,26 +14,22 @@

 dnl If some extension uses mysqlnd it will get compiled in PHP core
 if test $PHP_MYSQLND_ENABLED = yes; then
-  mysqlnd_sources=mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \
-   mysqlnd_ps.c mysqlnd_loaddata.c mysqlnd_net.c \
-   mysqlnd_ps_codec.c mysqlnd_statistics.c \
+  mysqlnd_ps_sources=mysqlnd_ps.c mysqlnd_ps_codec.c
+  mysqlnd_base_sources=mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \
+   mysqlnd_loaddata.c mysqlnd_net.c mysqlnd_statistics.c \
   mysqlnd_result.c mysqlnd_result_meta.c 
mysqlnd_debug.c\
   mysqlnd_block_alloc.c php_mysqlnd.c

-  PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, no)
-  PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
-  PHP_INSTALL_HEADERS([ext/mysqlnd/])

-  dnl Windows uses config.w32 thus this code is safe for now
-
   if test $PHP_MYSQLND_COMPRESSION_SUPPORT != no; then
-if test -z $PHP_ZLIB_DIR; then
-  AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol 
support])
-  PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQLND_SHARED_LIBADD)
-  MYSQLND_LIBS=$MYSQLND_LIBS -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz
-fi
+AC_DEFINE([MYSQLND_COMPRESSION_WANTED], 1, [Enable compressed protocol 
support])
   fi
   AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable SSL support])
+
+  mysqlnd_sources=$mysqlnd_base_sources $mysqlnd_ps_sources
+  PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, no)
+  PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
+  PHP_INSTALL_HEADERS([ext/mysqlnd/])
 fi

 if test $PHP_MYSQLND_ENABLED = yes || test $PHP_MYSQLI != no; then

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-03-23 16:37:19 UTC 
(rev 309608)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-03-23 17:14:28 UTC 
(rev 309609)
@@ -50,6 +50,10 @@
 #define MYSQLND_DBG_ENABLED 0
 #endif

+#if defined(MYSQLND_COMPRESSION_WANTED)  defined(HAVE_ZLIB)
+#define MYSQLND_COMPRESSION_ENABLED 1
+#endif
+
 #ifdef ZTS
 #include TSRM.h
 #endif

Modified: php/php-src/trunk/ext/mysqlnd/config9.m4
===
--- php/php-src/trunk/ext/mysqlnd/config9.m42011-03-23 16:37:19 UTC (rev 
309608)
+++ php/php-src/trunk/ext/mysqlnd/config9.m42011-03-23 17:14:28 UTC (rev 
309609)
@@ -3,9 +3,9 @@
 dnl config.m4 for mysqlnd driver


-PHP_ARG_ENABLE(disable_mysqlnd_compression_support, whether to disable 
compressed protocol support in mysqlnd,
+PHP_ARG_ENABLE(mysqlnd_compression_support, whether to enable compressed 
protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
-Disable support for the MySQL compressed protocol 
in mysqlnd], yes)
+Disable support for the MySQL compressed protocol 
in mysqlnd], yes, no)

 if test -z $PHP_ZLIB_DIR; then
   PHP_ARG_WITH(zlib-dir, for the location of libz,
@@ -14,26 +14,23 @@

 dnl If some extension uses mysqlnd it will get compiled in PHP core
 if test $PHP_MYSQLND_ENABLED = yes; then
-  mysqlnd_sources=mysqlnd.c mysqlnd_alloc.c mysqlnd_bt.c mysqlnd_charset.c 
mysqlnd_wireprotocol.c \
-   mysqlnd_ps.c mysqlnd_loaddata.c mysqlnd_net.c \
-   mysqlnd_ps_codec.c mysqlnd_statistics.c mysqlnd_auth.c \
+  mysqlnd_ps_sources=mysqlnd_ps.c mysqlnd_ps_codec.c
+  mysqlnd_base_sources=mysqlnd.c mysqlnd_alloc.c mysqlnd_bt.c 
mysqlnd_charset.c mysqlnd_wireprotocol.c \
+   mysqlnd_loaddata.c mysqlnd_net.c \
+  

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 12:22:16 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309553

Log:
remove unneeded includes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2011-03-22 
11:51:01 UTC (rev 309552)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2011-03-22 
12:22:16 UTC (rev 309553)
@@ -24,7 +24,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include mysqlnd_debug.h
-#include mysqlnd_block_alloc.h
 #include ext/standard/sha1.h
 #include php_network.h
 #include zend_ini.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-03-22 11:51:01 UTC (rev 309552)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2011-03-22 12:22:16 UTC (rev 309553)
@@ -24,7 +24,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include mysqlnd_debug.h
-#include mysqlnd_block_alloc.h
 #include ext/standard/sha1.h
 #include zend_ini.h


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-03-22 11:51:01 UTC (rev 
309552)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2011-03-22 12:22:16 UTC (rev 
309553)
@@ -24,7 +24,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include mysqlnd_debug.h
-#include mysqlnd_block_alloc.h
 #include ext/standard/sha1.h
 #include php_network.h
 #include zend_ini.h

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2011-03-22 
11:51:01 UTC (rev 309552)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2011-03-22 
12:22:16 UTC (rev 309553)
@@ -24,7 +24,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include mysqlnd_debug.h
-#include mysqlnd_block_alloc.h
 #include zend_ini.h

 #define MYSQLND_SILENT 1

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 12:54:02 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309557

Log:
remove more unneeded includes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
12:53:59 UTC (rev 309556)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
12:54:02 UTC (rev 309557)
@@ -27,9 +27,7 @@
 #include mysqlnd_result.h
 #include mysqlnd_result_meta.h
 #include mysqlnd_statistics.h
-#include mysqlnd_charset.h
 #include mysqlnd_debug.h
-#include ext/standard/basic_functions.h

 #define MYSQLND_SILENT


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 12:53:59 UTC 
(rev 309556)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 12:54:02 UTC 
(rev 309557)
@@ -27,9 +27,7 @@
 #include mysqlnd_result.h
 #include mysqlnd_result_meta.h
 #include mysqlnd_statistics.h
-#include mysqlnd_charset.h
 #include mysqlnd_debug.h
-#include ext/standard/basic_functions.h

 #define MYSQLND_SILENT


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/config9.m4 trunk/ext/mysqlnd/config9.m4

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 14:39:36 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309561

Log:
Fix message

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
U   php/php-src/trunk/ext/mysqlnd/config9.m4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-03-22 14:10:35 UTC 
(rev 309560)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2011-03-22 14:39:36 UTC 
(rev 309561)
@@ -5,7 +5,7 @@

 PHP_ARG_ENABLE(disable_mysqlnd_compression_support, whether to disable 
compressed protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
-Enable support for the MySQL compressed protocol 
in mysqlnd], yes)
+Disable support for the MySQL compressed protocol 
in mysqlnd], yes)

 if test -z $PHP_ZLIB_DIR; then
   PHP_ARG_WITH(zlib-dir, for the location of libz,

Modified: php/php-src/trunk/ext/mysqlnd/config9.m4
===
--- php/php-src/trunk/ext/mysqlnd/config9.m42011-03-22 14:10:35 UTC (rev 
309560)
+++ php/php-src/trunk/ext/mysqlnd/config9.m42011-03-22 14:39:36 UTC (rev 
309561)
@@ -5,7 +5,7 @@

 PHP_ARG_ENABLE(disable_mysqlnd_compression_support, whether to disable 
compressed protocol support in mysqlnd,
 [  --disable-mysqlnd-compression-support
-Enable support for the MySQL compressed protocol 
in mysqlnd], yes)
+Disable support for the MySQL compressed protocol 
in mysqlnd], yes)

 if test -z $PHP_ZLIB_DIR; then
   PHP_ARG_WITH(zlib-dir, for the location of libz,

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 14:39:58 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=309562

Log:
palloc is long dead, use more appropriate name

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
14:39:36 UTC (rev 309561)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
14:39:58 UTC (rev 309562)
@@ -84,11 +84,11 @@
 /* }}} */


-/* {{{ mysqlnd_palloc_zval_ptr_dtor */
-static
-void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, 
zend_bool * copy_ctor_called TSRMLS_DC)
+/* {{{ mysqlnd_rset_zval_ptr_dtor */
+static void
+mysqlnd_rset_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bool * 
copy_ctor_called TSRMLS_DC)
 {
-   DBG_ENTER(mysqlnd_palloc_zval_ptr_dtor);
+   DBG_ENTER(mysqlnd_rset_zval_ptr_dtor);
if (!zv || !*zv) {
*copy_ctor_called = FALSE;
DBG_ERR_FMT(zv was NULL);
@@ -158,7 +158,7 @@

DBG_INF_FMT(%u columns to free, result-field_count);
for (i = 0; i  result-field_count; i++) {
-   
mysqlnd_palloc_zval_ptr_dtor((unbuf-last_row_data[i]), result-type, 
copy_ctor_called TSRMLS_CC);
+   mysqlnd_rset_zval_ptr_dtor((unbuf-last_row_data[i]), 
result-type, copy_ctor_called TSRMLS_CC);
if (copy_ctor_called) {
++ctor_called_count;
}
@@ -212,7 +212,7 @@
for (col = field_count - 1; col = 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;
-   
mysqlnd_palloc_zval_ptr_dtor((current_row[col]), result-type, 
copy_ctor_called TSRMLS_CC);
+   
mysqlnd_rset_zval_ptr_dtor((current_row[col]), result-type, copy_ctor_called 
TSRMLS_CC);
 #if MYSQLND_DEBUG_MEMORY

DBG_INF_FMT(Copy_ctor_called=%u, copy_ctor_called);
 #endif

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 14:39:36 UTC 
(rev 309561)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 14:39:58 UTC 
(rev 309562)
@@ -83,11 +83,11 @@
 /* }}} */


-/* {{{ mysqlnd_palloc_zval_ptr_dtor */
-static
-void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, 
zend_bool * copy_ctor_called TSRMLS_DC)
+/* {{{ mysqlnd_rset_zval_ptr_dtor */
+static void
+mysqlnd_rset_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bool * 
copy_ctor_called TSRMLS_DC)
 {
-   DBG_ENTER(mysqlnd_palloc_zval_ptr_dtor);
+   DBG_ENTER(mysqlnd_rset_zval_ptr_dtor);
if (!zv || !*zv) {
*copy_ctor_called = FALSE;
DBG_ERR_FMT(zv was NULL);
@@ -155,7 +155,7 @@
MYSQLND_STATS *global_stats = result-conn? 
result-conn-stats:NULL;

for (i = 0; i  result-field_count; i++) {
-   
mysqlnd_palloc_zval_ptr_dtor((unbuf-last_row_data[i]), result-type, 
copy_ctor_called TSRMLS_CC);
+   mysqlnd_rset_zval_ptr_dtor((unbuf-last_row_data[i]), 
result-type, copy_ctor_called TSRMLS_CC);
if (copy_ctor_called) {
++ctor_called_count;
}
@@ -207,7 +207,7 @@
for (col = field_count - 1; col = 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;
-   
mysqlnd_palloc_zval_ptr_dtor((current_row[col]), result-type, 
copy_ctor_called TSRMLS_CC);
+   
mysqlnd_rset_zval_ptr_dtor((current_row[col]), result-type, copy_ctor_called 
TSRMLS_CC);
if (copy_ctor_called) {

++copy_on_write_performed;
} else {

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 12:25:36 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308669

Log:
move from macros to functions, which can be overwritten, if needed

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2011-02-25 11:39:36 UTC (rev 308668)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2011-02-25 12:25:36 UTC (rev 308669)
@@ -2225,6 +2225,43 @@
 /* }}} */


+/* {{{ mysqlnd_conn::set_autocommit */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_conn, set_autocommit)(MYSQLND * conn, unsigned int mode TSRMLS_DC)
+{
+	enum_func_status ret;
+	DBG_ENTER(mysqlnd_conn::set_autocommit);
+	ret = conn-m-query(conn, (mode) ? SET AUTOCOMMIT=1:SET AUTOCOMMIT=0, sizeof(SET AUTOCOMMIT=1) - 1 TSRMLS_CC);
+	DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_conn::tx_commit */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_conn, tx_commit)(MYSQLND * conn TSRMLS_DC)
+{
+	enum_func_status ret;
+	DBG_ENTER(mysqlnd_conn::tx_commit);
+	ret = conn-m-query(conn, COMMIT, sizeof(COMMIT) - 1 TSRMLS_CC);
+	DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_conn::tx_rollback */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_conn, tx_rollback)(MYSQLND * conn TSRMLS_DC)
+{
+	enum_func_status ret;
+	DBG_ENTER(mysqlnd_conn::tx_rollback);
+	ret = conn-m-query(conn, ROLLBACK, sizeof(ROLLBACK) - 1 TSRMLS_CC);
+	DBG_RETURN(ret);
+}
+/* }}} */
+
+
+
 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC);
 static enum_func_status MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC);

@@ -2298,7 +2335,10 @@
 	MYSQLND_METHOD(mysqlnd_conn, send_close),

 	MYSQLND_METHOD(mysqlnd_conn, ssl_set),
-	mysqlnd_result_init
+	mysqlnd_result_init,
+	MYSQLND_METHOD(mysqlnd_conn, set_autocommit),
+	MYSQLND_METHOD(mysqlnd_conn, tx_commit),
+	MYSQLND_METHOD(mysqlnd_conn, tx_rollback)
 MYSQLND_CLASS_METHODS_END;



Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h	2011-02-25 11:39:36 UTC (rev 308668)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h	2011-02-25 12:25:36 UTC (rev 308669)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION mysqlnd 5.0.7-dev - 091210 - $Revision$
-#define MYSQLND_VERSION_ID 50007
+#define MYSQLND_VERSION mysqlnd 5.0.9-dev - 20102224 - $Revision$
+#define MYSQLND_VERSION_ID 50009

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0
@@ -198,9 +198,9 @@
 PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char * const funcname);

 /* Simple commands */
-#define mysqlnd_autocommit(conn, mode)		(conn)-m-query((conn),(mode) ? SET AUTOCOMMIT=1:SET AUTOCOMMIT=0, 16 TSRMLS_CC)
-#define mysqlnd_commit(conn)(conn)-m-query((conn), COMMIT, sizeof(COMMIT)-1 TSRMLS_CC)
-#define mysqlnd_rollback(conn)(conn)-m-query((conn), ROLLBACK, sizeof(ROLLBACK)-1 TSRMLS_CC)
+#define mysqlnd_autocommit(conn, mode)		(conn)-m-set_autocommit((conn), (mode) TSRMLS_CC)
+#define mysqlnd_commit(conn)(conn)-m-tx_commit((conn) TSRMLS_CC)
+#define mysqlnd_rollback(conn)(conn)-m-tx_rollback((conn) TSRMLS_CC)
 #define mysqlnd_list_dbs(conn, wild)		(conn)-m-list_method((conn), wild? SHOW DATABASES LIKE %s:SHOW DATABASES, (wild), NULL TSRMLS_CC)
 #define mysqlnd_list_fields(conn, tab,wild)	(conn)-m-list_fields((conn), (tab), (wild) TSRMLS_CC)
 #define mysqlnd_list_processes(conn)		(conn)-m-list_method((conn), SHOW PROCESSLIST, NULL, NULL TSRMLS_CC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2011-02-25 11:39:36 UTC (rev 308668)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2011-02-25 12:25:36 UTC (rev 308669)
@@ -406,6 +406,11 @@

 typedef MYSQLND_RES * 		(*func_mysqlnd_conn__result_init)(unsigned int field_count, zend_bool persistent TSRMLS_DC);

+typedef enum_func_status	(*func_mysqlnd_conn__set_autocommit)(MYSQLND * conn, unsigned int mode TSRMLS_DC);
+typedef enum_func_status	(*func_mysqlnd_conn__tx_commit)(MYSQLND * conn TSRMLS_DC);
+typedef enum_func_status	(*func_mysqlnd_conn__tx_rollback)(MYSQLND * conn TSRMLS_DC);
+
+
 struct st_mysqlnd_conn_methods
 {
 	func_mysqlnd_conn__init init;
@@ -477,6 +482,9 @@
 	func_mysqlnd_conn__ssl_set ssl_set;

 	func_mysqlnd_conn__result_init result_init;

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysq

2011-02-25 Thread Pierre Joye
hi,

I know that this commit could be considered as cosmetic only but we
are in a RC phase, in case you did not notice it. And such commits
look dangerous to me.

On Fri, Feb 25, 2011 at 1:25 PM, Andrey Hristov and...@php.net wrote:
 andrey                                   Fri, 25 Feb 2011 12:25:36 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=308669

 Log:
 move from macros to functions, which can be overwritten, if needed

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h


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




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysq

2011-02-25 Thread Andrey Hristov
sorry,
did not notice. Will revert


Andrey

On 02/25/2011 01:40 PM, Pierre Joye wrote:
 hi,
 
 I know that this commit could be considered as cosmetic only but we
 are in a RC phase, in case you did not notice it. And such commits
 look dangerous to me.
 
 On Fri, Feb 25, 2011 at 1:25 PM, Andrey Hristov and...@php.net wrote:
 andrey   Fri, 25 Feb 2011 12:25:36 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=308669

 Log:
 move from macros to functions, which can be overwritten, if needed

 Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h


 --
 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] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.c mysqlnd.h mysqlnd_structs.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 12:52:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308671

Log:
revert to previous behavior

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-02-25 12:34:00 UTC 
(rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-02-25 12:52:21 UTC 
(rev 308671)
@@ -2335,10 +2335,12 @@
MYSQLND_METHOD(mysqlnd_conn, send_close),

MYSQLND_METHOD(mysqlnd_conn, ssl_set),
-   mysqlnd_result_init,
-   MYSQLND_METHOD(mysqlnd_conn, set_autocommit),
+   mysqlnd_result_init
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
+   ,MYSQLND_METHOD(mysqlnd_conn, set_autocommit),
MYSQLND_METHOD(mysqlnd_conn, tx_commit),
MYSQLND_METHOD(mysqlnd_conn, tx_rollback)
+#endif
 MYSQLND_CLASS_METHODS_END;



Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:34:00 UTC 
(rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:21 UTC 
(rev 308671)
@@ -198,9 +198,15 @@
 PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char 
* const funcname);

 /* Simple commands */
+#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
 #define mysqlnd_autocommit(conn, mode) 
(conn)-m-set_autocommit((conn), (mode) TSRMLS_CC)
 #define mysqlnd_commit(conn)   
(conn)-m-tx_commit((conn) TSRMLS_CC)
 #define mysqlnd_rollback(conn) 
(conn)-m-tx_rollback((conn) TSRMLS_CC)
+#else
+#define mysqlnd_autocommit(conn, mode) (conn)-m-query((conn),(mode) 
? SET AUTOCOMMIT=1:SET AUTOCOMMIT=0, 16 TSRMLS_CC)
+#define mysqlnd_commit(conn)   
(conn)-m-query((conn), COMMIT, sizeof(COMMIT)-1 TSRMLS_CC)
+#define mysqlnd_rollback(conn) 
(conn)-m-query((conn), ROLLBACK, sizeof(ROLLBACK)-1 TSRMLS_CC)
+#endif
 #define mysqlnd_list_dbs(conn, wild)   (conn)-m-list_method((conn), 
wild? SHOW DATABASES LIKE %s:SHOW DATABASES, (wild), NULL TSRMLS_CC)
 #define mysqlnd_list_fields(conn, tab,wild)(conn)-m-list_fields((conn), 
(tab), (wild) TSRMLS_CC)
 #define mysqlnd_list_processes(conn)   (conn)-m-list_method((conn), 
SHOW PROCESSLIST, NULL, NULL TSRMLS_CC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:34:00 UTC (rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:52:21 UTC (rev 308671)
@@ -482,9 +482,11 @@
func_mysqlnd_conn__ssl_set ssl_set;

func_mysqlnd_conn__result_init result_init;
+#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
func_mysqlnd_conn__set_autocommit set_autocommit;
func_mysqlnd_conn__tx_commit tx_commit;
func_mysqlnd_conn__tx_rollback tx_rollback;
+#endif
 };



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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 12:52:46 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308672

Log:
revert also the version_id

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:21 UTC 
(rev 308671)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:46 UTC 
(rev 308672)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION mysqlnd 5.0.9-dev - 20102224 - $Revision$
-#define MYSQLND_VERSION_ID 50009
+#define MYSQLND_VERSION mysqlnd 5.0.8-dev - 20102224 - $Revision$
+#define MYSQLND_VERSION_ID 50008

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd.h mysqlnd_structs.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 13:11:49 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308673

Log:
use ifdef all-around in the revert

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:46 UTC 
(rev 308672)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 13:11:49 UTC 
(rev 308673)
@@ -198,7 +198,7 @@
 PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char 
* const funcname);

 /* Simple commands */
-#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
 #define mysqlnd_autocommit(conn, mode) 
(conn)-m-set_autocommit((conn), (mode) TSRMLS_CC)
 #define mysqlnd_commit(conn)   
(conn)-m-tx_commit((conn) TSRMLS_CC)
 #define mysqlnd_rollback(conn) 
(conn)-m-tx_rollback((conn) TSRMLS_CC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:52:46 UTC (rev 308672)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
13:11:49 UTC (rev 308673)
@@ -482,7 +482,7 @@
func_mysqlnd_conn__ssl_set ssl_set;

func_mysqlnd_conn__result_init result_init;
-#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
func_mysqlnd_conn__set_autocommit set_autocommit;
func_mysqlnd_conn__tx_commit tx_commit;
func_mysqlnd_conn__tx_rollback tx_rollback;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-02-21 Thread Andrey Hristov
andrey   Mon, 21 Feb 2011 16:24:37 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=308540

Log:
fix invalid memory read. Thank you, valgrind

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-02-21 
15:56:25 UTC (rev 308539)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-02-21 
16:24:37 UTC (rev 308540)
@@ -1271,7 +1271,7 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn-upsert_status.affected_rows = set-row_count;
}
-   DBG_INF_FMT(ret=%s row_count=MYSQLND_LLU_SPEC warnings=%u 
server_status=%u,
+   DBG_INF_FMT(ret=%s row_count=%u warnings=%u server_status=%u,
ret == PASS? PASS:FAIL, (uint) 
set-row_count, conn-upsert_status.warning_count, 
conn-upsert_status.server_status);
 end:
PACKET_FREE(row_packet);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-02-21 15:56:25 UTC 
(rev 308539)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-02-21 16:24:37 UTC 
(rev 308540)
@@ -1271,7 +1271,7 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn-upsert_status.affected_rows = set-row_count;
}
-   DBG_INF_FMT(ret=%s row_count=MYSQLND_LLU_SPEC warnings=%u 
server_status=%u,
+   DBG_INF_FMT(ret=%s row_count=%u warnings=%u server_status=%u,
ret == PASS? PASS:FAIL, (uint) 
set-row_count, conn-upsert_status.warning_count, 
conn-upsert_status.server_status);
 end:
PACKET_FREE(row_packet);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-02-01 Thread Andrey Hristov
andrey   Tue, 01 Feb 2011 16:55:20 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307921

Log:
fix warnings. These checks are not needed because
param_no is unsigned, it wasn't in the beginning.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-02-01 
16:35:26 UTC (rev 307920)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-02-01 
16:55:20 UTC (rev 307921)
@@ -1477,7 +1477,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no  0 || param_no = stmt-param_count) {
+   if (param_no = stmt-param_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
Invalid parameter number);
DBG_ERR(invalid param_no);
DBG_RETURN(FAIL);
@@ -1617,7 +1617,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no  0 || param_no = stmt-field_count) {
+   if (param_no = stmt-field_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
Invalid parameter number);
DBG_ERR(invalid param_no);
DBG_RETURN(FAIL);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-02-01 16:35:26 UTC (rev 
307920)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-02-01 16:55:20 UTC (rev 
307921)
@@ -1477,7 +1477,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no  0 || param_no = stmt-param_count) {
+   if (param_no = stmt-param_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
Invalid parameter number);
DBG_ERR(invalid param_no);
DBG_RETURN(FAIL);
@@ -1617,7 +1617,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no  0 || param_no = stmt-field_count) {
+   if (param_no = stmt-field_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
Invalid parameter number);
DBG_ERR(invalid param_no);
DBG_RETURN(FAIL);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c trunk/ext/mysqlnd/mysqlnd_loaddata.c

2011-02-01 Thread Andrey Hristov
andrey   Tue, 01 Feb 2011 19:30:22 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307931

Log:
Fix more warnings about size_t

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c 2011-02-01 
19:03:05 UTC (rev 307930)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c 2011-02-01 
19:30:22 UTC (rev 307931)
@@ -212,7 +212,7 @@

/* read data */
while ((bufsize = infile.local_infile_read (info, buf + 
MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE TSRMLS_CC))  0) {
-   if ((ret = conn-net-m.send(conn, buf, bufsize TSRMLS_CC))  
0) {
+   if ((ret = conn-net-m.send(conn, buf, bufsize TSRMLS_CC)) == 
0) {
DBG_ERR_FMT(Error during read : %d %s %s, 
CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
SET_CLIENT_ERROR(conn-error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
@@ -220,7 +220,7 @@
}

/* send empty packet for eof */
-   if ((ret = conn-net-m.send(conn, empty_packet, 0 TSRMLS_CC))  0) {
+   if ((ret = conn-net-m.send(conn, empty_packet, 0 TSRMLS_CC)) == 0) {
SET_CLIENT_ERROR(conn-error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c2011-02-01 19:03:05 UTC 
(rev 307930)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c2011-02-01 19:30:22 UTC 
(rev 307931)
@@ -212,7 +212,7 @@

/* read data */
while ((bufsize = infile.local_infile_read (info, buf + 
MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE TSRMLS_CC))  0) {
-   if ((ret = conn-net-m.send(conn, buf, bufsize TSRMLS_CC))  
0) {
+   if ((ret = conn-net-m.send(conn, buf, bufsize TSRMLS_CC)) == 
0) {
DBG_ERR_FMT(Error during read : %d %s %s, 
CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
SET_CLIENT_ERROR(conn-error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
@@ -220,7 +220,7 @@
}

/* send empty packet for eof */
-   if ((ret = conn-net-m.send(conn, empty_packet, 0 TSRMLS_CC))  0) {
+   if ((ret = conn-net-m.send(conn, empty_packet, 0 TSRMLS_CC)) == 0) {
SET_CLIENT_ERROR(conn-error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2011-01-31 Thread Andrey Hristov
andrey   Mon, 31 Jan 2011 13:52:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307883

Log:
Add two new enums constants from the server

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-31 13:29:18 UTC (rev 307882)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-31 13:52:21 UTC (rev 307883)
@@ -157,6 +157,8 @@
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+   MYSQL_PLUGIN_DIR,
+   MYSQL_DEFAULT_AUTH,
 #if MYSQLND_UNICODE
MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE = 200,
 #endif

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-31 13:29:18 UTC 
(rev 307882)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-31 13:52:21 UTC 
(rev 307883)
@@ -162,6 +162,8 @@
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+   MYSQL_PLUGIN_DIR,
+   MYSQL_DEFAULT_AUTH,
 #if MYSQLND_UNICODE
MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE = 200,
 #endif

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_statistics.c

2011-01-19 Thread Andrey Hristov
andrey   Wed, 19 Jan 2011 18:09:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307593

Log:
fix zts build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-19 17:51:02 UTC (rev 307592)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-19 18:09:17 UTC (rev 307593)
@@ -248,7 +248,6 @@
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
if (*stats == NULL) {
-   DBG_ENTER(mysqlnd_stats_init failed to calloc stats context);
return;
}
(*stats)-values = calloc(statistic_count, sizeof(uint64_t));

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Andrey Hristov
On 01/17/2011 03:01 PM, Pierre Joye wrote:
 pajoye   Mon, 17 Jan 2011 14:01:01 +
 
 Revision: http://svn.php.net/viewvc?view=revisionrevision=307537
 
 Log:
 - fix NULL derefencing
 
 Changed paths:
 U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
 U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
 
 Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
 ===
 --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2011-01-17 
 13:44:54 UTC (rev 307536)
 +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2011-01-17 
 14:01:01 UTC (rev 307537)
 @@ -735,7 +735,7 @@
 
   DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
   *fetched_anything = FALSE;
 - DBG_INF_FMT(stmt=%lu, stmt-stmt_id);
 + DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);
 
   /* If we haven't read everything */
   if (set-data_cursor 
 @@ -2223,9 +2223,9 @@
  static enum_func_status
  MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool 
 implicit TSRMLS_DC)
  {
 - MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
 + MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
   enum_func_status ret = FAIL;
 - zend_bool persistent = s-persistent;
 + zend_bool persistent = (s == NULL) ? s-persistent : 0;

This breaks mysqlnd. Why? Because you turn around the meaning. s? means
s!=NULL and you change it to s==NULL but leave the rest of the ternary
intact. Did you run the tests, because 117 more failing test, out of
432. This is hard to oversee if you run the test suite!

Best,
Andrey

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 10:29:26 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307558

Log:
- fix the fix (wrong test)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
07:28:30 UTC (rev 307557)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
10:29:26 UTC (rev 307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s-data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s-persistent : 0;
+   zend_bool persistent = (s != NULL) ? s-persistent : 0;

DBG_ENTER(mysqlnd_stmt::dtor);
if (stmt) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 07:28:30 UTC (rev 
307557)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 10:29:26 UTC (rev 
307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s-data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s-persistent : 0;
+   zend_bool persistent = (s != NULL) ? s-persistent : 0;

DBG_ENTER(mysqlnd_stmt::dtor);
if (stmt) {

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Pierre Joye
fixed

On Tue, Jan 18, 2011 at 11:20 AM, Andrey Hristov p...@hristov.com wrote:
 On 01/17/2011 03:01 PM, Pierre Joye wrote:
 pajoye                                   Mon, 17 Jan 2011 14:01:01 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=307537

 Log:
 - fix NULL derefencing

 Changed paths:
     U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
     U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

 Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
 ===
 --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
 13:44:54 UTC (rev 307536)
 +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
 14:01:01 UTC (rev 307537)
 @@ -735,7 +735,7 @@

       DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
       *fetched_anything = FALSE;
 -     DBG_INF_FMT(stmt=%lu, stmt-stmt_id);
 +     DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);

       /* If we haven't read everything */
       if (set-data_cursor 
 @@ -2223,9 +2223,9 @@
  static enum_func_status
  MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool 
 implicit TSRMLS_DC)
  {
 -     MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
 +     MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
       enum_func_status ret = FAIL;
 -     zend_bool persistent = s-persistent;
 +     zend_bool persistent = (s == NULL) ? s-persistent : 0;

 This breaks mysqlnd. Why? Because you turn around the meaning. s? means
 s!=NULL and you change it to s==NULL but leave the rest of the ternary
 intact. Did you run the tests, because 117 more failing test, out of
 432. This is hard to oversee if you run the test suite!

 Best,
 Andrey




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c trunk/ext/mysqlnd/mysqlnd_statistics.c

2011-01-17 Thread Pierre Joye
pajoye   Mon, 17 Jan 2011 14:07:40 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307538

Log:
- don't try to access if calloc fails (quick review of its usage: seems that 
the stats member is validated in other places, to be confirmed)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-17 14:01:01 UTC (rev 307537)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-17 14:07:40 UTC (rev 307538)
@@ -247,6 +247,10 @@
 mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count)
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
+   if (*stats == NULL) {
+   DBG_ENTER(mysqlnd_stats_init failed to calloc stats context);
+   return;
+   }
(*stats)-values = calloc(statistic_count, sizeof(uint64_t));
(*stats)-triggers = calloc(statistic_count, 
sizeof(mysqlnd_stat_trigger));
(*stats)-in_trigger = FALSE;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c  2011-01-17 14:01:01 UTC 
(rev 307537)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c  2011-01-17 14:07:40 UTC 
(rev 307538)
@@ -245,6 +245,10 @@
 mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count)
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
+   if (*stats == NULL) {
+   DBG_ENTER(mysqlnd_stats_init failed to calloc stats context);
+   return;
+   }
(*stats)-values = calloc(statistic_count, sizeof(uint64_t));
(*stats)-triggers = calloc(statistic_count, 
sizeof(mysqlnd_stat_trigger));
(*stats)-in_trigger = FALSE;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-17 Thread Pierre Joye
pajoye   Mon, 17 Jan 2011 14:01:01 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307537

Log:
- fix NULL derefencing

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-17 
13:44:54 UTC (rev 307536)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-17 
14:01:01 UTC (rev 307537)
@@ -735,7 +735,7 @@

DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
*fetched_anything = FALSE;
-   DBG_INF_FMT(stmt=%lu, stmt-stmt_id);
+   DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);

/* If we haven't read everything */
if (set-data_cursor 
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = s-persistent;
+   zend_bool persistent = (s == NULL) ? s-persistent : 0;

DBG_ENTER(mysqlnd_stmt::dtor);
if (stmt) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-17 13:44:54 UTC (rev 
307536)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-17 14:01:01 UTC (rev 
307537)
@@ -735,7 +735,7 @@

DBG_ENTER(mysqlnd_fetch_stmt_row_buffered);
*fetched_anything = FALSE;
-   DBG_INF_FMT(stmt=%lu, stmt-stmt_id);
+   DBG_INF_FMT(stmt=%lu, stmt != NULL ? stmt-stmt_id : 0L);

/* If we haven't read everything */
if (set-data_cursor 
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s-data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = s-persistent;
+   zend_bool persistent = (s == NULL) ? s-persistent : 0;

DBG_ENTER(mysqlnd_stmt::dtor);
if (stmt) {

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2011-01-10 Thread Andrey Hristov
andrey   Mon, 10 Jan 2011 15:14:56 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307340

Log:
new flag

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-10 13:07:21 UTC (rev 307339)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-10 15:14:56 UTC (rev 307340)
@@ -92,6 +92,7 @@
 #define CLIENT_MULTI_STATEMENTS(1UL  16) /* Enable/disable 
multi-stmt support */
 #define CLIENT_MULTI_RESULTS   (1UL  17) /* Enable/disable 
multi-results */
 #define CLIENT_PS_MULTI_RESULTS(1UL  18) /* Multi-results in 
PS-protocol */
+#define CLIENT_PLUGIN_AUTH (1UL  19) /* Client supports 
plugin authentication */

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL  30)


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-10 13:07:21 UTC 
(rev 307339)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-10 15:14:56 UTC 
(rev 307340)
@@ -92,6 +92,7 @@
 #define CLIENT_MULTI_STATEMENTS(1UL  16) /* Enable/disable 
multi-stmt support */
 #define CLIENT_MULTI_RESULTS   (1UL  17) /* Enable/disable 
multi-results */
 #define CLIENT_PS_MULTI_RESULTS(1UL  18) /* Multi-results in 
PS-protocol */
+#define CLIENT_PLUGIN_AUTH (1UL  19) /* Client supports 
plugin authentication */

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL  30)


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-12-16 Thread Andrey Hristov
andrey   Thu, 16 Dec 2010 12:18:54 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306405

Log:
Fix sprintf modifier to be right, wrong data reported in the log

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-12-16 
12:10:03 UTC (rev 306404)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-12-16 
12:18:54 UTC (rev 306405)
@@ -1270,8 +1270,8 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn-upsert_status.affected_rows = set-row_count;
}
-   DBG_INF_FMT(ret=%s row_count=%u warnings=%u server_status=%u, ret == 
PASS? PASS:FAIL,
-   set-row_count, 
conn-upsert_status.warning_count, conn-upsert_status.server_status);
+   DBG_INF_FMT(ret=%s row_count=MYSQLND_LLU_SPEC warnings=%u 
server_status=%u,
+   ret == PASS? PASS:FAIL, (uint) 
set-row_count, conn-upsert_status.warning_count, 
conn-upsert_status.server_status);
 end:
PACKET_FREE(row_packet);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-12-16 12:10:03 UTC 
(rev 306404)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-12-16 12:18:54 UTC 
(rev 306405)
@@ -1270,8 +1270,8 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn-upsert_status.affected_rows = set-row_count;
}
-   DBG_INF_FMT(ret=%s row_count=%u warnings=%u server_status=%u, ret == 
PASS? PASS:FAIL,
-   set-row_count, 
conn-upsert_status.warning_count, conn-upsert_status.server_status);
+   DBG_INF_FMT(ret=%s row_count=MYSQLND_LLU_SPEC warnings=%u 
server_status=%u,
+   ret == PASS? PASS:FAIL, (uint) 
set-row_count, conn-upsert_status.warning_count, 
conn-upsert_status.server_status);
 end:
PACKET_FREE(row_packet);


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-12-15 Thread Andrey Hristov
andrey   Wed, 15 Dec 2010 14:14:58 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306386

Log:
count preciser in case of error

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-12-15 
13:47:14 UTC (rev 306385)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-12-15 
14:14:58 UTC (rev 306386)
@@ -64,6 +64,7 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_net, network_read)(MYSQLND * conn, zend_uchar * buffer, 
size_t count TSRMLS_DC)
 {
+   enum_func_status return_value = PASS;
size_t to_read = count, ret;
size_t old_chunk_size = conn-net-stream-chunk_size;
DBG_ENTER(mysqlnd_net::network_read);
@@ -72,14 +73,15 @@
while (to_read) {
if (!(ret = php_stream_read(conn-net-stream, (char *) buffer, 
to_read))) {
DBG_ERR_FMT(Error while reading header from socket);
-   DBG_RETURN(FAIL);
+   return_value = FAIL;
+   break;
}
buffer += ret;
to_read -= ret;
}
-   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, STAT_BYTES_RECEIVED, 
count);
+   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, STAT_BYTES_RECEIVED, 
count - to_read);
conn-net-stream-chunk_size = old_chunk_size;
-   DBG_RETURN(PASS);
+   DBG_RETURN(return_value);
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-12-15 13:47:14 UTC (rev 
306385)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-12-15 14:14:58 UTC (rev 
306386)
@@ -64,6 +64,7 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_net, network_read)(MYSQLND * conn, zend_uchar * buffer, 
size_t count TSRMLS_DC)
 {
+   enum_func_status return_value = PASS;
size_t to_read = count, ret;
size_t old_chunk_size = conn-net-stream-chunk_size;
DBG_ENTER(mysqlnd_net::network_read);
@@ -72,14 +73,15 @@
while (to_read) {
if (!(ret = php_stream_read(conn-net-stream, (char *) buffer, 
to_read))) {
DBG_ERR_FMT(Error while reading header from socket);
-   DBG_RETURN(FAIL);
+   return_value = FAIL;
+   break;
}
buffer += ret;
to_read -= ret;
}
-   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, STAT_BYTES_RECEIVED, 
count);
+   MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, STAT_BYTES_RECEIVED, 
count - to_read);
conn-net-stream-chunk_size = old_chunk_size;
-   DBG_RETURN(PASS);
+   DBG_RETURN(return_value);
 }
 /* }}} */


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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_ps.c

2010-12-08 Thread Andrey Hristov
andrey   Wed, 08 Dec 2010 21:55:29 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306095

Log:
enable again after 5.3.4 has already been tagged

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-08 
21:47:12 UTC (rev 306094)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-08 
21:55:29 UTC (rev 306095)
@@ -561,8 +561,7 @@
}
}
}
-/* #ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET */
-#if A0
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
if (stmt-upsert_status.server_status  SERVER_PS_OUT_PARAMS) {
s-m-free_stmt_content(s TSRMLS_CC);
DBG_INF(PS OUT Variable RSet, skipping);

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_ps.c

2010-12-07 Thread Andrey Hristov
andrey   Tue, 07 Dec 2010 11:13:55 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306051

Log:
switch this off for the release

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-07 
11:10:49 UTC (rev 306050)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-07 
11:13:55 UTC (rev 306051)
@@ -561,7 +561,8 @@
}
}
}
-#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+/* #ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET */
+#if A0
if (stmt-upsert_status.server_status  SERVER_PS_OUT_PARAMS) {
s-m-free_stmt_content(s TSRMLS_CC);
DBG_INF(PS OUT Variable RSet, skipping);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2010-12-06 Thread Andrey Hristov
andrey   Mon, 06 Dec 2010 13:50:51 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306008

Log:
don't crash if the API is used incorrectly

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-12-06 13:12:16 UTC 
(rev 306007)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-12-06 13:50:51 UTC 
(rev 306008)
@@ -1971,15 +1971,19 @@
}
}
if (ret == PASS) {
+   char * tmp = NULL;
+   /* if we get conn-user as parameter and then we first free it, 
then estrndup it, we will crash */
+   tmp = mnd_pestrndup(user, user_len, conn-persistent);
if (conn-user) {
mnd_pefree(conn-user, conn-persistent);
}
-   conn-user = mnd_pestrndup(user, user_len, conn-persistent);
+   conn-user = tmp;

+   tmp = mnd_pestrdup(passwd, conn-persistent);
if (conn-passwd) {
mnd_pefree(conn-passwd, conn-persistent);
}
-   conn-passwd = mnd_pestrdup(passwd, conn-persistent);
+   conn-passwd = tmp;

if (conn-last_message) {
mnd_pefree(conn-last_message, conn-persistent);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-12-06 13:12:16 UTC (rev 
306007)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-12-06 13:50:51 UTC (rev 
306008)
@@ -1994,15 +1994,19 @@
}
}
if (ret == PASS) {
+   char * tmp = NULL;
+   /* if we get conn-user as parameter and then we first free it, 
then estrndup it, we will crash */
+   tmp = mnd_pestrndup(user, user_len, conn-persistent);
if (conn-user) {
mnd_pefree(conn-user, conn-persistent);
}
-   conn-user = mnd_pestrndup(user, user_len, conn-persistent);
+   conn-user = tmp;

+   tmp = mnd_pestrdup(passwd, conn-persistent);
if (conn-passwd) {
mnd_pefree(conn-passwd, conn-persistent);
}
-   conn-passwd = mnd_pestrdup(passwd, conn-persistent);
+   conn-passwd = tmp;

if (conn-last_message) {
mnd_pefree(conn-last_message, conn-persistent);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2010-12-06 Thread Andrey Hristov
andrey   Mon, 06 Dec 2010 13:59:14 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=306009

Log:
Skip additional result sets sent by MySQL 5.5 servers
which break the Protocol API
(see http://bugs.mysql.com/bug.php?id=58700)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-06 
13:50:51 UTC (rev 306008)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-06 
13:59:14 UTC (rev 306009)
@@ -225,10 +225,15 @@
DBG_RETURN(FAIL);
}

+   DBG_INF_FMT(server_status=%u cursor=%u, 
stmt-upsert_status.server_status, stmt-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+   DBG_INF_FMT(server_status=%u cursor=%u, 
conn-upsert_status.server_status, conn-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+
/* Free space for next result */
s-m-free_stmt_content(s TSRMLS_CC);
-
-   DBG_RETURN(s-m-parse_execute_response(s TSRMLS_CC));
+   {
+   enum_func_status ret = s-m-parse_execute_response(s 
TSRMLS_CC);
+   DBG_RETURN(ret);
+   }
 }
 /* }}} */

@@ -556,6 +561,14 @@
}
}
}
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+   if (stmt-upsert_status.server_status  SERVER_PS_OUT_PARAMS) {
+   s-m-free_stmt_content(s TSRMLS_CC);
+   DBG_INF(PS OUT Variable RSet, skipping);
+   /* OUT params result set. Skip for now to retain compatibility 
*/
+   ret = mysqlnd_stmt_execute_parse_response(s TSRMLS_CC);
+   }
+#endif

DBG_INF(ret == PASS? PASS:FAIL);
DBG_RETURN(ret);
@@ -701,6 +714,8 @@

ret = s-m-parse_execute_response(s TSRMLS_CC);

+   DBG_INF_FMT(server_status=%u cursor=%u, 
stmt-upsert_status.server_status, stmt-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+
if (ret == PASS  conn-last_query_type == QUERY_UPSERT  
stmt-upsert_status.affected_rows) {
MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, 
STAT_ROWS_AFFECTED_PS, stmt-upsert_status.affected_rows);
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-12-06 13:50:51 UTC (rev 
306008)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-12-06 13:59:14 UTC (rev 
306009)
@@ -225,10 +225,15 @@
DBG_RETURN(FAIL);
}

+   DBG_INF_FMT(server_status=%u cursor=%u, 
stmt-upsert_status.server_status, stmt-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+   DBG_INF_FMT(server_status=%u cursor=%u, 
conn-upsert_status.server_status, conn-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+
/* Free space for next result */
s-m-free_stmt_content(s TSRMLS_CC);
-
-   DBG_RETURN(s-m-parse_execute_response(s TSRMLS_CC));
+   {
+   enum_func_status ret = s-m-parse_execute_response(s 
TSRMLS_CC);
+   DBG_RETURN(ret);
+   }
 }
 /* }}} */

@@ -556,6 +561,14 @@
}
}
}
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+   if (stmt-upsert_status.server_status  SERVER_PS_OUT_PARAMS) {
+   s-m-free_stmt_content(s TSRMLS_CC);
+   DBG_INF(PS OUT Variable RSet, skipping);
+   /* OUT params result set. Skip for now to retain compatibility 
*/
+   ret = mysqlnd_stmt_execute_parse_response(s TSRMLS_CC);
+   }
+#endif

DBG_INF(ret == PASS? PASS:FAIL);
DBG_RETURN(ret);
@@ -701,6 +714,8 @@

ret = s-m-parse_execute_response(s TSRMLS_CC);

+   DBG_INF_FMT(server_status=%u cursor=%u, 
stmt-upsert_status.server_status, stmt-upsert_status.server_status  
SERVER_STATUS_CURSOR_EXISTS);
+
if (ret == PASS  conn-last_query_type == QUERY_UPSERT  
stmt-upsert_status.affected_rows) {
MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats, 
STAT_ROWS_AFFECTED_PS, stmt-upsert_status.affected_rows);
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-12-02 Thread Andrey Hristov
andrey   Thu, 02 Dec 2010 13:59:56 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305904

Log:
new server constant as of 5.5

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-12-02 13:59:38 UTC (rev 305903)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-12-02 13:59:56 UTC (rev 305904)
@@ -64,6 +64,7 @@
 #define SERVER_STATUS_DB_DROPPED   256 /* A 
database was dropped */
 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
 #define SERVER_QUERY_WAS_SLOW  2048
+#define SERVER_PS_OUT_PARAMS   4096

 #define MYSQLND_NO_DATA100
 #define MYSQLND_DATA_TRUNCATED 101

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-12-02 13:59:38 UTC 
(rev 305903)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-12-02 13:59:56 UTC 
(rev 305904)
@@ -64,6 +64,7 @@
 #define SERVER_STATUS_DB_DROPPED   256 /* A 
database was dropped */
 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
 #define SERVER_QUERY_WAS_SLOW  2048
+#define SERVER_PS_OUT_PARAMS   4096

 #define MYSQLND_NO_DATA100
 #define MYSQLND_DATA_TRUNCATED 101

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_debug.h

2010-12-01 Thread Andrey Hristov
andrey   Wed, 01 Dec 2010 10:16:51 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305878

Log:
add a comment

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-12-01 
09:52:26 UTC (rev 305877)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-12-01 
10:16:51 UTC (rev 305878)
@@ -135,7 +135,7 @@
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return

-#endif
+#endif /* defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400)) */

 #if MYSQLND_DBG_ENABLED == 1


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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_debug.c

2010-11-15 Thread Pierre Joye
pajoye   Mon, 15 Nov 2010 23:46:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305389

Log:
- fix build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-11-15 
23:26:25 UTC (rev 305388)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-11-15 
23:46:21 UTC (rev 305389)
@@ -497,20 +497,20 @@
   min_in_calls=%5llu  
max_in_calls=%7llu  avg_in_calls=%7llu
   min_total=%5llu  
max_total=%7llu  avg_total=%7llu
,string_key
-   ,(unsigned long long) 
f_profile-calls
-   ,(unsigned long long) 
f_profile-own_underporm_calls
-   ,(unsigned long long) 
f_profile-in_calls_underporm_calls
-   ,(unsigned long long) 
f_profile-total_underporm_calls
+   ,(uint64_t) f_profile-calls
+   ,(uint64_t) 
f_profile-own_underporm_calls
+   ,(uint64_t) 
f_profile-in_calls_underporm_calls
+   ,(uint64_t) 
f_profile-total_underporm_calls

-   ,(unsigned long long) 
f_profile-min_own
-   ,(unsigned long long) 
f_profile-max_own
-   ,(unsigned long long) 
f_profile-avg_own
-   ,(unsigned long long) 
f_profile-min_in_calls
-   ,(unsigned long long) 
f_profile-max_in_calls
-   ,(unsigned long long) 
f_profile-avg_in_calls
-   ,(unsigned long long) 
f_profile-min_total
-   ,(unsigned long long) 
f_profile-max_total
-   ,(unsigned long long) 
f_profile-avg_total
+   ,(uint64_t) f_profile-min_own
+   ,(uint64_t) f_profile-max_own
+   ,(uint64_t) f_profile-avg_own
+   ,(uint64_t) 
f_profile-min_in_calls
+   ,(uint64_t) 
f_profile-max_in_calls
+   ,(uint64_t) 
f_profile-avg_in_calls
+   ,(uint64_t) f_profile-min_total
+   ,(uint64_t) f_profile-max_total
+   ,(uint64_t) f_profile-avg_total
);

zend_hash_move_forward_ex(self-function_profiles, pos_values);
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h trunk/ext/mysqlnd/mysqlnd_debug.c tru

2010-10-29 Thread Andrey Hristov
andrey   Fri, 29 Oct 2010 15:02:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304984

Log:
- More features for the profiling, create aggregates and dump them
on file close.
- Also add a trace modifier to switch on and off the profiling.
- With additional compiler switch the profiling can be completely omitted,
of course it makes sense only when --enable-debug. Because otherwise
there is no tracing, thus no profiling.
- Added a fix for Windows for handling trace files on different devices
 (special handing of ':' )

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_priv.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_priv.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-10-29 14:36:28 UTC (rev 304983)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-10-29 15:02:39 UTC (rev 304984)
@@ -36,16 +36,6 @@
 #define MYSQLND_ZTS(self)
 #endif

-#define MYSQLND_DEBUG_DUMP_TIME1
-#define MYSQLND_DEBUG_DUMP_TRACE			2
-#define MYSQLND_DEBUG_DUMP_PID4
-#define MYSQLND_DEBUG_DUMP_LINE8
-#define MYSQLND_DEBUG_DUMP_FILE16
-#define MYSQLND_DEBUG_DUMP_LEVEL			32
-#define MYSQLND_DEBUG_APPEND64
-#define MYSQLND_DEBUG_FLUSH	128
-#define MYSQLND_DEBUG_TRACE_MEMORY_CALLS	256
-
 static const char mysqlnd_emalloc_name[]	= _mysqlnd_emalloc;
 static const char mysqlnd_pemalloc_name[]	= _mysqlnd_pemalloc;
 static const char mysqlnd_ecalloc_name[]	= _mysqlnd_ecalloc;
@@ -81,6 +71,7 @@
 	NULL /* must be always last */
 };

+
 /* {{{ mysqlnd_debug::open */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_debug, open)(MYSQLND_DEBUG * self, zend_bool reopen)
@@ -300,13 +291,12 @@


 /* FALSE - The DBG_ calls won't be traced, TRUE - will be traced */
-/* {{{ mysqlnd_res_meta::func_enter */
+/* {{{ mysqlnd_debug::func_enter */
 static zend_bool
 MYSQLND_METHOD(mysqlnd_debug, func_enter)(MYSQLND_DEBUG * self,
 		  unsigned int line, const char * const file,
 		  const char * const func_name, unsigned int func_name_len)
 {
-	uint64_t some_time = 0;
 	if ((self-flags  MYSQLND_DEBUG_DUMP_TRACE) == 0 || self-file_name == NULL) {
 		return FALSE;
 	}
@@ -319,7 +309,12 @@
 		while (*p) {
 			if (*p == func_name) {
 zend_stack_push(self-call_stack, , sizeof());
-zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));
+#ifndef MYSQLND_PROFILING_DISABLED
+if (self-flags  MYSQLND_DEBUG_PROFILE_CALLS) {
+	uint64_t some_time = 0;
+	zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));
+}
+#endif
 return FALSE;
 			}
 			p++;
@@ -327,7 +322,12 @@
 	}

 	zend_stack_push(self-call_stack, func_name, func_name_len + 1);
-	zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));
+#ifndef MYSQLND_PROFILING_DISABLED
+	if (self-flags  MYSQLND_DEBUG_PROFILE_CALLS) {
+		uint64_t some_time = 0;
+		zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));
+	}
+#endif

 	if (zend_hash_num_elements(self-not_filtered_functions) 
 		0 == zend_hash_exists(self-not_filtered_functions, func_name, strlen(func_name) + 1))
@@ -340,14 +340,33 @@
 }
 /* }}} */

+#ifndef MYSQLND_PROFILING_DISABLED
+struct st_mysqlnd_dbg_function_profile {
+	uint64_t calls;
+	uint64_t min_own;
+	uint64_t max_own;
+	uint64_t avg_own;
+	uint64_t own_underporm_calls;
+	uint64_t min_in_calls;
+	uint64_t max_in_calls;
+	uint64_t avg_in_calls;
+	uint64_t in_calls_underporm_calls;
+	uint64_t min_total;
+	uint64_t max_total;
+	uint64_t avg_total;
+	uint64_t total_underporm_calls;
+};
+#define PROFILE_UNDERPERFORM_THRESHOLD 10
+#endif

-/* {{{ mysqlnd_res_meta::func_leave */
+/* {{{ mysqlnd_debug::func_leave */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * const file, uint64_t call_time)
 {
 	char *func_name;
 	uint64_t * parent_non_own_time_ptr = NULL, * mine_non_own_time_ptr = NULL;
-	uint64_t mine_non_own_time;
+	uint64_t mine_non_own_time = 0;
+	zend_bool profile_calls = self-flags  MYSQLND_DEBUG_PROFILE_CALLS? TRUE:FALSE;

 	if ((self-flags  MYSQLND_DEBUG_DUMP_TRACE) == 0 || self-file_name == NULL) {
 		return PASS;
@@ -358,47 +377,150 @@

 	zend_stack_top(self-call_stack, (void **)func_name);

+#ifndef MYSQLND_PROFILING_DISABLED
+	if (profile_calls) {
+		zend_stack_top(self-call_time_stack, (void **)mine_non_own_time_ptr);
+		mine_non_own_time = *mine_non_own_time_ptr;
+		zend_stack_del_top(self-call_time_stack); /* callee - removing ourselves */
+	}
+#endif

-	zend_stack_top(self-call_time_stack, (void **)mine_non_own_time_ptr);
-	

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/config9.m4 branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/config9.m4 trunk/ext/mysqlnd/mysqlnd_debug.h

2010-10-28 Thread Andrey Hristov
andrey   Thu, 28 Oct 2010 13:46:54 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304973

Log:
fix windows debug build
better zlib detection

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/config9.m4
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2010-10-28 13:09:07 UTC 
(rev 304972)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2010-10-28 13:46:54 UTC 
(rev 304973)
@@ -27,13 +27,10 @@
   dnl Windows uses config.w32 thus this code is safe for now

   if test $PHP_MYSQLND_COMPRESSION_SUPPORT != no; then
-AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol 
support])
-if test $PHP_ZLIB_DIR != no; then
+if test -z $PHP_ZLIB_DIR; then
+  AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol 
support])
   PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQLND_SHARED_LIBADD)
   MYSQLND_LIBS=$MYSQLND_LIBS -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz
-else
-  PHP_ADD_LIBRARY(z,, MYSQLND_SHARED_LIBADD)
-  MYSQLND_LIBS=$MYSQLND_LIBS -lz
 fi
   fi
   AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable SSL support])

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-28 
13:09:07 UTC (rev 304972)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-28 
13:46:54 UTC (rev 304973)
@@ -66,16 +66,21 @@

 #if defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400))
 #define DBG_PROFILE_TIMEVAL_TO_DOUBLE(tp)  ((tp.tv_sec * 100LL)+ 
tp.tv_usec)
-#define DBG_PROFILE_DECLARE_TIMEVARS   struct timeval __dbg_prof_tp = {0}; 
uint64_t __dbg_prof_start = 0; /* initialization is needed */
+#ifndef _MSC_VER
 #define DBG_PROFILE_START_TIME()   gettimeofday(__dbg_prof_tp, 
NULL); __dbg_prof_start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp);
 #define DBG_PROFILE_END_TIME(duration) gettimeofday(__dbg_prof_tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp) - __dbg_prof_start);
+#else
+#define DBG_PROFILE_START_TIME()   __dbg_prof_start = 0; /* no 
gettimeofday on Windows */
+#define DBG_PROFILE_END_TIME(duration) (duration) = 0; /* no gettimeofday on 
Windows */
+#endif

+
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)
 #define DBG_ERR_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, error: , 
__VA_ARGS__); } while (0)

-#define DBG_ENTER_EX(dbg_obj, func_name) DBG_PROFILE_DECLARE_TIMEVARS; 
zend_bool dbg_skip_trace = TRUE; \
+#define DBG_ENTER_EX(dbg_obj, func_name) struct timeval __dbg_prof_tp = {0}; 
uint64_t __dbg_prof_start = 0; /* initialization is needed */zend_bool 
dbg_skip_trace = TRUE; \
if ((dbg_obj)) dbg_skip_trace = 
!(dbg_obj)-m-func_enter((dbg_obj), __LINE__, __FILE__, func_name, 
strlen(func_name)); \
do { DBG_PROFILE_START_TIME(); } while 
(0);
 #define DBG_RETURN_EX(dbg_obj, value)  \

Modified: php/php-src/trunk/ext/mysqlnd/config9.m4
===
--- php/php-src/trunk/ext/mysqlnd/config9.m42010-10-28 13:09:07 UTC (rev 
304972)
+++ php/php-src/trunk/ext/mysqlnd/config9.m42010-10-28 13:46:54 UTC (rev 
304973)
@@ -27,13 +27,10 @@
   dnl Windows uses config.w32 thus this code is safe for now

   if test $PHP_MYSQLND_COMPRESSION_SUPPORT != no; then
-AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol 
support])
-if test $PHP_ZLIB_DIR != no; then
+if test -z $PHP_ZLIB_DIR; then
+  AC_DEFINE([MYSQLND_COMPRESSION_ENABLED], 1, [Enable compressed protocol 
support])
   PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQLND_SHARED_LIBADD)
   MYSQLND_LIBS=$MYSQLND_LIBS -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz
-else
-  PHP_ADD_LIBRARY(z,, MYSQLND_SHARED_LIBADD)
-  MYSQLND_LIBS=$MYSQLND_LIBS -lz
 fi
   fi
   AC_DEFINE([MYSQLND_SSL_SUPPORTED], 1, [Enable SSL support])

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-10-28 Thread Andrey Hristov
andrey   Thu, 28 Oct 2010 14:07:36 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304974

Log:
show tracing

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-10-28 
13:46:54 UTC (rev 304973)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-10-28 
14:07:36 UTC (rev 304974)
@@ -122,6 +122,8 @@
php_info_print_table_row(2, Read timeout, buf);
php_info_print_table_row(2, Collecting statistics, 
MYSQLND_G(collect_statistics)? Yes:No);
php_info_print_table_row(2, Collecting memory statistics, 
MYSQLND_G(collect_memory_statistics)? Yes:No);
+
+   php_info_print_table_row(2, Tracing, MYSQLND_G(debug)? 
MYSQLND_G(debug):n/a);
php_info_print_table_end();

/* Print client stats */

Modified: php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-10-28 13:46:54 UTC (rev 
304973)
+++ php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-10-28 14:07:36 UTC (rev 
304974)
@@ -122,6 +122,8 @@
php_info_print_table_row(2, Read timeout, buf);
php_info_print_table_row(2, Collecting statistics, 
MYSQLND_G(collect_statistics)? Yes:No);
php_info_print_table_row(2, Collecting memory statistics, 
MYSQLND_G(collect_memory_statistics)? Yes:No);
+
+   php_info_print_table_row(2, Tracing, MYSQLND_G(debug)? 
MYSQLND_G(debug):n/a);
php_info_print_table_end();

/* Print client stats */

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2010-10-28 Thread Andrey Hristov
andrey   Thu, 28 Oct 2010 14:14:06 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304975

Log:
gettimeofday for windows

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-28 
14:07:36 UTC (rev 304974)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-28 
14:14:06 UTC (rev 304975)
@@ -65,16 +65,19 @@
 PHPAPI char *  mysqlnd_get_backtrace(uint max_levels, size_t * length 
TSRMLS_DC);

 #if defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400))
+#ifdef PHP_WIN32
+#include win32/time.h
+#elif defined(NETWARE)
+#include sys/timeval.h
+#include sys/time.h
+#else
+#include sys/time.h
+#endif
+
 #define DBG_PROFILE_TIMEVAL_TO_DOUBLE(tp)  ((tp.tv_sec * 100LL)+ 
tp.tv_usec)
-#ifndef _MSC_VER
 #define DBG_PROFILE_START_TIME()   gettimeofday(__dbg_prof_tp, 
NULL); __dbg_prof_start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp);
 #define DBG_PROFILE_END_TIME(duration) gettimeofday(__dbg_prof_tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp) - __dbg_prof_start);
-#else
-#define DBG_PROFILE_START_TIME()   __dbg_prof_start = 0; /* no 
gettimeofday on Windows */
-#define DBG_PROFILE_END_TIME(duration) (duration) = 0; /* no gettimeofday on 
Windows */
-#endif

-
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-28 14:07:36 UTC 
(rev 304974)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-28 14:14:06 UTC 
(rev 304975)
@@ -65,16 +65,19 @@
 PHPAPI char *  mysqlnd_get_backtrace(uint max_levels, size_t * length 
TSRMLS_DC);

 #if defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400))
+#ifdef PHP_WIN32
+#include win32/time.h
+#elif defined(NETWARE)
+#include sys/timeval.h
+#include sys/time.h
+#else
+#include sys/time.h
+#endif
+
 #define DBG_PROFILE_TIMEVAL_TO_DOUBLE(tp)  ((tp.tv_sec * 100LL)+ 
tp.tv_usec)
-#ifndef _MSC_VER
 #define DBG_PROFILE_START_TIME()   gettimeofday(__dbg_prof_tp, 
NULL); __dbg_prof_start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp);
 #define DBG_PROFILE_END_TIME(duration) gettimeofday(__dbg_prof_tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp) - __dbg_prof_start);
-#else
-#define DBG_PROFILE_START_TIME()   __dbg_prof_start = 0; /* no 
gettimeofday on Windows */
-#define DBG_PROFILE_END_TIME(duration) (duration) = 0; /* no gettimeofday on 
Windows */
-#endif

-
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.h

2010-10-25 Thread Andrey Hristov
andrey   Mon, 25 Oct 2010 13:44:11 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304846

Log:
rename and remove usage of inttypes.h, not needed

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-10-25 
13:43:03 UTC (rev 304845)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-10-25 
13:44:11 UTC (rev 304846)
@@ -27,7 +27,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include zend_builtin_functions.h
-#include inttypes.h

 static const char * const mysqlnd_debug_default_trace_file = 
/tmp/mysqlnd.trace;


Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-25 
13:43:03 UTC (rev 304845)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-25 
13:44:11 UTC (rev 304846)
@@ -66,9 +66,9 @@

 #if defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400))
 #define DBG_PROFILE_TIMEVAL_TO_DOUBLE(tp)  ((tp.tv_sec * 100LL)+ 
tp.tv_usec)
-#define DBG_PROFILE_DECLARE_TIMEVARS   struct timeval __tp = {0}; 
uint64_t __start = 0; /* initialization is needed */
-#define DBG_PROFILE_START_TIME()   gettimeofday(__tp, 
NULL); __start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__tp);
-#define DBG_PROFILE_END_TIME(duration) gettimeofday(__tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__tp) - __start);
+#define DBG_PROFILE_DECLARE_TIMEVARS   struct timeval __dbg_prof_tp = {0}; 
uint64_t __dbg_prof_start = 0; /* initialization is needed */
+#define DBG_PROFILE_START_TIME()   gettimeofday(__dbg_prof_tp, 
NULL); __dbg_prof_start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp);
+#define DBG_PROFILE_END_TIME(duration) gettimeofday(__dbg_prof_tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp) - __dbg_prof_start);

 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-10-25 13:43:03 UTC 
(rev 304845)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-10-25 13:44:11 UTC 
(rev 304846)
@@ -27,7 +27,6 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include zend_builtin_functions.h
-#include inttypes.h

 static const char * const mysqlnd_debug_default_trace_file = 
/tmp/mysqlnd.trace;


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-25 13:43:03 UTC 
(rev 304845)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-25 13:44:11 UTC 
(rev 304846)
@@ -66,9 +66,9 @@

 #if defined(__GNUC__) || (defined(_MSC_VER)  (_MSC_VER = 1400))
 #define DBG_PROFILE_TIMEVAL_TO_DOUBLE(tp)  ((tp.tv_sec * 100LL)+ 
tp.tv_usec)
-#define DBG_PROFILE_DECLARE_TIMEVARS   struct timeval __tp = {0}; 
uint64_t __start = 0; /* initialization is needed */
-#define DBG_PROFILE_START_TIME()   gettimeofday(__tp, 
NULL); __start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__tp);
-#define DBG_PROFILE_END_TIME(duration) gettimeofday(__tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__tp) - __start);
+#define DBG_PROFILE_DECLARE_TIMEVARS   struct timeval __dbg_prof_tp = {0}; 
uint64_t __dbg_prof_start = 0; /* initialization is needed */
+#define DBG_PROFILE_START_TIME()   gettimeofday(__dbg_prof_tp, 
NULL); __dbg_prof_start = DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp);
+#define DBG_PROFILE_END_TIME(duration) gettimeofday(__dbg_prof_tp, NULL); 
(duration) = (DBG_PROFILE_TIMEVAL_TO_DOUBLE(__dbg_prof_tp) - __dbg_prof_start);

 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2010-10-22 Thread Andrey Hristov
andrey   Fri, 22 Oct 2010 14:12:45 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304622

Log:
enable debug logging on windows, in debug builds, of course

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-22 
14:08:30 UTC (rev 304621)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-10-22 
14:12:45 UTC (rev 304622)
@@ -63,7 +63,8 @@

 PHPAPI char *  mysqlnd_get_backtrace(uint max_levels, size_t * length 
TSRMLS_DC);

-#if defined(__GNUC__)
+/* Variadic Macros were introduced in VC 2005, which is _MSC_VER 1400 */
+#if defined(__GNUC__) || (defined(_MSC_VER)  _MSC_VER = 1400)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-22 14:08:30 UTC 
(rev 304621)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-10-22 14:12:45 UTC 
(rev 304622)
@@ -63,7 +63,8 @@

 PHPAPI char *  mysqlnd_get_backtrace(uint max_levels, size_t * length 
TSRMLS_DC);

-#if defined(__GNUC__)
+/* Variadic Macros were introduced in VC 2005, which is _MSC_VER 1400 */
+#if defined(__GNUC__) || (defined(_MSC_VER)  _MSC_VER = 1400)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, info : , (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)-m-log((dbg_obj), __LINE__, __FILE__, -1, error: , (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)-m-log_va((dbg_obj), __LINE__, __FILE__, -1, info : , 
__VA_ARGS__); } while (0)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.h

2010-10-22 Thread Andrey Hristov
andrey   Fri, 22 Oct 2010 14:34:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304625

Log:
last piece to enable trace logging on windows

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-10-22 14:21:55 UTC 
(rev 304624)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-10-22 14:34:33 UTC 
(rev 304625)
@@ -44,7 +44,7 @@
 #define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
 #endif

-#if PHP_DEBUG  !defined(PHP_WIN32)
+#if PHP_DEBUG
 #define MYSQLND_DBG_ENABLED 1
 #else
 #define MYSQLND_DBG_ENABLED 0

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-10-22 14:21:55 UTC (rev 
304624)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-10-22 14:34:33 UTC (rev 
304625)
@@ -44,7 +44,7 @@
 #define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
 #endif

-#if PHP_DEBUG  !defined(PHP_WIN32)
+#if PHP_DEBUG
 #define MYSQLND_DBG_ENABLED 1
 #else
 #define MYSQLND_DBG_ENABLED 0

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h branches/PHP_5_3/ext/pdo_mysql/php_pdo_mys

2010-10-22 Thread Andrey Hristov
andrey   Fri, 22 Oct 2010 15:46:26 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304627

Log:
profiling in trace mode

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/branches/PHP_5_3/ext/pdo_mysql/php_pdo_mysql_int.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-10-22 14:51:07 UTC (rev 304626)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-10-22 15:46:26 UTC (rev 304627)
@@ -2315,10 +2315,11 @@
 PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC)
 {
 	size_t alloc_size = sizeof(MYSQLND) + mysqlnd_plugin_count() * sizeof(void *);
-	MYSQLND *ret = mnd_pecalloc(1, alloc_size, persistent);
+	MYSQLND *ret;

 	DBG_ENTER(mysqlnd_init);
 	DBG_INF_FMT(persistent=%u, persistent);
+	ret = mnd_pecalloc(1, alloc_size, persistent);
 	if (!ret) {
 		DBG_RETURN(NULL);
 	}

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-10-22 14:51:07 UTC (rev 304626)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c	2010-10-22 15:46:26 UTC (rev 304627)
@@ -27,6 +27,7 @@
 #include mysqlnd_wireprotocol.h
 #include mysqlnd_statistics.h
 #include zend_builtin_functions.h
+#include inttypes.h

 static const char * const mysqlnd_debug_default_trace_file = /tmp/mysqlnd.trace;

@@ -287,7 +288,6 @@
 flags  MYSQLND_DEBUG_DUMP_LEVEL? level_buffer:,
 pipe_buffer, type? type:, buffer);
 	efree(buffer);
-
 	ret = php_stream_write(self-stream, message_line, message_line_len)? PASS:FAIL;
 	efree(message_line); /* allocated by spprintf */

@@ -307,6 +307,7 @@
 		  unsigned int line, const char * const file,
 		  const char * const func_name, unsigned int func_name_len)
 {
+	uint64_t some_time = 0;
 	if ((self-flags  MYSQLND_DEBUG_DUMP_TRACE) == 0 || self-file_name == NULL) {
 		return FALSE;
 	}
@@ -319,6 +320,7 @@
 		while (*p) {
 			if (*p == func_name) {
 zend_stack_push(self-call_stack, , sizeof());
+zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));
 return FALSE;
 			}
 			p++;
@@ -326,6 +328,7 @@
 	}

 	zend_stack_push(self-call_stack, func_name, func_name_len + 1);
+	zend_stack_push(self-call_time_stack, some_time, sizeof(some_time));

 	if (zend_hash_num_elements(self-not_filtered_functions) 
 		0 == zend_hash_exists(self-not_filtered_functions, func_name, strlen(func_name) + 1))
@@ -341,9 +344,12 @@

 /* {{{ mysqlnd_res_meta::func_leave */
 static enum_func_status
-MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * const file)
+MYSQLND_METHOD(mysqlnd_debug, func_leave)(MYSQLND_DEBUG * self, unsigned int line, const char * const file, uint64_t call_time)
 {
 	char *func_name;
+	uint64_t * parent_non_own_time_ptr = NULL, * mine_non_own_time_ptr = NULL;
+	uint64_t mine_non_own_time;
+
 	if ((self-flags  MYSQLND_DEBUG_DUMP_TRACE) == 0 || self-file_name == NULL) {
 		return PASS;
 	}
@@ -353,15 +359,34 @@

 	zend_stack_top(self-call_stack, (void **)func_name);

+
+	zend_stack_top(self-call_time_stack, (void **)mine_non_own_time_ptr);
+	mine_non_own_time = *mine_non_own_time_ptr;
+	zend_stack_del_top(self-call_time_stack); /* callee - removing ourselves */
+
 	if (func_name[0] == '\0') {
 		; /* don't log that function */
 	} else if (!zend_hash_num_elements(self-not_filtered_functions) ||
 			   1 == zend_hash_exists(self-not_filtered_functions, func_name, strlen(func_name) + 1))
 	{
-		self-m-log_va(self, line, file, zend_stack_count(self-call_stack) - 1, NULL, %s, func_name);
+		self-m-log_va(self, line, file, zend_stack_count(self-call_stack) - 1, NULL, %s (total=%u own=%u in_calls=%u),
+		func_name, (unsigned int) call_time, (unsigned int) (call_time - mine_non_own_time), (unsigned int) mine_non_own_time
+	);
 	}

-	return zend_stack_del_top(self-call_stack) == SUCCESS? PASS:FAIL;
+	{
+		enum_func_status ret = zend_stack_del_top(self-call_stack) == SUCCESS? PASS:FAIL;
+		if ((uint) zend_stack_count(self-call_time_stack)) {
+			uint64_t parent_non_own_time = 0;
+
+			zend_stack_top(self-call_time_stack, (void **)parent_non_own_time_ptr);
+			parent_non_own_time = *parent_non_own_time_ptr;
+			parent_non_own_time += call_time;
+			zend_stack_del_top(self-call_time_stack); /* the caller */
+			zend_stack_push(self-call_time_stack, parent_non_own_time, 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2010-10-08 Thread Andrey Hristov
andrey   Fri, 08 Oct 2010 09:15:31 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304200

Log:
new collations

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2010-10-08 
09:07:49 UTC (rev 304199)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2010-10-08 
09:15:31 UTC (rev 304200)
@@ -563,6 +563,7 @@
{ 145, ucs2, ucs2_esperanto_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
{ 146, ucs2, ucs2_hungarian_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
{ 147, ucs2, ucs2_sinhala_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
+   { 149, ucs2, ucs2_croatian_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2}, /* MDB */

{ 192, UTF8_MB3, UTF8_MB3_general_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 193, UTF8_MB3, UTF8_MB3_icelandic_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
@@ -584,6 +585,7 @@
{ 209, UTF8_MB3, UTF8_MB3_esperanto_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 210, UTF8_MB3, UTF8_MB3_hungarian_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 211, UTF8_MB3, UTF8_MB3_sinhala_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
+   { 213, UTF8_MB3, UTF8_MB3_croatian_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/

{ 224, UTF8_MB4, UTF8_MB4_unicode_ci, 1, 4, , 
mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
{ 225, UTF8_MB4, UTF8_MB4_icelandic_ci, 1, 4, , 
mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2010-10-08 09:07:49 UTC 
(rev 304199)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2010-10-08 09:15:31 UTC 
(rev 304200)
@@ -563,6 +563,7 @@
{ 145, ucs2, ucs2_esperanto_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
{ 146, ucs2, ucs2_hungarian_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
{ 147, ucs2, ucs2_sinhala_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2},
+   { 149, ucs2, ucs2_croatian_ci, 2, 2, , mysqlnd_mbcharlen_ucs2, 
check_mb_ucs2}, /* MDB */

{ 192, UTF8_MB3, UTF8_MB3_general_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 193, UTF8_MB3, UTF8_MB3_icelandic_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
@@ -584,6 +585,7 @@
{ 209, UTF8_MB3, UTF8_MB3_esperanto_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 210, UTF8_MB3, UTF8_MB3_hungarian_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
{ 211, UTF8_MB3, UTF8_MB3_sinhala_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid},
+   { 213, UTF8_MB3, UTF8_MB3_croatian_ci, 1, 3, , 
mysqlnd_mbcharlen_utf8mb3, check_mb_utf8mb3_valid}, /*MDB*/

{ 224, UTF8_MB4, UTF8_MB4_unicode_ci, 1, 4, , 
mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
{ 225, UTF8_MB4, UTF8_MB4_icelandic_ci, 1, 4, , 
mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-10-06 Thread Andrey Hristov
andrey   Wed, 06 Oct 2010 07:09:37 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304134

Log:
more variable hiding fixes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c	2010-10-06 06:17:42 UTC (rev 304133)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c	2010-10-06 07:09:37 UTC (rev 304134)
@@ -679,7 +679,7 @@

 		if (!row_packet-skip_extraction) {
 			MYSQLND_FIELD *field = result-meta-fields;
-			struct mysqlnd_field_hash_key *zend_hash_key = result-meta-zend_hash_keys;
+			struct mysqlnd_field_hash_key * hash_key = result-meta-zend_hash_keys;

 			enum_func_status rc = result-m.row_decoder(result-unbuf-last_row_buffer,
 		  result-unbuf-last_row_data,
@@ -695,7 +695,7 @@

 			retrow = mnd_malloc(result-field_count * sizeof(char *));
 			if (retrow) {
-for (i = 0; i  field_count; i++, field++, zend_hash_key++) {
+for (i = 0; i  field_count; i++, field++, hash_key++) {
 	zval *data = result-unbuf-last_row_data[i];
 	unsigned int len;

@@ -794,7 +794,7 @@
 		if (!row_packet-skip_extraction) {
 			HashTable *row_ht = Z_ARRVAL_P(row);
 			MYSQLND_FIELD *field = result-meta-fields;
-			struct mysqlnd_field_hash_key *zend_hash_key = result-meta-zend_hash_keys;
+			struct mysqlnd_field_hash_key * hash_key = result-meta-zend_hash_keys;
 			unsigned int i, field_count = result-field_count;
 			unsigned long *lengths = result-lengths;

@@ -809,7 +809,7 @@
 			if (PASS != rc) {
 DBG_RETURN(FAIL);
 			}
-			for (i = 0; i  field_count; i++, field++, zend_hash_key++) {
+			for (i = 0; i  field_count; i++, field++, hash_key++) {
 zval *data = result-unbuf-last_row_data[i];
 unsigned int len = (Z_TYPE_P(data) == IS_NULL)? 0:Z_STRLEN_P(data);

@@ -830,23 +830,23 @@
 	  hashing of the column name, which is not needed as it can be precomputed.
 	*/
 	Z_ADDREF_P(data);
-	if (zend_hash_key-is_numeric == FALSE) {
+	if (hash_key-is_numeric == FALSE) {
 #if MYSQLND_UNICODE
 		zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
- zend_hash_key-ustr,
- zend_hash_key-ulen + 1,
- zend_hash_key-key,
+ hash_key-ustr,
+ hash_key-ulen + 1,
+ hash_key-key,
  (void *) data, sizeof(zval *), NULL);
 #else
 		zend_hash_quick_update(Z_ARRVAL_P(row),
 			   field-name,
 			   field-name_length + 1,
-			   zend_hash_key-key,
+			   hash_key-key,
 			   (void *) data, sizeof(zval *), NULL);
 #endif
 	} else {
 		zend_hash_index_update(Z_ARRVAL_P(row),
-			   zend_hash_key-key,
+			   hash_key-key,
 			   (void *) data, sizeof(zval *), NULL);
 	}
 }
@@ -962,7 +962,7 @@
 	{
 		zval **current_row = set-data_cursor;
 		MYSQLND_FIELD *field = result-meta-fields;
-		struct mysqlnd_field_hash_key *zend_hash_key = result-meta-zend_hash_keys;
+		struct mysqlnd_field_hash_key * hash_key = result-meta-zend_hash_keys;
 		unsigned int i;

 		if (NULL == current_row[0]) {
@@ -999,7 +999,7 @@

 		ret = mnd_malloc(result-field_count * sizeof(char *));
 		if (ret) {
-			for (i = 0; i  result-field_count; i++, field++, zend_hash_key++) {
+			for (i = 0; i  result-field_count; i++, field++, hash_key++) {
 zval *data = current_row[i];

 if (Z_TYPE_P(data) != IS_NULL) {
@@ -1038,7 +1038,7 @@
 	{
 		zval **current_row = set-data_cursor;
 		MYSQLND_FIELD *field = result-meta-fields;
-		struct mysqlnd_field_hash_key *zend_hash_key = result-meta-zend_hash_keys;
+		struct mysqlnd_field_hash_key * hash_key = result-meta-zend_hash_keys;

 		if (NULL == current_row[0]) {
 			uint64_t row_num = (set-data_cursor - set-data) / result-meta-field_count;
@@ -1069,7 +1069,7 @@
 			}
 		}

-		for (i = 0; i  result-field_count; i++, field++, zend_hash_key++) {
+		for (i = 0; i  result-field_count; i++, field++, hash_key++) {
 			zval *data = current_row[i];

 			if (flags  MYSQLND_FETCH_NUM) {
@@ -1085,23 +1085,23 @@
   hashing of the column name, which is not needed as it can be precomputed.
 */
 Z_ADDREF_P(data);
-if (zend_hash_key-is_numeric == FALSE) {
+if (hash_key-is_numeric == FALSE) {
 #if MYSQLND_UNICODE
 	zend_u_hash_quick_update(Z_ARRVAL_P(row), IS_UNICODE,
-			 zend_hash_key-ustr,
-			 zend_hash_key-ulen + 1,
-			 zend_hash_key-key,
+			 hash_key-ustr,
+			 hash_key-ulen + 1,
+			 hash_key-key,
 			 (void *) data, sizeof(zval *), NULL);
 #else
 	zend_hash_quick_update(Z_ARRVAL_P(row),
 		   field-name,
 		   field-name_length + 1,
-		   zend_hash_key-key,
+		   hash_key-key,
 	

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 08:17:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304065

Log:
fix recent TSRM build break, with --enable-debug

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-10-05 
03:33:46 UTC (rev 304064)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-10-05 
08:17:33 UTC (rev 304065)
@@ -41,7 +41,7 @@

 /* {{{ mysqlnd_set_sock_no_delay */
 static int
-mysqlnd_set_sock_no_delay(php_stream * stream)
+mysqlnd_set_sock_no_delay(php_stream * stream TSRMLS_DC)
 {

int socketd = ((php_netstream_data_t*)stream-abstract)-socket;
@@ -183,7 +183,7 @@

if (!memcmp(scheme, tcp://, sizeof(tcp://) - 1)) {
/* TCP - Set TCP_NODELAY */
-   mysqlnd_set_sock_no_delay(net-stream);
+   mysqlnd_set_sock_no_delay(net-stream TSRMLS_CC);
}

{

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-10-05 03:33:46 UTC (rev 
304064)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-10-05 08:17:33 UTC (rev 
304065)
@@ -41,7 +41,7 @@

 /* {{{ mysqlnd_set_sock_no_delay */
 static int
-mysqlnd_set_sock_no_delay(php_stream * stream)
+mysqlnd_set_sock_no_delay(php_stream * stream TSRMLS_DC)
 {

int socketd = ((php_netstream_data_t*)stream-abstract)-socket;
@@ -190,7 +190,7 @@

if (!memcmp(scheme, tcp://, sizeof(tcp://) - 1)) {
/* TCP - Set TCP_NODELAY */
-   mysqlnd_set_sock_no_delay(net-stream);
+   mysqlnd_set_sock_no_delay(net-stream TSRMLS_CC);
}

{

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 08:56:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304068

Log:
fix types

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-05 08:50:04 UTC (rev 304067)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-05 08:56:21 UTC (rev 304068)
@@ -1106,7 +1106,7 @@
 static enum_func_status
 php_mysqlnd_read_row_ex(MYSQLND * conn, MYSQLND_MEMORY_POOL * 
result_set_memory_pool,
MYSQLND_MEMORY_POOL_CHUNK 
**buffer,
-   uint64_t *data_size, zend_bool 
persistent_alloc,
+   size_t *data_size, zend_bool 
persistent_alloc,
unsigned int 
prealloc_more_bytes TSRMLS_DC)
 {
enum_func_status ret = PASS;
@@ -1527,7 +1527,7 @@
size_t old_chunk_size = net-stream-chunk_size;
MYSQLND_PACKET_ROW *packet= (MYSQLND_PACKET_ROW *) _packet;
size_t post_alloc_for_bit_fields = 0;
-   uint64_t data_size = 0;
+   size_t data_size = 0;

DBG_ENTER(php_mysqlnd_rowp_read);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-05 
08:50:04 UTC (rev 304067)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-05 
08:56:21 UTC (rev 304068)
@@ -1106,7 +1106,7 @@
 static enum_func_status
 php_mysqlnd_read_row_ex(MYSQLND * conn, MYSQLND_MEMORY_POOL * 
result_set_memory_pool,
MYSQLND_MEMORY_POOL_CHUNK 
**buffer,
-   uint64_t *data_size, zend_bool 
persistent_alloc,
+   size_t *data_size, zend_bool 
persistent_alloc,
unsigned int 
prealloc_more_bytes TSRMLS_DC)
 {
enum_func_status ret = PASS;
@@ -1527,7 +1527,7 @@
size_t old_chunk_size = net-stream-chunk_size;
MYSQLND_PACKET_ROW *packet= (MYSQLND_PACKET_ROW *) _packet;
size_t post_alloc_for_bit_fields = 0;
-   uint64_t data_size = 0;
+   size_t data_size = 0;

DBG_ENTER(php_mysqlnd_rowp_read);


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 10:30:00 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304075

Log:
fixing more types

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-10-05 
10:09:05 UTC (rev 304074)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-10-05 
10:30:00 UTC (rev 304075)
@@ -44,7 +44,7 @@

 struct st_mysqlnd_memory_pool_chunk
 {
-   uint64_tapp;
+   size_t  app;
MYSQLND_MEMORY_POOL *pool;
zend_uchar  *ptr;
unsigned intsize;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-10-05 10:09:05 UTC 
(rev 304074)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-10-05 10:30:00 UTC 
(rev 304075)
@@ -44,7 +44,7 @@

 struct st_mysqlnd_memory_pool_chunk
 {
-   uint64_tapp;
+   size_t  app;
MYSQLND_MEMORY_POOL *pool;
zend_uchar  *ptr;
unsigned intsize;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 11:08:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304081

Log:
add some safe casts

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-05 11:02:10 UTC (rev 304080)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-05 11:08:21 UTC (rev 304081)
@@ -1392,7 +1392,7 @@
 #else
_atoi64((char *) p);
 #endif
-   ZVAL_LONG(*current_field, v);
+   ZVAL_LONG(*current_field, (long) v); /* 
the cast is safe */
} else {
uint64_t v =
 #ifndef PHP_WIN32
@@ -1414,7 +1414,7 @@
{
ZVAL_STRINGL(*current_field, 
(char *)p, len, 0);
} else {
-   ZVAL_LONG(*current_field, 
(int64_t)v);
+   ZVAL_LONG(*current_field, 
(long) v); /* the cast is safe */
}
}
*(p + len) = save;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-05 
11:02:10 UTC (rev 304080)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-05 
11:08:21 UTC (rev 304081)
@@ -1392,7 +1392,7 @@
 #else
_atoi64((char *) p);
 #endif
-   ZVAL_LONG(*current_field, v);
+   ZVAL_LONG(*current_field, (long) v); /* 
the cast is safe */
} else {
uint64_t v =
 #ifndef PHP_WIN32
@@ -1414,7 +1414,7 @@
{
ZVAL_STRINGL(*current_field, 
(char *)p, len, 0);
} else {
-   ZVAL_LONG(*current_field, 
(int64_t)v);
+   ZVAL_LONG(*current_field, 
(long) v); /* the cast is safe */
}
}
*(p + len) = save;

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 14:56:49 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304104

Log:
remove trailing commas in enums

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-10-05 14:41:08 UTC (rev 304103)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-10-05 14:56:49 UTC (rev 304104)
@@ -100,21 +100,21 @@
 typedef enum mysqlnd_extension
 {
MYSQLND_MYSQL = 0,
-   MYSQLND_MYSQLI,
+   MYSQLND_MYSQLI
 } enum_mysqlnd_extension;

 enum
 {
MYSQLND_FETCH_ASSOC = 1,
MYSQLND_FETCH_NUM = 2,
-   MYSQLND_FETCH_BOTH = 1|2,
+   MYSQLND_FETCH_BOTH = 1|2
 };

 /* Follow libmysql convention */
 typedef enum func_status
 {
PASS = 0,
-   FAIL = 1,
+   FAIL = 1
 } enum_func_status;

 typedef enum mysqlnd_query_type
@@ -296,7 +296,7 @@
CONN_SENDING_LOAD_DATA,
CONN_FETCHING_DATA,
CONN_NEXT_RESULT_PENDING,
-   CONN_QUIT_SENT, /* object is destroyed at this stage */
+   CONN_QUIT_SENT /* object is destroyed at this stage */
 } enum_mysqlnd_connection_state;


@@ -307,7 +307,7 @@
MYSQLND_STMT_EXECUTED,
MYSQLND_STMT_WAITING_USE_OR_STORE,
MYSQLND_STMT_USE_OR_STORE_CALLED,
-   MYSQLND_STMT_USER_FETCHING, /* fetch_row_buff or fetch_row_unbuf */
+   MYSQLND_STMT_USER_FETCHING /* fetch_row_buff or fetch_row_unbuf */
 } enum_mysqlnd_stmt_state;


@@ -520,7 +520,7 @@
PROT_STATS_PACKET,
PROT_PREPARE_RESP_PACKET,
PROT_CHG_USER_RESP_PACKET,
-   PROT_LAST, /* should always be last */
+   PROT_LAST /* should always be last */
 };



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-10-05 14:41:08 UTC 
(rev 304103)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-10-05 14:56:49 UTC 
(rev 304104)
@@ -100,21 +100,21 @@
 typedef enum mysqlnd_extension
 {
MYSQLND_MYSQL = 0,
-   MYSQLND_MYSQLI,
+   MYSQLND_MYSQLI
 } enum_mysqlnd_extension;

 enum
 {
MYSQLND_FETCH_ASSOC = 1,
MYSQLND_FETCH_NUM = 2,
-   MYSQLND_FETCH_BOTH = 1|2,
+   MYSQLND_FETCH_BOTH = 1|2
 };

 /* Follow libmysql convention */
 typedef enum func_status
 {
PASS = 0,
-   FAIL = 1,
+   FAIL = 1
 } enum_func_status;

 typedef enum mysqlnd_query_type
@@ -296,7 +296,7 @@
CONN_SENDING_LOAD_DATA,
CONN_FETCHING_DATA,
CONN_NEXT_RESULT_PENDING,
-   CONN_QUIT_SENT, /* object is destroyed at this stage */
+   CONN_QUIT_SENT /* object is destroyed at this stage */
 } enum_mysqlnd_connection_state;


@@ -307,7 +307,7 @@
MYSQLND_STMT_EXECUTED,
MYSQLND_STMT_WAITING_USE_OR_STORE,
MYSQLND_STMT_USE_OR_STORE_CALLED,
-   MYSQLND_STMT_USER_FETCHING, /* fetch_row_buff or fetch_row_unbuf */
+   MYSQLND_STMT_USER_FETCHING /* fetch_row_buff or fetch_row_unbuf */
 } enum_mysqlnd_stmt_state;


@@ -520,7 +520,7 @@
PROT_STATS_PACKET,
PROT_PREPARE_RESP_PACKET,
PROT_CHG_USER_RESP_PACKET,
-   PROT_LAST, /* should always be last */
+   PROT_LAST /* should always be last */
 };



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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 16:27:49 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304112

Log:
rename parameter, should not conflict with global symbol -
the socket function

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-10-05 16:26:18 UTC (rev 304111)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-10-05 16:27:49 UTC (rev 304112)
@@ -549,7 +549,7 @@
 		 const char *passwd, unsigned int passwd_len,
 		 const char *db, unsigned int db_len,
 		 unsigned int port,
-		 const char *socket,
+		 const char * socket_or_pipe,
 		 unsigned int mysql_flags
 		 TSRMLS_DC)
 {
@@ -617,11 +617,11 @@
 		int transport_len;
 #ifndef PHP_WIN32
 		if (host_len == sizeof(localhost) - 1  !strncasecmp(host, localhost, host_len)) {
-			DBG_INF_FMT(socket=%s, socket? socket:n/a);
-			if (!socket) {
-socket = /tmp/mysql.sock;
+			DBG_INF_FMT(socket=%s, socket_or_pipe? socket_or_pipe:n/a);
+			if (!socket_or_pipe) {
+socket_or_pipe = /tmp/mysql.sock;
 			}
-			transport_len = spprintf(transport, 0, unix://%s, socket);
+			transport_len = spprintf(transport, 0, unix://%s, socket_or_pipe);
 			unix_socket = TRUE;
 		} else
 #endif
@@ -764,7 +764,7 @@
 }
 			}
 		} else {
-			conn-unix_socket	= mnd_pestrdup(socket, conn-persistent);
+			conn-unix_socket	= mnd_pestrdup(socket_or_pipe, conn-persistent);
 			conn-host_info		= mnd_pestrdup(Localhost via UNIX socket, conn-persistent);
 			if (!conn-unix_socket || !conn-host_info) {
 SET_OOM_ERROR(conn-error_info);
@@ -850,7 +850,7 @@
 		 const char *passwd, unsigned int passwd_len,
 		 const char *db, unsigned int db_len,
 		 unsigned int port,
-		 const char *socket,
+		 const char *socket_or_pipe,
 		 unsigned int mysql_flags
 		 TSRMLS_DC)
 {
@@ -868,7 +868,7 @@
 		}
 	}

-	ret = conn-m-connect(conn, host, user, passwd, passwd_len, db, db_len, port, socket, mysql_flags TSRMLS_CC);
+	ret = conn-m-connect(conn, host, user, passwd, passwd_len, db, db_len, port, socket_or_pipe, mysql_flags TSRMLS_CC);

 	if (ret == FAIL) {
 		if (self_alloced) {

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h	2010-10-05 16:26:18 UTC (rev 304111)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h	2010-10-05 16:27:49 UTC (rev 304112)
@@ -102,7 +102,7 @@
 		  const char *passwd, unsigned int passwd_len,
 		  const char *db, unsigned int db_len,
 		  unsigned int port,
-		  const char *socket,
+		  const char *socket_or_pipe,
 		  unsigned int mysql_flags
 		  TSRMLS_DC);


Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2010-10-05 16:26:18 UTC (rev 304111)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h	2010-10-05 16:27:49 UTC (rev 304112)
@@ -337,7 +337,7 @@


 typedef enum_func_status	(*func_mysqlnd_conn__init)(MYSQLND * conn TSRMLS_DC);
-typedef enum_func_status	(*func_mysqlnd_conn__connect)(MYSQLND *conn, const char *host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket, unsigned int mysql_flags TSRMLS_DC);
+typedef enum_func_status	(*func_mysqlnd_conn__connect)(MYSQLND *conn, const char *host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC);
 typedef ulong(*func_mysqlnd_conn__escape_string)(const MYSQLND * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
 typedef enum_func_status	(*func_mysqlnd_conn__set_charset)(MYSQLND * const conn, const char * const charset TSRMLS_DC);
 typedef enum_func_status	(*func_mysqlnd_conn__query)(MYSQLND *conn, const char *query, unsigned int query_len TSRMLS_DC);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c	2010-10-05 16:26:18 UTC (rev 304111)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c	2010-10-05 16:27:49 UTC (rev 304112)
@@ -547,7 +547,7 @@
 		 const char *passwd, unsigned int passwd_len,
 		 const char *db, unsigned int db_len,
 		 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 16:54:14 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304113

Log:
Fix compiler warnings - on 32bit size_t is smaller than uint64_t, although
we will never hit this the compiler should be happy.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
16:27:49 UTC (rev 304112)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
16:54:14 UTC (rev 304113)
@@ -1147,7 +1147,7 @@
goto end;
}
if (free_rows) {
-   set-row_buffers = mnd_pemalloc(free_rows * 
sizeof(MYSQLND_MEMORY_POOL_CHUNK *), to_cache);
+   set-row_buffers = mnd_pemalloc((size_t)(free_rows * 
sizeof(MYSQLND_MEMORY_POOL_CHUNK *)), to_cache);
if (!set-row_buffers) {
SET_OOM_ERROR(conn-error_info);
ret = FAIL;
@@ -1181,8 +1181,15 @@
uint64_t total_allocated_rows = free_rows = next_extend 
= next_extend * 11 / 10; /* extend with 10% */
MYSQLND_MEMORY_POOL_CHUNK ** new_row_buffers;
total_allocated_rows += set-row_count;
+
+   /* don't try to allocate more than possible - 
mnd_XXalloc expects size_t, and it can have narrower range than uint64_t */
+   if (total_allocated_rows * 
sizeof(MYSQLND_MEMORY_POOL_CHUNK *)  SIZE_MAX) {
+   SET_OOM_ERROR(conn-error_info);
+   ret = FAIL;
+   goto end;
+   }
new_row_buffers = mnd_perealloc(set-row_buffers,
-   
total_allocated_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *),
+   
(size_t)(total_allocated_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *)),

set-persistent);
if (!new_row_buffers) {
SET_OOM_ERROR(conn-error_info);
@@ -1209,8 +1216,14 @@
}
/* Overflow ? */
if (set-row_count) {
+   /* don't try to allocate more than possible - mnd_XXalloc 
expects size_t, and it can have narrower range than uint64_t */
+   if (set-row_count * meta-field_count * sizeof(zval *)  
SIZE_MAX) {
+   SET_OOM_ERROR(conn-error_info);
+   ret = FAIL;
+   goto end;
+   }
/* if pecalloc is used valgrind barks gcc version 4.3.1 
20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE Linux) */
-   set-data = mnd_pemalloc(set-row_count * meta-field_count * 
sizeof(zval *), to_cache);
+   set-data = mnd_pemalloc((size_t)(set-row_count * 
meta-field_count * sizeof(zval *)), to_cache);
if (!set-data) {
SET_OOM_ERROR(conn-error_info);
ret = FAIL;
@@ -1231,8 +1244,14 @@
}
/* save some memory */
if (free_rows) {
+   /* don't try to allocate more than possible - mnd_XXalloc 
expects size_t, and it can have narrower range than uint64_t */
+   if (set-row_count * sizeof(MYSQLND_MEMORY_POOL_CHUNK *)  
SIZE_MAX) {
+   SET_OOM_ERROR(conn-error_info);
+   ret = FAIL;
+   goto end;
+   }
set-row_buffers = mnd_perealloc(set-row_buffers,
-   
 set-row_count * sizeof(MYSQLND_MEMORY_POOL_CHUNK *),
+   
 (size_t) (set-row_count * sizeof(MYSQLND_MEMORY_POOL_CHUNK *)),

 set-persistent);
}

@@ -1593,7 +1612,8 @@
DBG_VOID_RETURN;
}

-   mysqlnd_array_init(return_value, (unsigned int) set? set-row_count : 
4); /* 4 is a magic value */
+   /* 4 is a magic value. The cast is safe, if larger then the array will 
be later extended - no big deal :) */
+   mysqlnd_array_init(return_value, (unsigned int) set? (uint) 
set-row_count : 4);

do {
MAKE_STD_ZVAL(row);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-10-05 16:27:49 UTC 
(rev 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 17:03:50 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304114

Log:
Rename a method so it doesn't clash with a global symbol - a function
Fix compiler waring by extening the type of a variable

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-10-05 16:54:14 UTC 
(rev 304113)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-10-05 17:03:50 UTC 
(rev 304114)
@@ -1368,14 +1368,14 @@
 /* }}} */


-/* {{{ mysqlnd_conn::stat */
+/* {{{ mysqlnd_conn::statistic */
 static enum_func_status
-MYSQLND_METHOD(mysqlnd_conn, stat)(MYSQLND * conn, char **message, unsigned 
int * message_len TSRMLS_DC)
+MYSQLND_METHOD(mysqlnd_conn, statistic)(MYSQLND * conn, char **message, 
unsigned int * message_len TSRMLS_DC)
 {
enum_func_status ret;
MYSQLND_PACKET_STATS * stats_header;

-   DBG_ENTER(mysqlnd_conn::stat);
+   DBG_ENTER(mysqlnd_conn::statistic);
DBG_INF_FMT(conn=%llu, conn-thread_id);

ret = conn-m-simple_command(conn, COM_STATISTICS, NULL, 0, PROT_LAST, 
FALSE, TRUE TSRMLS_CC);
@@ -1560,13 +1560,13 @@
STAT_CLOSE_IMPLICIT,
STAT_CLOSE_DISCONNECT
};
-   enum_mysqlnd_collected_stats stat = close_type_to_stat_map[close_type];
+   enum_mysqlnd_collected_stats statistic = 
close_type_to_stat_map[close_type];

DBG_ENTER(mysqlnd_conn::close);
DBG_INF_FMT(conn=%llu, conn-thread_id);

if (conn-state = CONN_READY) {
-   MYSQLND_INC_CONN_STATISTIC(conn-stats, stat);
+   MYSQLND_INC_CONN_STATISTIC(conn-stats, statistic);
MYSQLND_DEC_CONN_STATISTIC(conn-stats, 
STAT_OPENED_CONNECTIONS);
if (conn-persistent) {
MYSQLND_DEC_CONN_STATISTIC(conn-stats, 
STAT_OPENED_PERSISTENT_CONNECTIONS);
@@ -2256,7 +2256,7 @@

MYSQLND_METHOD(mysqlnd_conn, get_server_version),
MYSQLND_METHOD(mysqlnd_conn, get_server_info),
-   MYSQLND_METHOD(mysqlnd_conn, stat),
+   MYSQLND_METHOD(mysqlnd_conn, statistic),
MYSQLND_METHOD(mysqlnd_conn, get_host_info),
MYSQLND_METHOD(mysqlnd_conn, get_proto_info),
MYSQLND_METHOD(mysqlnd_conn, info),

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
16:54:14 UTC (rev 304113)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
17:03:50 UTC (rev 304114)
@@ -194,7 +194,7 @@
 {
MYSQLND_RES_BUFFERED *set = result-stored_data;
unsigned int field_count = result-field_count;
-   int row;
+   int64_t row;

DBG_ENTER(mysqlnd_res::free_buffered_data);
DBG_INF_FMT(Freeing MYSQLND_LLU_SPEC row(s), set-row_count);
@@ -211,7 +211,7 @@
int col;

if (current_row != NULL) {
-   for (col = field_count - 1; col = 0; --col) {
+   for (col = (int64_t) field_count - 1; col = 0; 
--col) {
if (current_row[col]) {
zend_bool copy_ctor_called;

mysqlnd_palloc_zval_ptr_dtor((current_row[col]), result-type, 
copy_ctor_called TSRMLS_CC);
@@ -1229,7 +1229,7 @@
ret = FAIL;
goto end;
}
-   memset(set-data, 0, set-row_count * meta-field_count * 
sizeof(zval *));
+   memset(set-data, 0, (size_t)(set-row_count * 
meta-field_count * sizeof(zval *)));
}

MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn-stats,

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-10-05 16:54:14 UTC (rev 
304113)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-10-05 17:03:50 UTC (rev 
304114)
@@ -1391,14 +1391,14 @@
 /* }}} */


-/* {{{ mysqlnd_conn::stat */
+/* {{{ mysqlnd_conn::statistic */
 static enum_func_status
-MYSQLND_METHOD(mysqlnd_conn, stat)(MYSQLND * conn, char **message, unsigned 
int * message_len TSRMLS_DC)
+MYSQLND_METHOD(mysqlnd_conn, statistic)(MYSQLND * conn, char **message, 
unsigned int * message_len TSRMLS_DC)
 {
enum_func_status ret;
MYSQLND_PACKET_STATS * stats_header;

-   DBG_ENTER(mysqlnd_conn::stat);
+   DBG_ENTER(mysqlnd_conn::statistic);

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 17:10:47 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304115

Log:
two more compiler warnings fixed - size does matter

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
17:03:50 UTC (rev 304114)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-05 
17:10:47 UTC (rev 304115)
@@ -42,7 +42,7 @@
zval **data_cursor = result-stored_data? 
result-stored_data-data:NULL;
zval **data_begin = result-stored_data? result-stored_data-data:NULL;
unsigned int field_count = result-meta? result-meta-field_count : 0;
-   unsigned int row_count = result-stored_data? 
result-stored_data-row_count:0;
+   uint64_t row_count = result-stored_data? 
result-stored_data-row_count:0;
enum_func_status ret = PASS;
DBG_ENTER(mysqlnd_res::initialize_result_set_rest);

@@ -208,10 +208,10 @@
for (row = set-row_count - 1; row = 0; row--) {
zval **current_row = set-data + row * field_count;
MYSQLND_MEMORY_POOL_CHUNK *current_buffer = 
set-row_buffers[row];
-   int col;
+   int64_t col;

if (current_row != NULL) {
-   for (col = (int64_t) field_count - 1; col = 0; 
--col) {
+   for (col = field_count - 1; col = 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;

mysqlnd_palloc_zval_ptr_dtor((current_row[col]), result-type, 
copy_ctor_called TSRMLS_CC);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-10-05 17:03:50 UTC 
(rev 304114)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-10-05 17:10:47 UTC 
(rev 304115)
@@ -42,7 +42,7 @@
zval **data_cursor = result-stored_data? 
result-stored_data-data:NULL;
zval **data_begin = result-stored_data? result-stored_data-data:NULL;
unsigned int field_count = result-meta? result-meta-field_count : 0;
-   unsigned int row_count = result-stored_data? 
result-stored_data-row_count:0;
+   uint64_t row_count = result-stored_data? 
result-stored_data-row_count:0;
enum_func_status ret = PASS;
DBG_ENTER(mysqlnd_res::initialize_result_set_rest);

@@ -208,10 +208,10 @@
for (row = set-row_count - 1; row = 0; row--) {
zval **current_row = set-data + row * field_count;
MYSQLND_MEMORY_POOL_CHUNK *current_buffer = 
set-row_buffers[row];
-   int col;
+   int64_t col;

if (current_row != NULL) {
-   for (col = (int64_t) field_count - 1; col = 0; 
--col) {
+   for (col = field_count - 1; col = 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;

mysqlnd_palloc_zval_ptr_dtor((current_row[col]), result-type, 
copy_ctor_called TSRMLS_CC);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h trunk/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_

2010-10-05 Thread Andrey Hristov
andrey   Tue, 05 Oct 2010 17:20:00 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304116

Log:
rename parameter name - should not shadow the global symbol alloca

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2010-10-05 17:10:47 UTC (rev 304115)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2010-10-05 17:20:00 UTC (rev 304116)
@@ -391,14 +391,14 @@

 /* {{{ php_mysqlnd_greet_free_mem */
 static
-void php_mysqlnd_greet_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_greet_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
 	MYSQLND_PACKET_GREET *p= (MYSQLND_PACKET_GREET *) _packet;
 	if (p-server_version) {
 		efree(p-server_version);
 		p-server_version = NULL;
 	}
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(p, p-header.persistent);
 	}
 }
@@ -508,9 +508,9 @@

 /* {{{ php_mysqlnd_auth_free_mem */
 static
-void php_mysqlnd_auth_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_auth_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
-	if (!alloca) {
+	if (!stack_allocation) {
 		MYSQLND_PACKET_AUTH * p = (MYSQLND_PACKET_AUTH *) _packet;
 		mnd_pefree(p, p-header.persistent);
 	}
@@ -591,14 +591,14 @@

 /* {{{ php_mysqlnd_ok_free_mem */
 static void
-php_mysqlnd_ok_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+php_mysqlnd_ok_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
 	MYSQLND_PACKET_OK *p= (MYSQLND_PACKET_OK *) _packet;
 	if (p-message) {
 		mnd_efree(p-message);
 		p-message = NULL;
 	}
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(p, p-header.persistent);
 	}
 }
@@ -674,9 +674,9 @@

 /* {{{ php_mysqlnd_eof_free_mem */
 static
-void php_mysqlnd_eof_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_eof_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(_packet, ((MYSQLND_PACKET_EOF *)_packet)-header.persistent);
 	}
 }
@@ -748,9 +748,9 @@

 /* {{{ php_mysqlnd_cmd_free_mem */
 static
-void php_mysqlnd_cmd_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_cmd_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
-	if (!alloca) {
+	if (!stack_allocation) {
 		MYSQLND_PACKET_COMMAND * p = (MYSQLND_PACKET_COMMAND *) _packet;
 		mnd_pefree(p, p-header.persistent);
 	}
@@ -864,7 +864,7 @@

 /* {{{ php_mysqlnd_rset_header_free_mem */
 static
-void php_mysqlnd_rset_header_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_rset_header_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
 	MYSQLND_PACKET_RSET_HEADER *p= (MYSQLND_PACKET_RSET_HEADER *) _packet;
 	DBG_ENTER(php_mysqlnd_rset_header_free_mem);
@@ -872,7 +872,7 @@
 		mnd_efree(p-info_or_local_file);
 		p-info_or_local_file = NULL;
 	}
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(p, p-header.persistent);
 	}
 	DBG_VOID_RETURN;
@@ -1091,11 +1091,11 @@

 /* {{{ php_mysqlnd_rset_field_free_mem */
 static
-void php_mysqlnd_rset_field_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void php_mysqlnd_rset_field_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
 	MYSQLND_PACKET_RES_FIELD *p= (MYSQLND_PACKET_RES_FIELD *) _packet;
 	/* p-metadata was passed to us as temporal buffer */
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(p, p-header.persistent);
 	}
 }
@@ -1614,7 +1614,7 @@

 /* {{{ php_mysqlnd_rowp_free_mem */
 static void
-php_mysqlnd_rowp_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+php_mysqlnd_rowp_free_mem(void *_packet, zend_bool stack_allocation TSRMLS_DC)
 {
 	MYSQLND_PACKET_ROW *p;

@@ -1624,7 +1624,7 @@
 		p-row_buffer-free_chunk(p-row_buffer TSRMLS_CC);
 		p-row_buffer = NULL;
 	}
-	DBG_INF_FMT(alloca=%u persistent=%u, (int)alloca, (int)p-header.persistent);
+	DBG_INF_FMT(stack_allocation=%u persistent=%u, (int)stack_allocation, (int)p-header.persistent);
 	/*
 	  Don't free packet-fields :
 	  - normal queries - store_result() | fetch_row_unbuffered() will transfer
@@ -1632,7 +1632,7 @@
 	  - PS will pass in it the bound variables, we have to use them! and of course
 	not free the array. As it is passed to us, we should not clean it ourselves.
 	*/
-	if (!alloca) {
+	if (!stack_allocation) {
 		mnd_pefree(p, p-header.persistent);
 	}
 	DBG_VOID_RETURN;
@@ -1664,14 +1664,14 @@

 /* {{{ php_mysqlnd_stats_free_mem */
 static
-void php_mysqlnd_stats_free_mem(void *_packet, zend_bool alloca TSRMLS_DC)
+void 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2010-10-04 Thread Andrey Hristov
andrey   Mon, 04 Oct 2010 12:59:29 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304001

Log:
Even better patch

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-10-04 12:55:08 UTC (rev 304000)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-10-04 12:59:29 UTC (rev 304001)
@@ -481,22 +481,18 @@
short/long to/from some place in memory V should be a (not
register) variable, M is a pointer to byte */

-#ifdef WORDS_BIGENDIAN
-
 #ifndef float8get
+
+#ifdef WORDS_BIGENDIAN
 #define float8get(V,M) memcpy((char*) (V),(char*)  (M), 
sizeof(double))
 #define float8store(T,V)   memcpy((char*)  (T),(char*) (V), 
sizeof(double))
-#endif /* float8get */
-
 #else
-
-#ifndef float8get
 #define float8get(V,M)memcpy((char*) (V),(char*) (M),sizeof(double))
 #define float8store(T,V)  memcpy((char*) (T),(char*) (V),sizeof(double))
-#endif /* float8get */
-
 #endif /* WORDS_BIGENDIAN */

+#endif /* float8get */
+
 #endif /* MYSQLND_PORTABILITY_H */



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-10-04 12:55:08 UTC 
(rev 304000)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-10-04 12:59:29 UTC 
(rev 304001)
@@ -481,22 +481,18 @@
short/long to/from some place in memory V should be a (not
register) variable, M is a pointer to byte */

-#ifdef WORDS_BIGENDIAN
-
 #ifndef float8get
+
+#ifdef WORDS_BIGENDIAN
 #define float8get(V,M) memcpy((char*) (V),(char*)  (M), 
sizeof(double))
 #define float8store(T,V)   memcpy((char*)  (T),(char*) (V), 
sizeof(double))
-#endif /* float8get */
-
 #else
-
-#ifndef float8get
 #define float8get(V,M)memcpy((char*) (V),(char*) (M),sizeof(double))
 #define float8store(T,V)  memcpy((char*) (T),(char*) (V),sizeof(double))
-#endif /* float8get */
-
 #endif /* WORDS_BIGENDIAN */

+#endif /* float8get */
+
 #endif /* MYSQLND_PORTABILITY_H */



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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-10-04 Thread Ulf Wendel
uw   Mon, 04 Oct 2010 10:58:05 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303980

Log:
Fixing compiler warning.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-10-04 
10:51:44 UTC (rev 303979)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-10-04 
10:58:05 UTC (rev 303980)
@@ -136,7 +136,7 @@
 /* }}} */


-PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd)


 /* {{{ PHP_GINIT_FUNCTION

Modified: php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-10-04 10:51:44 UTC (rev 
303979)
+++ php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-10-04 10:58:05 UTC (rev 
303980)
@@ -136,7 +136,7 @@
 /* }}} */


-PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd)


 /* {{{ PHP_GINIT_FUNCTION

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-10-04 Thread Ulf Wendel

Hi Kalle!

Thanks for pointing out the warnings!

Am 04.10.2010 13:30, Kalle Sommer Nielsen schrieb:

2010/10/4 Ulf Wendel u...@php.net:

uw   Mon, 04 Oct 2010 10:58:05 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303980

Log:
Fixing compiler warning.



After todays commits, the following new warnings appear on Windows,
and before we had none:
ext\mysqli\mysqli.c(898) : warning C4067: unexpected tokens following
preprocess or directive - expected a newline


Weird how whitespace changes have trigged this warning. I'm puzzled. If 
you check my commit, you should find that I have not touched that code:


http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c?r1=303897r2=303973
http://svn.php.net/viewvc/php/php-src/trunk/ext/mysqli/mysqli.c?r1=303897r2=303973

I'll apply the fix you proposed in a private mail - thanks!


ext\mysqli\mysqli.c(1091) : warning C4101: 'i' : unreferenced local variable
ext\mysqli\mysqli.c(1090) : warning C4101: 'row' : unreferenced local variable
ext\mysqli\mysqli.c(1092) : warning C4101: 'fields' : unreferenced
local variable
ext\mysqli\mysqli.c(1093) : warning C4101: 'field_len' : unreferenced
local variable


I don't understand that one and I'm not getting it (with VS2008 on Win32).

Allow me to say again that I believe not to have touched that code. It 
makes me feel a bit better. Of course the warning itself is not welcome...



ext\mysqli\mysqli_driver.c(155) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'


Sorry, I don't get that one.


These are all compiled using php-trunk r303980. Since all the mysql
extensions are in sync, I'm sure they appear on PHP_5_3 aswell.


Yes, they are almost in sync.


Also, while you are at it, would you mind killing the ones in mysqlnd aswell?


MySQLnd - oh, that's Andrey's baby :-). I'll check what we can do about 
the warnings and what other Windows compiler have to say...


Ulf



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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c trunk/ext/mysqlnd/mysqlnd_ps_codec.c

2010-10-04 Thread Andrey Hristov
andrey   Mon, 04 Oct 2010 14:12:31 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304023

Log:
add some safe casts - lower the number of warnings by 2

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04 
14:06:53 UTC (rev 304022)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04 
14:12:31 UTC (rev 304023)
@@ -84,7 +84,7 @@
 #endif /* #if SIZEOF_LONG==4 */
{
if (byte_count  8 || uval = L64(9223372036854775807)) 
{
-   ZVAL_LONG(zv, uval);
+   ZVAL_LONG(zv, (long) uval); /* the cast is 
safe, we are in the range */
} else {
DBG_INF(stringify);
tmp_len = sprintf((char *)tmp, 
MYSQLND_LLU_SPEC, uval);
@@ -112,7 +112,7 @@
} else
 #endif /* SIZEOF */
{
-   ZVAL_LONG(zv, lval);
+   ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are 
in the range */
}
}


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-10-04 14:06:53 UTC 
(rev 304022)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-10-04 14:12:31 UTC 
(rev 304023)
@@ -84,7 +84,7 @@
 #endif /* #if SIZEOF_LONG==4 */
{
if (byte_count  8 || uval = L64(9223372036854775807)) 
{
-   ZVAL_LONG(zv, uval);
+   ZVAL_LONG(zv, (long) uval); /* the cast is 
safe, we are in the range */
} else {
DBG_INF(stringify);
tmp_len = sprintf((char *)tmp, 
MYSQLND_LLU_SPEC, uval);
@@ -112,7 +112,7 @@
} else
 #endif /* SIZEOF */
{
-   ZVAL_LONG(zv, lval);
+   ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are 
in the range */
}
}


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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-10-04 Thread Kalle Sommer Nielsen
Hi Ulf

2010/10/4 Ulf Wendel u...@php.net:
 uw                                       Mon, 04 Oct 2010 10:58:05 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=303980

 Log:
 Fixing compiler warning.


After todays commits, the following new warnings appear on Windows,
and before we had none:
ext\mysqli\mysqli.c(898) : warning C4067: unexpected tokens following
preprocess or directive - expected a newline
ext\mysqli\mysqli.c(1091) : warning C4101: 'i' : unreferenced local variable
ext\mysqli\mysqli.c(1090) : warning C4101: 'row' : unreferenced local variable
ext\mysqli\mysqli.c(1092) : warning C4101: 'fields' : unreferenced
local variable
ext\mysqli\mysqli.c(1093) : warning C4101: 'field_len' : unreferenced
local variable
ext\mysqli\mysqli_driver.c(155) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(155) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(156) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(156) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(157) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(157) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(158) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(158) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(159) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(159) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(160) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(160) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(161) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_driver.c(161) : warning C4047: 'initializing' :
'int' differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(181) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(198) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(253) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(298) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(309) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(310) : warning C4244: '=' : conversion from
'uint64_t' to 'long', possible loss of data
ext\mysqli\mysqli_prop.c(341) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(341) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(342) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(342) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(343) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(343) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(344) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(344) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(345) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(345) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(346) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(346) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(347) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(347) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(348) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(348) : warning C4047: 'initializing' : 'int'
differs in levels of indirection from 'void *'
ext\mysqli\mysqli_prop.c(349) : 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c trunk/ext/mysqlnd/mysqlnd_result_meta.c

2010-10-04 Thread Andrey Hristov
andrey   Mon, 04 Oct 2010 13:54:30 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304020

Log:
Fix const-ness

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c  
2010-10-04 13:51:35 UTC (rev 304019)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c  
2010-10-04 13:54:30 UTC (rev 304020)
@@ -52,7 +52,7 @@
   and modified for the needs of mysqlnd.
 */
 static zend_bool
-mysqlnd_is_key_numeric(char *key, size_t length, long *idx)
+mysqlnd_is_key_numeric(const char * key, size_t length, long *idx)
 {
register char * tmp = key;


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-10-04 13:51:35 UTC 
(rev 304019)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-10-04 13:54:30 UTC 
(rev 304020)
@@ -52,7 +52,7 @@
   and modified for the needs of mysqlnd.
 */
 static zend_bool
-mysqlnd_is_key_numeric(char *key, size_t length, long *idx)
+mysqlnd_is_key_numeric(const char * key, size_t length, long *idx)
 {
register char * tmp = key;


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2010-10-04 Thread Andrey Hristov
andrey   Mon, 04 Oct 2010 12:41:12 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303995

Log:
don't define twice the macro on some platforms

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-10-04 12:37:43 UTC (rev 303994)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-10-04 12:41:12 UTC (rev 303995)
@@ -483,8 +483,10 @@

 #ifdef WORDS_BIGENDIAN

+#ifndef float8get
 #define float8get(V,M) memcpy((char*) (V),(char*)  (M), 
sizeof(double))
 #define float8store(T,V)   memcpy((char*)  (T),(char*) (V), 
sizeof(double))
+#endif /* float8get */

 #else


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-10-04 12:37:43 UTC 
(rev 303994)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-10-04 12:41:12 UTC 
(rev 303995)
@@ -483,8 +483,10 @@

 #ifdef WORDS_BIGENDIAN

+#ifndef float8get
 #define float8get(V,M) memcpy((char*) (V),(char*)  (M), 
sizeof(double))
 #define float8store(T,V)   memcpy((char*)  (T),(char*) (V), 
sizeof(double))
+#endif /* float8get */

 #else


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.h

2010-10-04 Thread Ulf Wendel
uw   Mon, 04 Oct 2010 10:51:44 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303979

Log:
Fixing ext/mysqlnd/mysqlnd.h, line 287: warning: syntax error:  empty 
declaration

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-10-04 10:43:21 UTC 
(rev 303978)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-10-04 10:51:44 UTC 
(rev 303979)
@@ -284,7 +284,7 @@
longdebug_realloc_fail_threshold;
 ZEND_END_MODULE_GLOBALS(mysqlnd)

-PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd)

 #ifdef ZTS
 #define MYSQLND_G(v) TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-10-04 10:43:21 UTC (rev 
303978)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-10-04 10:51:44 UTC (rev 
303979)
@@ -284,7 +284,7 @@
longdebug_realloc_fail_threshold;
 ZEND_END_MODULE_GLOBALS(mysqlnd)

-PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd)

 #ifdef ZTS
 #define MYSQLND_G(v) TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_wireprotocol

2010-10-04 Thread Andrey Hristov
andrey   Mon, 04 Oct 2010 14:52:14 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304029

Log:
fix two more warnings

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-04 
14:21:09 UTC (rev 304028)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-10-04 
14:52:14 UTC (rev 304029)
@@ -49,7 +49,7 @@
if (!data_cursor || row_count == result-stored_data-initialized_rows) 
{
DBG_RETURN(ret);
}
-   while ((data_cursor - data_begin)  (row_count * field_count)) {
+   while ((data_cursor - data_begin)  (int)(row_count * field_count)) {
if (NULL == data_cursor[0]) {
enum_func_status rc = result-m.row_decoder(

result-stored_data-row_buffers[(data_cursor - data_begin) / field_count],

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-04 14:21:09 UTC (rev 304028)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-10-04 14:52:14 UTC (rev 304029)
@@ -243,7 +243,7 @@
}
}
if ((buf_len - (p - buf))  0) {
-   error_msg_len = MIN((buf_len - (p - buf)), 
error_buf_len - 1);
+   error_msg_len = MIN((int)((buf_len - (p - buf))), (int) 
(error_buf_len - 1));
memcpy(error, p, error_msg_len);
}
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-10-04 14:21:09 UTC 
(rev 304028)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-10-04 14:52:14 UTC 
(rev 304029)
@@ -49,7 +49,7 @@
if (!data_cursor || row_count == result-stored_data-initialized_rows) 
{
DBG_RETURN(ret);
}
-   while ((data_cursor - data_begin)  (row_count * field_count)) {
+   while ((data_cursor - data_begin)  (int)(row_count * field_count)) {
if (NULL == data_cursor[0]) {
enum_func_status rc = result-m.row_decoder(

result-stored_data-row_buffers[(data_cursor - data_begin) / field_count],

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-04 
14:21:09 UTC (rev 304028)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-10-04 
14:52:14 UTC (rev 304029)
@@ -243,7 +243,7 @@
}
}
if ((buf_len - (p - buf))  0) {
-   error_msg_len = MIN((buf_len - (p - buf)), 
error_buf_len - 1);
+   error_msg_len = MIN((int)((buf_len - (p - buf))), (int) 
(error_buf_len - 1));
memcpy(error, p, error_msg_len);
}
}

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-10-04 Thread Kalle Sommer Nielsen
kalleMon, 04 Oct 2010 21:04:25 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=304038

Log:
We do not need this TSRMLS_FETCH() call as we do not use any TSRM stuff in 
here, so we can get
a minor boost here in ZTS mode.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-10-04 
20:33:58 UTC (rev 304037)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-10-04 
21:04:25 UTC (rev 304038)
@@ -48,7 +48,6 @@
int ret = SUCCESS;
int flag = 1;
int result = setsockopt(socketd, IPPROTO_TCP,  TCP_NODELAY, (char *) 
flag, sizeof(int));
-   TSRMLS_FETCH();

DBG_ENTER(mysqlnd_set_sock_no_delay);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-10-04 20:33:58 UTC (rev 
304037)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-10-04 21:04:25 UTC (rev 
304038)
@@ -48,7 +48,6 @@
int ret = SUCCESS;
int flag = 1;
int result = setsockopt(socketd, IPPROTO_TCP,  TCP_NODELAY, (char *) 
flag, sizeof(int));
-   TSRMLS_FETCH();

DBG_ENTER(mysqlnd_set_sock_no_delay);


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2010-09-29 Thread Andrey Hristov
andrey   Wed, 29 Sep 2010 13:18:07 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303855

Log:
Fix a problem that leads to leaks in plugins that
use stmt local data - no free is called for statements
that are over-prepared

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-09-29 
11:40:57 UTC (rev 303854)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-09-29 
13:18:07 UTC (rev 303855)
@@ -433,13 +433,19 @@
}

if (stmt_to_prepare != stmt) {
-   /* Free old buffers, binding and resources on server */
-   s-m-net_close(s, TRUE TSRMLS_CC);
-
-   memcpy(stmt, stmt_to_prepare, sizeof(MYSQLND_STMT_DATA));
-
-   /* Now we will have a clean new statement object */
-   mnd_pefree(stmt_to_prepare, stmt_to_prepare-persistent);
+   /* swap */
+   size_t real_size = sizeof(MYSQLND_STMT) + 
mysqlnd_plugin_count() * sizeof(void *);
+   char * tmp_swap = mnd_malloc(real_size);
+   memcpy(tmp_swap, s, real_size);
+   memcpy(s, s_to_prepare, real_size);
+   memcpy(s_to_prepare, tmp_swap, real_size);
+   mnd_free(tmp_swap);
+   {
+   MYSQLND_STMT_DATA * tmp_swap_data = stmt_to_prepare;
+   stmt_to_prepare = stmt;
+   stmt = tmp_swap_data;
+   }
+   s_to_prepare-m-dtor(s_to_prepare, TRUE TSRMLS_CC);
}
stmt-state = MYSQLND_STMT_PREPARED;
DBG_INF(PASS);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-09-29 11:40:57 UTC (rev 
303854)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-09-29 13:18:07 UTC (rev 
303855)
@@ -433,13 +433,19 @@
}

if (stmt_to_prepare != stmt) {
-   /* Free old buffers, binding and resources on server */
-   s-m-net_close(s, TRUE TSRMLS_CC);
-
-   memcpy(stmt, stmt_to_prepare, sizeof(MYSQLND_STMT_DATA));
-
-   /* Now we will have a clean new statement object */
-   mnd_pefree(stmt_to_prepare, stmt_to_prepare-persistent);
+   /* swap */
+   size_t real_size = sizeof(MYSQLND_STMT) + 
mysqlnd_plugin_count() * sizeof(void *);
+   char * tmp_swap = mnd_malloc(real_size);
+   memcpy(tmp_swap, s, real_size);
+   memcpy(s, s_to_prepare, real_size);
+   memcpy(s_to_prepare, tmp_swap, real_size);
+   mnd_free(tmp_swap);
+   {
+   MYSQLND_STMT_DATA * tmp_swap_data = stmt_to_prepare;
+   stmt_to_prepare = stmt;
+   stmt = tmp_swap_data;
+   }
+   s_to_prepare-m-dtor(s_to_prepare, TRUE TSRMLS_CC);
}
stmt-state = MYSQLND_STMT_PREPARED;
DBG_INF(PASS);

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-28 Thread Andrey Hristov
andrey   Tue, 28 Sep 2010 14:36:18 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303828

Log:
add another hook, maybe the last one, for MYSQLND_STMT, which
was missed before

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-09-28 
14:35:37 UTC (rev 303827)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-09-28 
14:36:18 UTC (rev 303828)
@@ -52,8 +52,6 @@
 static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt 
TSRMLS_DC);
 static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, 
unsigned int param_no TSRMLS_DC);

-static void mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const stmt 
TSRMLS_DC);
-
 /* {{{ mysqlnd_stmt::store_result */
 static MYSQLND_RES *
 MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s TSRMLS_DC)
@@ -228,7 +226,7 @@
}

/* Free space for next result */
-   mysqlnd_internal_free_stmt_content(s TSRMLS_CC);
+   s-m-free_stmt_content(s TSRMLS_CC);

DBG_RETURN(s-m-parse_execute_response(s TSRMLS_CC));
 }
@@ -2062,12 +2060,12 @@
 /* }}} */


-/* {{{ mysqlnd_internal_free_stmt_content */
+/* {{{ mysqlnd_stmt::free_stmt_content */
 static void
-mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const s TSRMLS_DC)
+MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s 
TSRMLS_DC)
 {
MYSQLND_STMT_DATA * stmt = s? s-data:NULL;
-   DBG_ENTER(mysqlnd_internal_free_stmt_content);
+   DBG_ENTER(mysqlnd_stmt::free_stmt_content);
if (!stmt) {
DBG_VOID_RETURN;
}
@@ -2186,7 +2184,7 @@
stmt-execute_cmd_buffer.buffer = NULL;
}

-   mysqlnd_internal_free_stmt_content(s TSRMLS_CC);
+   s-m-free_stmt_content(s TSRMLS_CC);

if (stmt-conn) {
stmt-conn-m-free_reference(stmt-conn TSRMLS_CC);
@@ -2324,7 +2322,8 @@
MYSQLND_METHOD(mysqlnd_stmt, free_result_bind),
MYSQLND_METHOD(mysqlnd_stmt, server_status),
mysqlnd_stmt_execute_generate_request,
-   mysqlnd_stmt_execute_parse_response
+   mysqlnd_stmt_execute_parse_response,
+   MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)
 MYSQLND_CLASS_METHODS_END;



Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-28 
14:35:37 UTC (rev 303827)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-28 
14:36:18 UTC (rev 303828)
@@ -627,6 +627,7 @@
 typedef unsigned int   (*func_mysqlnd_stmt__server_status)(const 
MYSQLND_STMT * const stmt TSRMLS_DC);
 typedef enum_func_status   
(*func_mysqlnd_stmt__generate_execute_request)(MYSQLND_STMT * const s, 
zend_uchar ** request, size_t *request_len, zend_bool * free_buffer TSRMLS_DC);
 typedef enum_func_status   
(*func_mysqlnd_stmt__parse_execute_response)(MYSQLND_STMT * const s TSRMLS_DC);
+typedef void   
(*func_mysqlnd_stmt__free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC);

 struct st_mysqlnd_stmt_methods
 {
@@ -678,6 +679,8 @@

func_mysqlnd_stmt__generate_execute_request generate_execute_request;
func_mysqlnd_stmt__parse_execute_response parse_execute_response;
+
+   func_mysqlnd_stmt__free_stmt_content free_stmt_content;
 };



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-09-28 14:35:37 UTC (rev 
303827)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-09-28 14:36:18 UTC (rev 
303828)
@@ -52,8 +52,6 @@
 static void mysqlnd_stmt_separate_result_bind(MYSQLND_STMT * const stmt 
TSRMLS_DC);
 static void mysqlnd_stmt_separate_one_result_bind(MYSQLND_STMT * const stmt, 
unsigned int param_no TSRMLS_DC);

-static void mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const stmt 
TSRMLS_DC);
-
 /* {{{ mysqlnd_stmt::store_result */
 static MYSQLND_RES *
 MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s TSRMLS_DC)
@@ -228,7 +226,7 @@
}

/* Free space for next result */
-   mysqlnd_internal_free_stmt_content(s TSRMLS_CC);
+   s-m-free_stmt_content(s TSRMLS_CC);

DBG_RETURN(s-m-parse_execute_response(s TSRMLS_CC));
 }
@@ -2062,12 +2060,12 @@
 /* }}} */


-/* {{{ mysqlnd_internal_free_stmt_content */
+/* {{{ mysqlnd_stmt::free_stmt_content */
 static void
-mysqlnd_internal_free_stmt_content(MYSQLND_STMT * const s 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-09-27 Thread Andrey Hristov
andrey   Mon, 27 Sep 2010 11:23:01 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303780

Log:
Fix the value, it was bumped

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-27 07:08:04 UTC (rev 303779)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-27 11:23:01 UTC (rev 303780)
@@ -63,7 +63,7 @@
 #define SERVER_STATUS_LAST_ROW_SENT128
 #define SERVER_STATUS_DB_DROPPED   256 /* A 
database was dropped */
 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
-#define SERVER_QUERY_WAS_SLOW  1024
+#define SERVER_QUERY_WAS_SLOW  2048

 #define MYSQLND_NO_DATA100
 #define MYSQLND_DATA_TRUNCATED 101

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-09-27 07:08:04 UTC 
(rev 303779)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-09-27 11:23:01 UTC 
(rev 303780)
@@ -63,7 +63,7 @@
 #define SERVER_STATUS_LAST_ROW_SENT128
 #define SERVER_STATUS_DB_DROPPED   256 /* A 
database was dropped */
 #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
-#define SERVER_QUERY_WAS_SLOW  1024
+#define SERVER_QUERY_WAS_SLOW  2048

 #define MYSQLND_NO_DATA100
 #define MYSQLND_DATA_TRUNCATED 101

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c branches/PHP_5_3/ext/mysqlnd/mysql

2010-09-23 Thread Andrey Hristov
andrey   Thu, 23 Sep 2010 16:03:22 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303734

Log:
WS fixes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_block_alloc.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-09-23 15:12:19 UTC (rev 303733)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-09-23 16:03:22 UTC (rev 303734)
@@ -282,7 +282,7 @@
 			MYSQLND_PACKET_EOF * ok_response = conn-protocol-m.get_eof_packet(conn-protocol, FALSE TSRMLS_CC);
 			if (!ok_response) {
 SET_OOM_ERROR(conn-error_info);
-break;
+break;
 			}
 			if (FAIL == (ret = PACKET_READ(ok_response, conn))) {
 SET_CLIENT_ERROR(conn-error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
@@ -479,7 +479,7 @@
 		goto err;
 	}
 	memcpy(auth_packet-server_scramble_buf, greet_packet-scramble_buf, SCRAMBLE_LENGTH);
-
+
 	if (!PACKET_WRITE(auth_packet, conn)) {
 		CONN_SET_STATE(conn, CONN_QUIT_SENT);
 		SET_CLIENT_ERROR(conn-error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);
@@ -496,7 +496,7 @@
 		if (FAIL == conn-net-m.enable_ssl(conn-net TSRMLS_CC)) {
 			goto err;
 		}
-
+
 		auth_packet-send_half_packet = FALSE;
 		if (!PACKET_WRITE(auth_packet, conn)) {
 			CONN_SET_STATE(conn, CONN_QUIT_SENT);
@@ -1173,11 +1173,11 @@
 	   FALSE, TRUE TSRMLS_CC)) {
 		DBG_RETURN(NULL);
 	}
-
+
 	/*
 	   Prepare for the worst case.
 	   MyISAM goes to 2500 BIT columns, double it for safety.
-	 */
+	*/
 	result = conn-m-result_init(5000, conn-persistent TSRMLS_CC);
 	if (!result) {
 		DBG_RETURN(NULL);
@@ -1937,7 +1937,7 @@
 		int2store(p, conn-charset-nr);
 		p+=2;
 	}
-
+
 	if (PASS != conn-m-simple_command(conn, COM_CHANGE_USER, buffer, p - buffer,
 	   PROT_LAST /* we will handle the OK packet*/,
 	   silent, TRUE TSRMLS_CC)) {
@@ -1993,7 +1993,7 @@
 	} else if (ret == FAIL  chg_user_resp-server_asked_323_auth == TRUE) {
 		/* old authentication with new server  !*/
 		DBG_ERR(mysqlnd_old_passwd);
-		SET_CLIENT_ERROR(conn-error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
+		SET_CLIENT_ERROR(conn-error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
 	}
 end:
 	PACKET_FREE(chg_user_resp);
@@ -2165,7 +2165,7 @@
 		conn-current_result-m.free_result(conn-current_result, TRUE TSRMLS_CC);
 	}
 	conn-current_result = NULL;
-
+
 	DBG_RETURN(result);
 }
 /* }}} */
@@ -2196,7 +2196,7 @@

 	result = conn-current_result-m.store_result(conn-current_result, conn, FALSE TSRMLS_CC);
 	if (!result) {
-		conn-current_result-m.free_result(conn-current_result, TRUE TSRMLS_CC);
+		conn-current_result-m.free_result(conn-current_result, TRUE TSRMLS_CC);
 	}
 	conn-current_result = NULL;
 	DBG_RETURN(result);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c	2010-09-23 15:12:19 UTC (rev 303733)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c	2010-09-23 16:03:22 UTC (rev 303734)
@@ -104,7 +104,6 @@
 			DBG_RETURN(FAIL);
 		}
 		chunk-ptr = new_ptr;
-
 	}
 	DBG_RETURN(PASS);
 }

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c	2010-09-23 15:12:19 UTC 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c trunk/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqlnd/mysqlnd_ps_codec.c

2010-09-22 Thread Andrey Hristov
andrey   Wed, 22 Sep 2010 11:38:49 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303671

Log:
Fix for
Bug #52891 Wrong data inserted with mysqli/mysqlnd when using 
bind_param,valueLONG_MAX

Bug: http://bugs.php.net/52891 (Assigned) Wrong data inserted with 
mysqli/mysqlnd when using bind_param,valueLONG_MAX
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c	2010-09-22 11:12:32 UTC (rev 303670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c	2010-09-22 11:38:49 UTC (rev 303671)
@@ -482,10 +482,17 @@
 			/* close the statement here, the connection has been closed */
 		}
 		stmt-state = MYSQLND_STMT_PREPARED;
+		stmt-send_types_to_server = 1;
 	} else {
+		/*
+		  stmt-send_types_to_server has already been set to 0 in
+		  mysqlnd_stmt_execute_generate_request / mysqlnd_stmt_execute_store_params
+		  In case there is a situation in which binding was done for integer and the
+		  value is  LONG_MAX or  LONG_MIN, there is string conversion and we have
+		  to resend the types. Next execution will also need to resend the type.
+		*/
 		SET_EMPTY_ERROR(stmt-error_info);
 		SET_EMPTY_ERROR(stmt-conn-error_info);
-		stmt-send_types_to_server = 0;
 		stmt-upsert_status = conn-upsert_status;
 		stmt-state = MYSQLND_STMT_EXECUTED;
 		if (conn-last_query_type == QUERY_UPSERT || conn-last_query_type == QUERY_LOAD_LOCAL) {

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-09-22 11:12:32 UTC (rev 303670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-09-22 11:38:49 UTC (rev 303671)
@@ -608,12 +608,46 @@
 	size_t data_size = 0;
 	zval **copies = NULL;/* if there are different types */
 	enum_func_status ret = FAIL;
+	int resend_types_next_time = 0;

 	DBG_ENTER(mysqlnd_stmt_execute_store_params);

 /* 1. Store type information */
+	/*
+	  check if need to send the types even if stmt-send_types_to_server is 0. This is because
+	  if we send i (42) then the type will be int and the server will expect int. However, if next
+	  time we try to send  LONG_MAX, the conversion to string will send a string and the server
+	  won't expect it and interpret the value as 0. Thus we need to resend the types, if any such values
+	  occur, and force resend for the next execution.
+
+	*/
+	for (i = 0; i  stmt-param_count; i++) {
+		if (Z_TYPE_P(stmt-param_bind[i].zv) != IS_NULL 
+			(stmt-param_bind[i].type == MYSQL_TYPE_LONG || stmt-param_bind[i].type == MYSQL_TYPE_LONGLONG))
+		{
+			/* always copy the var, because we do many conversions */
+			if (PASS != mysqlnd_stmt_copy_it(copies, stmt-param_bind[i].zv, stmt-param_count, i TSRMLS_CC)) {
+SET_OOM_ERROR(stmt-error_info);
+goto end;
+			}
+			/*
+			  if it doesn't fit in a long send it as a string.
+			  Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value  LONG_MAX
+			*/
+			{
+zval *tmp_data = (copies  copies[i])? copies[i]: stmt-param_bind[i].zv;
+convert_to_double_ex(tmp_data);
+if (Z_DVAL_P(tmp_data)  LONG_MAX || Z_DVAL_P(tmp_data)  LONG_MIN) {
+	stmt-send_types_to_server = resend_types_next_time = 1;
+}
+			}
+		}
+	}
+
+	int1store(*p, stmt-send_types_to_server);
+	(*p)++;
+
 	if (stmt-send_types_to_server) {
-
 		/* 2 bytes per type, and leave 20 bytes for future use */
 		if (left  ((stmt-param_count * 2) + 20)) {
 			unsigned int offset = *p - *buf;
@@ -631,16 +665,40 @@
 			*p = *buf + offset;
 		}
 		for (i = 0; i  stmt-param_count; i++) {
+			short current_type = stmt-param_bind[i].type;
 			/* our types are not unsigned */
 #if SIZEOF_LONG==8
-			if (stmt-param_bind[i].type == MYSQL_TYPE_LONG) {
-stmt-param_bind[i].type = MYSQL_TYPE_LONGLONG;
+			if (current_type == MYSQL_TYPE_LONG) {
+current_type = MYSQL_TYPE_LONGLONG;
 			}
 #endif
-			int2store(*p, stmt-param_bind[i].type);
+			if (Z_TYPE_P(stmt-param_bind[i].zv) != IS_NULL  (current_type == MYSQL_TYPE_LONG || current_type == MYSQL_TYPE_LONGLONG)) {
+/*
+  if it doesn't fit in a long send it as a string.
+  Check bug #52891 : Wrong data inserted with mysqli/mysqlnd when using bind_param, value  LONG_MAX
+*/
+{
+	zval *tmp_data = (copies  copies[i])? copies[i]: stmt-param_bind[i].zv;
+	convert_to_double_ex(tmp_data);
+	if (Z_DVAL_P(tmp_data)  LONG_MAX || Z_DVAL_P(tmp_data)  LONG_MIN) {
+		convert_to_string_ex(tmp_data);
+		current_type = MYSQL_TYPE_VAR_STRING;
+		/*
+		  

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-09-22 Thread Andrey Hristov
andrey   Wed, 22 Sep 2010 14:54:43 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303678

Log:
small macro fix

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-09-22 
14:44:13 UTC (rev 303677)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-09-22 
14:54:43 UTC (rev 303678)
@@ -1092,8 +1092,10 @@
 }
 /* }}} */

-#if MYSQLND_DEBUG_MEMORY
+#define MYSQLND_DEBUG_MEMORY 1

+#if MYSQLND_DEBUG_MEMORY == 0
+
 /* {{{ mysqlnd_zend_mm_emalloc */
 static void * mysqlnd_zend_mm_emalloc(size_t size MYSQLND_MEM_D)
 {
@@ -1208,8 +1210,6 @@
 #endif


-#define MYSQLND_DEBUG_MEMORY 1
-
 PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
 {
 #if MYSQLND_DEBUG_MEMORY

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-09-22 14:44:13 UTC 
(rev 303677)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-09-22 14:54:43 UTC 
(rev 303678)
@@ -1092,8 +1092,10 @@
 }
 /* }}} */

-#if MYSQLND_DEBUG_MEMORY
+#define MYSQLND_DEBUG_MEMORY 1

+#if MYSQLND_DEBUG_MEMORY == 0
+
 /* {{{ mysqlnd_zend_mm_emalloc */
 static void * mysqlnd_zend_mm_emalloc(size_t size MYSQLND_MEM_D)
 {
@@ -1208,8 +1210,6 @@
 #endif


-#define MYSQLND_DEBUG_MEMORY 1
-
 PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
 {
 #if MYSQLND_DEBUG_MEMORY

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.h

2010-09-15 Thread Andrey Hristov
andrey   Wed, 15 Sep 2010 12:11:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303392

Log:
Remove unneeded proxy function _mysqlnd_end_psession

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-15 10:51:55 UTC 
(rev 303391)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-15 12:11:33 UTC 
(rev 303392)
@@ -409,15 +409,6 @@
 /* }}} */


-/* {{{ _mysqlnd_end_psession */
-PHPAPI void _mysqlnd_end_psession(MYSQLND * conn TSRMLS_DC)
-{
-   DBG_ENTER(_mysqlnd_end_psession);
-   conn-m-end_psession(conn TSRMLS_CC);
-   DBG_VOID_RETURN;
-}
-/* }}} */
-
 /* {{{ mysqlnd_conn::restart_psession */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, restart_psession)(MYSQLND * conn TSRMLS_DC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-09-15 10:51:55 UTC 
(rev 303391)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-09-15 12:11:33 UTC 
(rev 303392)
@@ -87,8 +87,7 @@

 #define mysqlnd_restart_psession(conn) _mysqlnd_restart_psession((conn) 
TSRMLS_CC)
 PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC);
-#define mysqlnd_end_psession(conn) _mysqlnd_end_psession((conn) TSRMLS_CC)
-PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC);
+#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) TSRMLS_CC)
 PHPAPI void mysqlnd_minfo_print_hash(zval *values);
 #define mysqlnd_thread_safe()  TRUE


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-15 10:51:55 UTC (rev 
303391)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-15 12:11:33 UTC (rev 
303392)
@@ -409,15 +409,6 @@
 /* }}} */


-/* {{{ _mysqlnd_end_psession */
-PHPAPI void _mysqlnd_end_psession(MYSQLND * conn TSRMLS_DC)
-{
-   DBG_ENTER(_mysqlnd_end_psession);
-   conn-m-end_psession(conn TSRMLS_CC);
-   DBG_VOID_RETURN;
-}
-/* }}} */
-
 /* {{{ mysqlnd_conn::restart_psession */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, restart_psession)(MYSQLND * conn TSRMLS_DC)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-09-15 10:51:55 UTC (rev 
303391)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-09-15 12:11:33 UTC (rev 
303392)
@@ -87,8 +87,7 @@

 #define mysqlnd_restart_psession(conn) _mysqlnd_restart_psession((conn) 
TSRMLS_CC)
 PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC);
-#define mysqlnd_end_psession(conn) _mysqlnd_end_psession((conn) TSRMLS_CC)
-PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC);
+#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) TSRMLS_CC)
 PHPAPI void mysqlnd_minfo_print_hash(zval *values);
 #define mysqlnd_thread_safe()  TRUE


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.h

2010-09-15 Thread Andrey Hristov
andrey   Wed, 15 Sep 2010 12:23:45 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=303393

Log:
remove unneeded proxy function _mysqlnd_restart_psessoin

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-15 12:11:33 UTC 
(rev 303392)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-15 12:23:45 UTC 
(rev 303393)
@@ -399,16 +399,6 @@
 /* }}} */


-/* {{{ _mysqlnd_restart_psession */
-PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC)
-{
-   DBG_ENTER(_mysqlnd_restart_psession);
-   conn-m-restart_psession(conn TSRMLS_CC);
-   DBG_VOID_RETURN;
-}
-/* }}} */
-
-
 /* {{{ mysqlnd_conn::restart_psession */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, restart_psession)(MYSQLND * conn TSRMLS_DC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-09-15 12:11:33 UTC 
(rev 303392)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-09-15 12:23:45 UTC 
(rev 303393)
@@ -85,9 +85,8 @@
 PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods);


-#define mysqlnd_restart_psession(conn) _mysqlnd_restart_psession((conn) 
TSRMLS_CC)
-PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC);
-#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) TSRMLS_CC)
+#define mysqlnd_restart_psession(conn) (conn)-m-restart_psession((conn) 
TSRMLS_CC)
+#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) 
TSRMLS_CC)
 PHPAPI void mysqlnd_minfo_print_hash(zval *values);
 #define mysqlnd_thread_safe()  TRUE


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-15 12:11:33 UTC (rev 
303392)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-15 12:23:45 UTC (rev 
303393)
@@ -399,16 +399,6 @@
 /* }}} */


-/* {{{ _mysqlnd_restart_psession */
-PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC)
-{
-   DBG_ENTER(_mysqlnd_restart_psession);
-   conn-m-restart_psession(conn TSRMLS_CC);
-   DBG_VOID_RETURN;
-}
-/* }}} */
-
-
 /* {{{ mysqlnd_conn::restart_psession */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, restart_psession)(MYSQLND * conn TSRMLS_DC)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-09-15 12:11:33 UTC (rev 
303392)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2010-09-15 12:23:45 UTC (rev 
303393)
@@ -85,9 +85,8 @@
 PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods);


-#define mysqlnd_restart_psession(conn) _mysqlnd_restart_psession((conn) 
TSRMLS_CC)
-PHPAPI void _mysqlnd_restart_psession(MYSQLND * conn TSRMLS_DC);
-#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) TSRMLS_CC)
+#define mysqlnd_restart_psession(conn) (conn)-m-restart_psession((conn) 
TSRMLS_CC)
+#define mysqlnd_end_psession(conn) (conn)-m-end_psession((conn) 
TSRMLS_CC)
 PHPAPI void mysqlnd_minfo_print_hash(zval *values);
 #define mysqlnd_thread_safe()  TRUE


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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_st

2010-09-01 Thread Andrey Hristov
andrey   Wed, 01 Sep 2010 14:47:36 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302978

Log:
OPT_COMPRESS support for mysqlnd_conn::set_client_option
To be used by mysqli_options

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-01 14:42:43 UTC 
(rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-09-01 14:47:36 UTC 
(rev 302978)
@@ -714,6 +714,10 @@
if (mysql_flags  CLIENT_COMPRESS) {
mysql_flags = ~CLIENT_COMPRESS;
}
+#else
+   if (conn-net-options.flags  MYSQLND_NET_FLAG_USE_COMPRESSION) {
+   mysql_flags |= CLIENT_COMPRESS;
+   }
 #endif
 #ifndef MYSQLND_SSL_SUPPORTED
if (mysql_flags  CLIENT_SSL) {
@@ -2034,9 +2038,7 @@
DBG_ENTER(mysqlnd_conn::set_client_option);
DBG_INF_FMT(conn=%llu option=%u, conn-thread_id, option);
switch (option) {
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_COMPRESS:
-#endif
 #ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_READ_TIMEOUT:
case MYSQL_OPT_WRITE_TIMEOUT:

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-01 14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-09-01 14:47:36 UTC (rev 302978)
@@ -94,6 +94,9 @@

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL  30)

+
+#define MYSQLND_NET_FLAG_USE_COMPRESSION 1
+
 typedef enum mysqlnd_extension
 {
MYSQLND_MYSQL = 0,

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-09-01 
14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-09-01 
14:47:36 UTC (rev 302978)
@@ -665,10 +665,8 @@
net-options.timeout_write = *(unsigned int*) value;
break;
 #endif
-#ifdef WHEN_SUPPORTED_BY_MYSQLI
case MYSQL_OPT_COMPRESS:
-#endif
-   /* currently not supported. Todo!! */
+   net-options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION;
break;
default:
DBG_RETURN(FAIL);

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
14:42:43 UTC (rev 302977)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
14:47:36 UTC (rev 302978)
@@ -156,11 +156,18 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-   char* unused1;
+#if SIZEOF_CHAR_P == 4
+   uint32_t unused1;
+#elif SIZEOF_CHAR_P == 8
+   uint64_t unused1;
+#else
+#error Not supported platform
+#endif
char* unused2;
char* unused3;
char* unused4;
char* unused5;
+
enum_mysqlnd_protocol_type protocol;

char*charset_name;
@@ -190,6 +197,7 @@
char*ssl_cipher;
char*ssl_passphrase;
zend_bool   ssl_verify_peer;
+   uint64_tflags;
 } MYSQLND_NET_OPTIONS;



Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-01 14:42:43 UTC (rev 
302977)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-09-01 14:47:36 UTC (rev 
302978)
@@ -714,6 +714,10 @@
if (mysql_flags  CLIENT_COMPRESS) {
mysql_flags = ~CLIENT_COMPRESS;
}
+#else
+   if (conn-net-options.flags  MYSQLND_NET_FLAG_USE_COMPRESSION) {
+   mysql_flags |= CLIENT_COMPRESS;
+   }
 #endif
 #ifndef MYSQLND_SSL_SUPPORTED
if (mysql_flags  CLIENT_SSL) {
@@ -2034,9 +2038,7 @@
DBG_ENTER(mysqlnd_conn::set_client_option);
DBG_INF_FMT(conn=%llu option=%u, conn-thread_id, option);
 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Andrey Hristov
andrey   Wed, 01 Sep 2010 16:54:20 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302980

Log:
fix build on windows, seems this macro is not defined

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
15:34:48 UTC (rev 302979)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
16:54:20 UTC (rev 302980)
@@ -156,13 +156,7 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
char* unused2;
char* unused3;
char* unused4;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 15:34:48 UTC 
(rev 302979)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 16:54:20 UTC 
(rev 302980)
@@ -156,13 +156,7 @@
  The ABI will be broken and the methods structure will be somewhere 
else
  in the memory which can crash external code. Feel free to reuse these.
*/
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
char* unused2;
char* unused3;
char* unused4;

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Kalle Sommer Nielsen
Hi

2010/9/1 Andrey Hristov and...@php.net:
 andrey                                   Wed, 01 Sep 2010 16:54:20 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=302980

 Log:
 fix build on windows, seems this macro is not defined


Wouldn't it be easier to just define SIZEOF_CHAR_P to 4 in
config.w32.h.in as it default is?

Something like:
size_t sizeof_ptr(char *ptr)
{
return sizeof(ptr);
}

and test like:
char test = Something something;
size_t test_size = sizeof_ptr(test);

Guess it could be done better or staticlly :)

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Pierre Joye
hi Andrey,

See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h

it has macros for integer capable to contain a pointer.

Cheers,

On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov and...@php.net wrote:
 andrey                                   Wed, 01 Sep 2010 16:54:20 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=302980

 Log:
 fix build on windows, seems this macro is not defined

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

 Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
 ===
 --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
 15:34:48 UTC (rev 302979)
 +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
 16:54:20 UTC (rev 302980)
 @@ -156,13 +156,7 @@
          The ABI will be broken and the methods structure will be somewhere 
 else
          in the memory which can crash external code. Feel free to reuse 
 these.
        */
 -#if SIZEOF_CHAR_P == 4
 -       uint32_t unused1;
 -#elif SIZEOF_CHAR_P == 8
 -       uint64_t unused1;
 -#else
 -#error Not supported platform
 -#endif
 +       char            * unused1;
        char            * unused2;
        char            * unused3;
        char            * unused4;

 Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
 ===
 --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01 15:34:48 
 UTC (rev 302979)
 +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01 16:54:20 
 UTC (rev 302980)
 @@ -156,13 +156,7 @@
          The ABI will be broken and the methods structure will be somewhere 
 else
          in the memory which can crash external code. Feel free to reuse 
 these.
        */
 -#if SIZEOF_CHAR_P == 4
 -       uint32_t unused1;
 -#elif SIZEOF_CHAR_P == 8
 -       uint64_t unused1;
 -#else
 -#error Not supported platform
 -#endif
 +       char            * unused1;
        char            * unused2;
        char            * unused3;
        char            * unused4;


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




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Andrey Hristov
I need to keep the ABI. Currently it is char*, which will be 4 bytes on 
32bit, and 8 bytes on 64bit. Therefore, I needed this macro to put the 
right amount of bytes - uint32_t or uint64_t . Anyway, currently this is 
unused and can stay as char *. I will look for a solution when I needed 
to use these members.

Thanks for the help offered.

Andrey

Pierre Joye wrote:

hi Andrey,

See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h

it has macros for integer capable to contain a pointer.

Cheers,

On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov and...@php.net wrote:

andrey   Wed, 01 Sep 2010 16:54:20 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302980

Log:
fix build on windows, seems this macro is not defined

Changed paths:
   U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
   U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
15:34:48 UTC (rev 302979)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-09-01 
16:54:20 UTC (rev 302980)
@@ -156,13 +156,7 @@
 The ABI will be broken and the methods structure will be somewhere else
 in the memory which can crash external code. Feel free to reuse these.
   */
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
   char* unused2;
   char* unused3;
   char* unused4;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 15:34:48 UTC 
(rev 302979)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-09-01 16:54:20 UTC 
(rev 302980)
@@ -156,13 +156,7 @@
 The ABI will be broken and the methods structure will be somewhere else
 in the memory which can crash external code. Feel free to reuse these.
   */
-#if SIZEOF_CHAR_P == 4
-   uint32_t unused1;
-#elif SIZEOF_CHAR_P == 8
-   uint64_t unused1;
-#else
-#error Not supported platform
-#endif
+   char* unused1;
   char* unused2;
   char* unused3;
   char* unused4;


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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h trunk/ext/mysqlnd/mysqlnd_structs.h

2010-09-01 Thread Pierre Joye
hi,

Yes, understood that. I only pointed you to a place where you can get
this value per platform/arch tuple on windows.

On Wed, Sep 1, 2010 at 10:00 PM, Andrey Hristov p...@hristov.com wrote:
 I need to keep the ABI. Currently it is char*, which will be 4 bytes on
 32bit, and 8 bytes on 64bit. Therefore, I needed this macro to put the right
 amount of bytes - uint32_t or uint64_t . Anyway, currently this is unused
 and can stay as char *. I will look for a solution when I needed to use
 these members.
 Thanks for the help offered.

 Andrey

 Pierre Joye wrote:

 hi Andrey,

 See http://lxr.php.net/opengrok/xref/PHP_5_3/win32/php_stdint.h

 it has macros for integer capable to contain a pointer.

 Cheers,

 On Wed, Sep 1, 2010 at 6:54 PM, Andrey Hristov and...@php.net wrote:

 andrey                                   Wed, 01 Sep 2010 16:54:20 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=302980

 Log:
 fix build on windows, seems this macro is not defined

 Changed paths:
   U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
   U   php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h

 Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
 ===
 --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
  2010-09-01 15:34:48 UTC (rev 302979)
 +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
  2010-09-01 16:54:20 UTC (rev 302980)
 @@ -156,13 +156,7 @@
         The ABI will be broken and the methods structure will be
 somewhere else
         in the memory which can crash external code. Feel free to reuse
 these.
       */
 -#if SIZEOF_CHAR_P == 4
 -       uint32_t unused1;
 -#elif SIZEOF_CHAR_P == 8
 -       uint64_t unused1;
 -#else
 -#error Not supported platform
 -#endif
 +       char            * unused1;
       char            * unused2;
       char            * unused3;
       char            * unused4;

 Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
 ===
 --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01
 15:34:48 UTC (rev 302979)
 +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2010-09-01
 16:54:20 UTC (rev 302980)
 @@ -156,13 +156,7 @@
         The ABI will be broken and the methods structure will be
 somewhere else
         in the memory which can crash external code. Feel free to reuse
 these.
       */
 -#if SIZEOF_CHAR_P == 4
 -       uint32_t unused1;
 -#elif SIZEOF_CHAR_P == 8
 -       uint64_t unused1;
 -#else
 -#error Not supported platform
 -#endif
 +       char            * unused1;
       char            * unused2;
       char            * unused3;
       char            * unused4;


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









-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c trunk/ext/mysqlnd/mysqlnd_ps_codec.c

2010-08-30 Thread Andrey Hristov
andrey   Mon, 30 Aug 2010 18:10:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302901

Log:
Fix for MySQL Bug #49406
Binding params doesn't work when selecting a date inside a CASE-WHEN
(http://bugs.mysql.com/bug.php?id=49406)
The MySQL server sends MYSQL_TYPE_NEWDATE values as clear text, even
when PS are used and thus the binary protocol are used. Changing the
handler for the type.

Bug: http://bugs.php.net/49406 (Bogus) utf8_decode(): Include caution note 
that it destroys 99.9% of all characters
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-08-30 
17:08:34 UTC (rev 302900)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-08-30 
18:10:23 UTC (rev 302901)
@@ -493,7 +493,7 @@
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].php_type= IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].can_ret_as_str_in_uni   
= TRUE;

-   mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].func = 
ps_fetch_date;
+   mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].func = 
ps_fetch_string;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].pack_len = 
MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].can_ret_as_str_in_uni
= TRUE;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-08-30 17:08:34 UTC 
(rev 302900)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-08-30 18:10:23 UTC 
(rev 302901)
@@ -493,7 +493,7 @@
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].php_type= IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_DATE].can_ret_as_str_in_uni   
= TRUE;

-   mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].func = 
ps_fetch_date;
+   mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].func = 
ps_fetch_string;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].pack_len = 
MYSQLND_PS_SKIP_RESULT_W_LEN;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].php_type = IS_STRING;
mysqlnd_ps_fetch_functions[MYSQL_TYPE_NEWDATE].can_ret_as_str_in_uni
= TRUE;

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

  1   2   3   >