andrey                                   Mon, 28 Dec 2009 11:17:10 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292714

Log:
move network creation to the init hook

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/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  2009-12-28 10:07:42 UTC 
(rev 292713)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2009-12-28 11:17:10 UTC 
(rev 292714)
@@ -2019,8 +2019,11 @@


 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC);
+static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC);

+
 MYSQLND_CLASS_METHODS_START(mysqlnd_conn)
+       MYSQLND_METHOD(mysqlnd_conn, init),
        MYSQLND_METHOD(mysqlnd_conn, connect),

        MYSQLND_METHOD(mysqlnd_conn, escape_string),
@@ -2086,6 +2089,20 @@
 MYSQLND_CLASS_METHODS_END;


+/* {{{ mysqlnd_conn::init */
+static void
+MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC)
+{
+       DBG_ENTER("mysqlnd_conn::init");
+       conn->net = mysqlnd_net_init(conn->persistent TSRMLS_CC);
+
+       SET_ERROR_AFF_ROWS(conn);
+
+       DBG_VOID_RETURN;
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_init */
 PHPAPI MYSQLND *_mysqlnd_init(zend_bool persistent TSRMLS_DC)
 {
@@ -2095,20 +2112,18 @@
        DBG_ENTER("mysqlnd_init");
        DBG_INF_FMT("persistent=%d", persistent);

-       SET_ERROR_AFF_ROWS(ret);
        ret->persistent = persistent;
-
        ret->m = mysqlnd_conn_methods;
+       CONN_SET_STATE(ret, CONN_ALLOCED);
        ret->m->get_reference(ret TSRMLS_CC);

-       ret->net = mysqlnd_net_init(persistent TSRMLS_CC);
+       ret->m->init(ret TSRMLS_CC);

-       CONN_SET_STATE(ret, CONN_ALLOCED);
-
        DBG_RETURN(ret);
 }
 /* }}} */

+
 /* {{{ mysqlnd_library_init */
 void mysqlnd_library_init(TSRMLS_D)
 {

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  2009-12-28 
10:07:42 UTC (rev 292713)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2009-12-28 
11:17:10 UTC (rev 292714)
@@ -245,6 +245,7 @@

 struct st_mysqlnd_conn_methods
 {
+       void                            (*init)(MYSQLND * conn TSRMLS_DC);
        enum_func_status        (*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);
        ulong                           (*escape_string)(const MYSQLND * const 
conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
        enum_func_status        (*set_charset)(MYSQLND * const conn, const char 
* const charset TSRMLS_DC);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c     2009-12-28 10:07:42 UTC (rev 
292713)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c     2009-12-28 11:17:10 UTC (rev 
292714)
@@ -2019,8 +2019,11 @@


 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC);
+static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC);

+
 MYSQLND_CLASS_METHODS_START(mysqlnd_conn)
+       MYSQLND_METHOD(mysqlnd_conn, init),
        MYSQLND_METHOD(mysqlnd_conn, connect),

        MYSQLND_METHOD(mysqlnd_conn, escape_string),
@@ -2086,6 +2089,20 @@
 MYSQLND_CLASS_METHODS_END;


+/* {{{ mysqlnd_conn::init */
+static void
+MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC)
+{
+       DBG_ENTER("mysqlnd_conn::init");
+       conn->net = mysqlnd_net_init(conn->persistent TSRMLS_CC);
+
+       SET_ERROR_AFF_ROWS(conn);
+
+       DBG_VOID_RETURN;
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_init */
 PHPAPI MYSQLND *_mysqlnd_init(zend_bool persistent TSRMLS_DC)
 {
@@ -2095,20 +2112,18 @@
        DBG_ENTER("mysqlnd_init");
        DBG_INF_FMT("persistent=%d", persistent);

-       SET_ERROR_AFF_ROWS(ret);
        ret->persistent = persistent;
-
        ret->m = mysqlnd_conn_methods;
+       CONN_SET_STATE(ret, CONN_ALLOCED);
        ret->m->get_reference(ret TSRMLS_CC);

-       ret->net = mysqlnd_net_init(persistent TSRMLS_CC);
+       ret->m->init(ret TSRMLS_CC);

-       CONN_SET_STATE(ret, CONN_ALLOCED);
-
        DBG_RETURN(ret);
 }
 /* }}} */

+
 /* {{{ mysqlnd_library_init */
 void mysqlnd_library_init(TSRMLS_D)
 {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2009-12-28 10:07:42 UTC 
(rev 292713)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h     2009-12-28 11:17:10 UTC 
(rev 292714)
@@ -245,6 +245,7 @@

 struct st_mysqlnd_conn_methods
 {
+       void                            (*init)(MYSQLND * conn TSRMLS_DC);
        enum_func_status        (*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);
        ulong                           (*escape_string)(const MYSQLND * const 
conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC);
        enum_func_status        (*set_charset)(MYSQLND * const conn, const char 
* const charset TSRMLS_DC);

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

Reply via email to