[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.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_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.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 ==