andrey Fri, 14 May 2010 13:18:39 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=299378
Log: - Give possibility to overload mysqlnd_result_init(). - Always use conn->m->stmt_init instead of mysqlnd_stmt_init() 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_ps.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_structs.h U php/php-src/trunk/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_result.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-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -1127,7 +1127,7 @@ Prepare for the worst case. MyISAM goes to 2500 BIT columns, double it for safety. */ - result = mysqlnd_result_init(5000, conn->persistent TSRMLS_CC); + result = conn->m->result_init(5000, conn->persistent TSRMLS_CC); if (!result) { DBG_RETURN(NULL); } @@ -2211,7 +2211,8 @@ MYSQLND_METHOD(mysqlnd_conn, end_psession), MYSQLND_METHOD(mysqlnd_conn, send_close), - MYSQLND_METHOD(mysqlnd_conn, ssl_set) + MYSQLND_METHOD(mysqlnd_conn, ssl_set), + mysqlnd_result_init MYSQLND_CLASS_METHODS_END; 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-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -157,7 +157,7 @@ MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS); do { - result = mysqlnd_result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); + result = conn->m->result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); if (!result) { SET_OOM_ERROR(stmt->conn->error_info); break; @@ -359,7 +359,7 @@ Create a new test statement, which we will prepare, but if anything fails, we will scrap it. */ - s_to_prepare = mysqlnd_stmt_init(stmt->conn); + s_to_prepare = stmt->conn->m->stmt_init(stmt->conn TSRMLS_CC); stmt_to_prepare = s_to_prepare->data; } @@ -383,7 +383,7 @@ no metadata at prepare. */ if (stmt_to_prepare->field_count) { - MYSQLND_RES * result = mysqlnd_result_init(stmt_to_prepare->field_count, stmt_to_prepare->persistent TSRMLS_CC); + MYSQLND_RES * result = stmt->conn->m->result_init(stmt_to_prepare->field_count, stmt_to_prepare->persistent TSRMLS_CC); if (!result) { SET_OOM_ERROR(stmt->conn->error_info); goto fail; @@ -1685,7 +1685,7 @@ result set, so we don't get one. */ do { - result = mysqlnd_result_init(stmt->field_count, stmt->persistent TSRMLS_CC); + result = stmt->conn->m->result_init(stmt->field_count, stmt->persistent TSRMLS_CC); if (!result) { break; } 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-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -445,7 +445,7 @@ /* PS has already allocated it */ conn->field_count = rset_header->field_count; if (!stmt) { - result = conn->current_result = mysqlnd_result_init(rset_header->field_count, conn->persistent TSRMLS_CC); + result = conn->current_result = conn->m->result_init(rset_header->field_count, conn->persistent TSRMLS_CC); } else { if (!stmt->result) { DBG_INF("This is 'SHOW'/'EXPLAIN'-like query."); @@ -454,7 +454,7 @@ prepared statements can't send result set metadata for these queries on prepare stage. Read it now. */ - result = stmt->result = mysqlnd_result_init(rset_header->field_count, stmt->persistent TSRMLS_CC); + result = stmt->result = conn->m->result_init(rset_header->field_count, stmt->persistent TSRMLS_CC); } else { /* Update result set metadata if it for some reason changed between @@ -1617,7 +1617,7 @@ MYSQLND_CLASS_METHODS_END; -/* {{{ mysqlnd_result_init_ex */ +/* {{{ mysqlnd_result_init */ PHPAPI MYSQLND_RES * mysqlnd_result_init(unsigned int field_count, zend_bool persistent 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-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2010-05-14 13:18:39 UTC (rev 299378) @@ -390,6 +390,7 @@ typedef void (*func_mysqlnd_conn__ssl_set)(MYSQLND * const conn, const char * key, const char * const cert, const char * const ca, const char * const capath, const char * const cipher TSRMLS_DC); +typedef MYSQLND_RES * (*func_mysqlnd_conn__result_init)(unsigned int field_count, zend_bool persistent TSRMLS_DC); struct st_mysqlnd_conn_methods { @@ -460,6 +461,8 @@ func_mysqlnd_conn__send_close send_close; func_mysqlnd_conn__ssl_set ssl_set; + + func_mysqlnd_conn__result_init result_init; }; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -1127,7 +1127,7 @@ Prepare for the worst case. MyISAM goes to 2500 BIT columns, double it for safety. */ - result = mysqlnd_result_init(5000, conn->persistent TSRMLS_CC); + result = conn->m->result_init(5000, conn->persistent TSRMLS_CC); if (!result) { DBG_RETURN(NULL); } @@ -2211,7 +2211,8 @@ MYSQLND_METHOD(mysqlnd_conn, end_psession), MYSQLND_METHOD(mysqlnd_conn, send_close), - MYSQLND_METHOD(mysqlnd_conn, ssl_set) + MYSQLND_METHOD(mysqlnd_conn, ssl_set), + mysqlnd_result_init MYSQLND_CLASS_METHODS_END; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c 2010-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -157,7 +157,7 @@ MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS); do { - result = mysqlnd_result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); + result = conn->m->result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC); if (!result) { SET_OOM_ERROR(stmt->conn->error_info); break; @@ -359,7 +359,7 @@ Create a new test statement, which we will prepare, but if anything fails, we will scrap it. */ - s_to_prepare = mysqlnd_stmt_init(stmt->conn); + s_to_prepare = stmt->conn->m->stmt_init(stmt->conn TSRMLS_CC); stmt_to_prepare = s_to_prepare->data; } @@ -383,7 +383,7 @@ no metadata at prepare. */ if (stmt_to_prepare->field_count) { - MYSQLND_RES * result = mysqlnd_result_init(stmt_to_prepare->field_count, stmt_to_prepare->persistent TSRMLS_CC); + MYSQLND_RES * result = stmt->conn->m->result_init(stmt_to_prepare->field_count, stmt_to_prepare->persistent TSRMLS_CC); if (!result) { SET_OOM_ERROR(stmt->conn->error_info); goto fail; @@ -1685,7 +1685,7 @@ result set, so we don't get one. */ do { - result = mysqlnd_result_init(stmt->field_count, stmt->persistent TSRMLS_CC); + result = stmt->conn->m->result_init(stmt->field_count, stmt->persistent TSRMLS_CC); if (!result) { break; } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2010-05-14 13:18:39 UTC (rev 299378) @@ -445,7 +445,7 @@ /* PS has already allocated it */ conn->field_count = rset_header->field_count; if (!stmt) { - result = conn->current_result = mysqlnd_result_init(rset_header->field_count, conn->persistent TSRMLS_CC); + result = conn->current_result = conn->m->result_init(rset_header->field_count, conn->persistent TSRMLS_CC); } else { if (!stmt->result) { DBG_INF("This is 'SHOW'/'EXPLAIN'-like query."); @@ -454,7 +454,7 @@ prepared statements can't send result set metadata for these queries on prepare stage. Read it now. */ - result = stmt->result = mysqlnd_result_init(rset_header->field_count, stmt->persistent TSRMLS_CC); + result = stmt->result = conn->m->result_init(rset_header->field_count, stmt->persistent TSRMLS_CC); } else { /* Update result set metadata if it for some reason changed between @@ -1617,7 +1617,7 @@ MYSQLND_CLASS_METHODS_END; -/* {{{ mysqlnd_result_init_ex */ +/* {{{ mysqlnd_result_init */ PHPAPI MYSQLND_RES * mysqlnd_result_init(unsigned int field_count, zend_bool persistent TSRMLS_DC) { Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-05-14 13:04:33 UTC (rev 299377) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-05-14 13:18:39 UTC (rev 299378) @@ -390,6 +390,7 @@ typedef void (*func_mysqlnd_conn__ssl_set)(MYSQLND * const conn, const char * key, const char * const cert, const char * const ca, const char * const capath, const char * const cipher TSRMLS_DC); +typedef MYSQLND_RES * (*func_mysqlnd_conn__result_init)(unsigned int field_count, zend_bool persistent TSRMLS_DC); struct st_mysqlnd_conn_methods { @@ -460,6 +461,8 @@ func_mysqlnd_conn__send_close send_close; func_mysqlnd_conn__ssl_set ssl_set; + + func_mysqlnd_conn__result_init result_init; };
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php