mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Give possibility to overload mysqlnd_result_init().
- Always use conn->m->stmt_init instead of mysqlnd_stmt_init()
This commit is contained in:
parent
dd85f9c2f2
commit
8691786ebd
4 changed files with 13 additions and 9 deletions
|
@ -1127,7 +1127,7 @@ MYSQLND_METHOD(mysqlnd_conn, list_fields)(MYSQLND * conn, const char *table, con
|
||||||
Prepare for the worst case.
|
Prepare for the worst case.
|
||||||
MyISAM goes to 2500 BIT columns, double it for safety.
|
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) {
|
if (!result) {
|
||||||
DBG_RETURN(NULL);
|
DBG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
@ -2211,7 +2211,8 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_conn)
|
||||||
MYSQLND_METHOD(mysqlnd_conn, end_psession),
|
MYSQLND_METHOD(mysqlnd_conn, end_psession),
|
||||||
MYSQLND_METHOD(mysqlnd_conn, send_close),
|
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;
|
MYSQLND_CLASS_METHODS_END;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||||
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
|
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
|
||||||
|
|
||||||
do {
|
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) {
|
if (!result) {
|
||||||
SET_OOM_ERROR(stmt->conn->error_info);
|
SET_OOM_ERROR(stmt->conn->error_info);
|
||||||
break;
|
break;
|
||||||
|
@ -359,7 +359,7 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
|
||||||
Create a new test statement, which we will prepare, but if anything
|
Create a new test statement, which we will prepare, but if anything
|
||||||
fails, we will scrap it.
|
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;
|
stmt_to_prepare = s_to_prepare->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
|
||||||
no metadata at prepare.
|
no metadata at prepare.
|
||||||
*/
|
*/
|
||||||
if (stmt_to_prepare->field_count) {
|
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) {
|
if (!result) {
|
||||||
SET_OOM_ERROR(stmt->conn->error_info);
|
SET_OOM_ERROR(stmt->conn->error_info);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -1685,7 +1685,7 @@ MYSQLND_METHOD(mysqlnd_stmt, result_metadata)(MYSQLND_STMT * const s TSRMLS_DC)
|
||||||
result set, so we don't get one.
|
result set, so we don't get one.
|
||||||
*/
|
*/
|
||||||
do {
|
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) {
|
if (!result) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,7 +445,7 @@ mysqlnd_query_read_result_set_header(MYSQLND *conn, MYSQLND_STMT * s TSRMLS_DC)
|
||||||
/* PS has already allocated it */
|
/* PS has already allocated it */
|
||||||
conn->field_count = rset_header->field_count;
|
conn->field_count = rset_header->field_count;
|
||||||
if (!stmt) {
|
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 {
|
} else {
|
||||||
if (!stmt->result) {
|
if (!stmt->result) {
|
||||||
DBG_INF("This is 'SHOW'/'EXPLAIN'-like query.");
|
DBG_INF("This is 'SHOW'/'EXPLAIN'-like query.");
|
||||||
|
@ -454,7 +454,7 @@ mysqlnd_query_read_result_set_header(MYSQLND *conn, MYSQLND_STMT * s TSRMLS_DC)
|
||||||
prepared statements can't send result set metadata for these queries
|
prepared statements can't send result set metadata for these queries
|
||||||
on prepare stage. Read it now.
|
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 {
|
} else {
|
||||||
/*
|
/*
|
||||||
Update result set metadata if it for some reason changed between
|
Update result set metadata if it for some reason changed between
|
||||||
|
@ -1617,7 +1617,7 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_res)
|
||||||
MYSQLND_CLASS_METHODS_END;
|
MYSQLND_CLASS_METHODS_END;
|
||||||
|
|
||||||
|
|
||||||
/* {{{ mysqlnd_result_init_ex */
|
/* {{{ mysqlnd_result_init */
|
||||||
PHPAPI MYSQLND_RES *
|
PHPAPI MYSQLND_RES *
|
||||||
mysqlnd_result_init(unsigned int field_count, zend_bool persistent TSRMLS_DC)
|
mysqlnd_result_init(unsigned int field_count, zend_bool persistent TSRMLS_DC)
|
||||||
{
|
{
|
||||||
|
|
|
@ -390,6 +390,7 @@ typedef enum_func_status (*func_mysqlnd_conn__send_close)(MYSQLND * conn TSRMLS_
|
||||||
|
|
||||||
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 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
|
struct st_mysqlnd_conn_methods
|
||||||
{
|
{
|
||||||
|
@ -460,6 +461,8 @@ struct st_mysqlnd_conn_methods
|
||||||
func_mysqlnd_conn__send_close send_close;
|
func_mysqlnd_conn__send_close send_close;
|
||||||
|
|
||||||
func_mysqlnd_conn__ssl_set ssl_set;
|
func_mysqlnd_conn__ssl_set ssl_set;
|
||||||
|
|
||||||
|
func_mysqlnd_conn__result_init result_init;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue