PHP mysqlnd svn commit: r917 - in trunk: mysqlnd tests/ext/mysqli
Author: ahristov
Date: 2007-08-16 15:27:54 +0200 (Thu, 16 Aug 2007)
New Revision: 917
Modified:
trunk/mysqlnd/mysqlnd.c
trunk/mysqlnd/mysqlnd_statistics.h
trunk/tests/ext/mysqli/mysqli_get_client_stats.phpt
trunk/tests/ext/mysqli/mysqli_max_links.phpt
Log:
Fix tests
Modified: trunk/mysqlnd/mysqlnd.c
- trunk/mysqlnd/mysqlnd.c 2007-08-15 16:55:24 UTC (rev 916)
+++ trunk/mysqlnd/mysqlnd.c 2007-08-16 13:27:54 UTC (rev 917)
@@ -471,15 +471,15 @@
conn? conn->persistent:0, conn? conn->state:-1);
if (conn && conn->state > CONN_ALLOCED) {
- MYSQLND_INC_GLOBAL_STATISTIC(STAT_CLOSE_IMPLICIT);
+ MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CLOSE_IMPLICIT);
reconnect = TRUE;
mysqlnd_send_close(conn TSRMLS_CC);
conn->m->free_contents(conn TSRMLS_CC);
- MYSQLND_DEC_GLOBAL_STATISTIC(STAT_OPENED_CONNECTIONS);
+ MYSQLND_DEC_CONN_STATISTIC(&conn->stats, STAT_OPENED_CONNECTIONS);
if (conn->persistent) {
- MYSQLND_DEC_GLOBAL_STATISTIC(STAT_OPENED_PERSISTENT_CONNECTIONS);
+ MYSQLND_DEC_CONN_STATISTIC(&conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS);
}
/* Now reconnect using the same handle */
}
@@ -708,11 +708,11 @@
MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_SUCCESS);
if (reconnect) {
- MYSQLND_INC_GLOBAL_STATISTIC(STAT_RECONNECT);
+ MYSQLND_INC_CONN_STATISTIC(NULL, STAT_RECONNECT);
}
- MYSQLND_INC_GLOBAL_STATISTIC(STAT_OPENED_CONNECTIONS);
+ MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_CONNECTIONS);
if (conn->persistent) {
- MYSQLND_INC_GLOBAL_STATISTIC(STAT_OPENED_PERSISTENT_CONNECTIONS);
+ MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS);
}
DBG_INF_FMT("connection_id=%llu", conn->thread_id);
@@ -1081,7 +1081,7 @@
case CONN_NEXT_RESULT_PENDING:
case CONN_QUERY_SENT:
case CONN_FETCHING_DATA:
- MYSQLND_INC_GLOBAL_STATISTIC(STAT_CLOSE_IN_MIDDLE);
+ MYSQLND_INC_CONN_STATISTIC(NULL, STAT_CLOSE_IN_MIDDLE);
DBG_ERR_FMT("Brutally closing connection [%p][%s]", conn, conn->scheme);
/*
Do nothing, the connection will be brutally closed
@@ -1125,10 +1125,10 @@
DBG_ENTER("mysqlnd_conn::close");
DBG_INF_FMT("conn=%llu", conn->thread_id);
- MYSQLND_INC_GLOBAL_STATISTIC(stat);
- MYSQLND_DEC_GLOBAL_STATISTIC(STAT_OPENED_CONNECTIONS);
+ MYSQLND_INC_CONN_STATISTIC(&conn->stats, stat);
+ MYSQLND_DEC_CONN_STATISTIC(&conn->stats, STAT_OPENED_CONNECTIONS);
if (conn->persistent) {
- MYSQLND_DEC_GLOBAL_STATISTIC(STAT_OPENED_PERSISTENT_CONNECTIONS);
+ MYSQLND_DEC_CONN_STATISTIC(&conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS);
}
/*
Modified: trunk/mysqlnd/mysqlnd_statistics.h
- trunk/mysqlnd/mysqlnd_statistics.h 2007-08-15 16:55:24 UTC (rev 916)
+++ trunk/mysqlnd/mysqlnd_statistics.h 2007-08-16 13:27:54 UTC (rev 917)
@@ -28,25 +28,18 @@
#ifdef ZTS
-#define MYSQLND_DEC_GLOBAL_STATISTIC(statistic) \
+#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (mysqlnd_global_stats) { \
tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
mysqlnd_global_stats->values[statistic]--; \
tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
+ if ((conn_stats)) { \
+ ((MYSQLND_STATS *) conn_stats)->values[statistic]--; \
+ } \
}\
}
-#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
- { \
- if (mysqlnd_global_stats) { \
- tsrm_mutex_lock(mysqlnd_global_stats->LOCK_access); \
- mysqlnd_global_stats->values[statistic]++; \
- tsrm_mutex_unlock(mysqlnd_global_stats->LOCK_access); \
- }\
- }
-
-
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (mysqlnd_global_stats) { \
@@ -96,20 +89,17 @@
#else /* NON-ZTS */
-#define MYSQLND_DEC_GLOBAL_STATISTIC(statistic) \
+
+#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (mysqlnd_global_stats) { \
mysqlnd_global_stats->values[statistic]--; \
+ if ((conn_stats)) { \
+ ((MYSQLND_STATS *) conn_stats)->values[statistic]--; \
+ } \
} \
}
-#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
- { \
- if (mysqlnd_global_stats) { \
- mysqlnd_global_stats->values[statistic]++; \
- } \
- }
-
#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic) \
{ \
if (mysqlnd_global_stats) { \
Modified: trunk/tests/ext/mysqli/mysqli_get_client_stats.phpt
- trunk/tests/ext/mysqli/mysqli_get_client_stats.phpt 2007-08-15 16:55:24 UTC (rev 916)
+++ trunk/tests/ext/mysqli/mysqli_get_client_stats.phpt 2007-08-16 13:27:54 UTC (rev 917)
@@ -504,7 +504,7 @@
print "done!";
?>
--EXPECTF--
-array(33) {
+array(37) {
["bytes_sent"]=>
string(1) "0"
["bytes_received"]=>
@@ -555,6 +555,14 @@
string(1) "0"
["connection_reused"]=>
string(1) "0"
+ ["reconnect"]=>
+ string(1) "0"
+ ["pconnect_success"]=>
+ string(1) "0"
+ ["active_connections"]=>
+ string(1) "0"
+ ["active_persistent_connections"]=>
+ string(1) "0"
["explicit_close"]=>
string(1) "0"
["implicit_close"]=>
@@ -574,7 +582,7 @@
}
done!
--UEXPECTF--
-array(33) {
+array(37) {
[u"bytes_sent"]=>
unicode(1) "0"
[u"bytes_received"]=>
@@ -625,6 +633,14 @@
unicode(1) "0"
[u"connection_reused"]=>
unicode(1) "0"
+ [u"reconnect"]=>
+ unicode(1) "0"
+ [u"pconnect_success"]=>
+ unicode(1) "0"
+ [u"active_connections"]=>
+ unicode(1) "0"
+ [u"active_persistent_connections"]=>
+ unicode(1) "0"
[u"explicit_close"]=>
unicode(1) "0"
[u"implicit_close"]=>
@@ -642,4 +658,4 @@
[u"implicit_stmt_close"]=>
unicode(1) "0"
}
-done!
\ No newline at end of file
+done!
Modified: trunk/tests/ext/mysqli/mysqli_max_links.phpt
- trunk/tests/ext/mysqli/mysqli_max_links.phpt 2007-08-15 16:55:24 UTC (rev 916)
+++ trunk/tests/ext/mysqli/mysqli_max_links.phpt 2007-08-16 13:27:54 UTC (rev 917)
@@ -39,4 +39,34 @@ --EXPECTF--
bool(true)
int(1)
-done!
\ No newline at end of file
+
+Warning: mysqli_connect(): Too many open links (1) in %s on line %d
+
+Warning: mysqli_connect(): Too many open links (1) in %s on line %d
+
+Warning: mysqli_connect(): Too many open links (1) in %s on line %d
+
+Warning: mysqli_connect(): Too many open links (1) in %s on line %d
+
+Warning: mysqli_connect(): Too many open links (1) in %s on line %d
+
+Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in %s on line %d
+
+Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in %s on line %d
+done!
--
MySQL Code Commits Mailing List
For list archives:
http://lists.mysql.com/commits
To unsubscribe:
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Thu Aug 16 12:14:42 2007
This archive was generated by hypermail 2.1.8
: Sun Oct 07 2007 - 08:35:41 EDT
|