summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_ps.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2011-10-25 23:01:49 +0000
committerAndrey Hristov <andrey@php.net>2011-10-25 23:01:49 +0000
commit845d8fa10c30f68acf425e20a69d3f33fc565e41 (patch)
treede8a39dbc4aad0c5cd72cf687de48929132dac80 /ext/mysqlnd/mysqlnd_ps.c
parent5e8bcbb08ac9b63ec33a69638ea6517a05a66bb6 (diff)
downloadphp-git-845d8fa10c30f68acf425e20a69d3f33fc565e41.tar.gz
Move from directly referencing an aggregated structure to using a
pointer to a structure. The structure is still aggregated but we add a level of indirection for possible plugins to overwrite the storage
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps.c')
-rw-r--r--ext/mysqlnd/mysqlnd_ps.c210
1 files changed, 105 insertions, 105 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c
index eff2367d1f..0b7de4e4fe 100644
--- a/ext/mysqlnd/mysqlnd_ps.c
+++ b/ext/mysqlnd/mysqlnd_ps.c
@@ -82,15 +82,15 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s TSRMLS_DC)
if (CONN_GET_STATE(conn) != CONN_FETCHING_DATA ||
stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE)
{
- SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
+ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_RETURN(NULL);
}
stmt->default_rset_handler = s->m->store_result;
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_PS_BUFFERED_SETS);
result = stmt->result;
@@ -105,11 +105,11 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s TSRMLS_DC)
if (PASS == ret) {
/* libmysql API docs say it should be so for SELECT statements */
- stmt->upsert_status.affected_rows = stmt->result->stored_data->row_count;
+ stmt->upsert_status->affected_rows = stmt->result->stored_data->row_count;
stmt->state = MYSQLND_STMT_USE_OR_STORE_CALLED;
} else {
- COPY_CLIENT_ERROR(conn->error_info, result->stored_data->error_info);
+ COPY_CLIENT_ERROR(*conn->error_info, result->stored_data->error_info);
stmt->result->m.free_result_contents(stmt->result TSRMLS_CC);
mnd_efree(stmt->result);
stmt->result = NULL;
@@ -149,34 +149,34 @@ MYSQLND_METHOD(mysqlnd_stmt, get_result)(MYSQLND_STMT * const s TSRMLS_DC)
/* Nothing to store for UPSERT/LOAD DATA*/
if (CONN_GET_STATE(conn) != CONN_FETCHING_DATA || stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE) {
- SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
+ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_RETURN(NULL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
MYSQLND_INC_CONN_STATISTIC(conn->stats, STAT_BUFFERED_SETS);
do {
result = conn->m->result_init(stmt->result->field_count, stmt->persistent TSRMLS_CC);
if (!result) {
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
break;
}
result->meta = stmt->result->meta->m->clone_metadata(stmt->result->meta, FALSE TSRMLS_CC);
if (!result->meta) {
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
break;
}
if ((result = result->m.store_result(result, conn, TRUE TSRMLS_CC))) {
- stmt->upsert_status.affected_rows = result->stored_data->row_count;
+ stmt->upsert_status->affected_rows = result->stored_data->row_count;
stmt->state = MYSQLND_STMT_PREPARED;
result->type = MYSQLND_RES_PS_BUF;
} else {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
stmt->state = MYSQLND_STMT_PREPARED;
break;
}
@@ -198,7 +198,7 @@ MYSQLND_METHOD(mysqlnd_stmt, more_results)(const MYSQLND_STMT * s TSRMLS_DC)
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
DBG_ENTER("mysqlnd_stmt::more_results");
/* (conn->state == CONN_NEXT_RESULT_PENDING) too */
- DBG_RETURN((stmt && stmt->conn && (stmt->conn->upsert_status.server_status &
+ DBG_RETURN((stmt && stmt->conn && (stmt->conn->upsert_status->server_status &
SERVER_MORE_RESULTS_EXISTS))?
TRUE:
FALSE);
@@ -220,11 +220,11 @@ MYSQLND_METHOD(mysqlnd_stmt, next_result)(MYSQLND_STMT * s TSRMLS_DC)
conn = stmt->conn;
DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
- if (CONN_GET_STATE(conn) != CONN_NEXT_RESULT_PENDING || !(conn->upsert_status.server_status & SERVER_MORE_RESULTS_EXISTS)) {
+ if (CONN_GET_STATE(conn) != CONN_NEXT_RESULT_PENDING || !(conn->upsert_status->server_status & SERVER_MORE_RESULTS_EXISTS)) {
DBG_RETURN(FAIL);
}
- DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status.server_status, stmt->upsert_status.server_status & SERVER_STATUS_CURSOR_EXISTS);
+ DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS);
/* Free space for next result */
s->m->free_stmt_content(s TSRMLS_CC);
@@ -254,8 +254,8 @@ mysqlnd_stmt_skip_metadata(MYSQLND_STMT * s TSRMLS_DC)
field_packet = stmt->conn->protocol->m.get_result_field_packet(stmt->conn->protocol, FALSE TSRMLS_CC);
if (!field_packet) {
- SET_OOM_ERROR(stmt->error_info);
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
} else {
ret = PASS;
field_packet->skip_parsing = TRUE;
@@ -289,8 +289,8 @@ mysqlnd_stmt_read_prepare_response(MYSQLND_STMT * s TSRMLS_DC)
prepare_resp = stmt->conn->protocol->m.get_prepare_response_packet(stmt->conn->protocol, FALSE TSRMLS_CC);
if (!prepare_resp) {
- SET_OOM_ERROR(stmt->error_info);
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
goto done;
}
@@ -299,13 +299,13 @@ mysqlnd_stmt_read_prepare_response(MYSQLND_STMT * s TSRMLS_DC)
}
if (0xFF == prepare_resp->error_code) {
- COPY_CLIENT_ERROR(stmt->error_info, prepare_resp->error_info);
- COPY_CLIENT_ERROR(stmt->conn->error_info, prepare_resp->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, prepare_resp->error_info);
+ COPY_CLIENT_ERROR(*stmt->conn->error_info, prepare_resp->error_info);
goto done;
}
ret = PASS;
stmt->stmt_id = prepare_resp->stmt_id;
- stmt->warning_count = stmt->conn->upsert_status.warning_count = prepare_resp->warning_count;
+ stmt->warning_count = stmt->conn->upsert_status->warning_count = prepare_resp->warning_count;
stmt->field_count = stmt->conn->field_count = prepare_resp->field_count;
stmt->param_count = prepare_resp->param_count;
done:
@@ -332,8 +332,8 @@ mysqlnd_stmt_prepare_read_eof(MYSQLND_STMT * s TSRMLS_DC)
fields_eof = stmt->conn->protocol->m.get_eof_packet(stmt->conn->protocol, FALSE TSRMLS_CC);
if (!fields_eof) {
- SET_OOM_ERROR(stmt->error_info);
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
} else {
if (FAIL == (ret = PACKET_READ(fields_eof, stmt->conn))) {
if (stmt->result) {
@@ -343,8 +343,8 @@ mysqlnd_stmt_prepare_read_eof(MYSQLND_STMT * s TSRMLS_DC)
stmt->state = MYSQLND_STMT_INITTED;
}
} else {
- stmt->upsert_status.server_status = fields_eof->server_status;
- stmt->upsert_status.warning_count = fields_eof->warning_count;
+ stmt->upsert_status->server_status = fields_eof->server_status;
+ stmt->upsert_status->warning_count = fields_eof->warning_count;
stmt->state = MYSQLND_STMT_PREPARED;
}
PACKET_FREE(fields_eof);
@@ -373,8 +373,8 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
SET_ERROR_AFF_ROWS(stmt);
SET_ERROR_AFF_ROWS(stmt->conn);
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->state > MYSQLND_STMT_INITTED) {
/* See if we have to clean the wire */
@@ -420,7 +420,7 @@ MYSQLND_METHOD(mysqlnd_stmt, prepare)(MYSQLND_STMT * const s, const char * const
if (stmt_to_prepare->field_count) {
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);
+ SET_OOM_ERROR(*stmt->conn->error_info);
goto fail;
}
/* Allocate the result now as it is needed for the reading of metadata */
@@ -485,8 +485,8 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
ret = mysqlnd_query_read_result_set_header(stmt->conn, s TSRMLS_CC);
if (ret == FAIL) {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
- stmt->upsert_status.affected_rows = conn->upsert_status.affected_rows;
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
+ stmt->upsert_status->affected_rows = conn->upsert_status->affected_rows;
if (CONN_GET_STATE(conn) == CONN_QUIT_SENT) {
/* close the statement here, the connection has been closed */
}
@@ -500,9 +500,9 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
value is > LONG_MAX or < LONG_MIN, there is string conversion and we have
to resend the types. Next execution will also need to resend the type.
*/
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
- stmt->upsert_status = conn->upsert_status;
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
+ *stmt->upsert_status = *conn->upsert_status; /* copy status */
stmt->state = MYSQLND_STMT_EXECUTED;
if (conn->last_query_type == QUERY_UPSERT || conn->last_query_type == QUERY_LOAD_LOCAL) {
DBG_INF("PASS");
@@ -528,10 +528,10 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
use_result() or store_result() and we should be able to scrap the
data on the line, if he just decides to close the statement.
*/
- DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status.server_status,
- stmt->upsert_status.server_status & SERVER_STATUS_CURSOR_EXISTS);
+ DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status,
+ stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS);
- if (stmt->upsert_status.server_status & SERVER_STATUS_CURSOR_EXISTS) {
+ if (stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS) {
DBG_INF("cursor exists");
stmt->cursor_exists = TRUE;
CONN_SET_STATE(conn, CONN_READY);
@@ -562,7 +562,7 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s TSRMLS_DC)
}
}
#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
- if (stmt->upsert_status.server_status & SERVER_PS_OUT_PARAMS) {
+ if (stmt->upsert_status->server_status & SERVER_PS_OUT_PARAMS) {
s->m->free_stmt_content(s TSRMLS_CC);
DBG_INF("PS OUT Variable RSet, skipping");
/* OUT params result set. Skip for now to retain compatibility */
@@ -639,7 +639,7 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s TSRMLS_DC)
stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC);
} else if (stmt->state < MYSQLND_STMT_PREPARED) {
/* Only initted - error */
- SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
+ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
mysqlnd_out_of_sync);
SET_STMT_ERROR(stmt, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_INF("FAIL");
@@ -686,7 +686,7 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s TSRMLS_DC)
}
if (ret == FAIL) {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
DBG_INF("FAIL");
DBG_RETURN(FAIL);
}
@@ -694,10 +694,10 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s TSRMLS_DC)
ret = s->m->parse_execute_response(s TSRMLS_CC);
- DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status.server_status, stmt->upsert_status.server_status & SERVER_STATUS_CURSOR_EXISTS);
+ DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS);
- if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status.affected_rows) {
- MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status.affected_rows);
+ if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status->affected_rows) {
+ MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status->affected_rows);
}
DBG_RETURN(ret);
}
@@ -733,8 +733,8 @@ mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES *result, void *param, unsigned int f
current_row,
meta->field_count,
meta->fields,
- result->conn->options.numeric_and_datetime_as_unicode,
- result->conn->options.int_and_float_native,
+ result->conn->options->numeric_and_datetime_as_unicode,
+ result->conn->options->int_and_float_native,
result->conn->stats TSRMLS_CC);
if (PASS != rc) {
DBG_RETURN(FAIL);
@@ -821,7 +821,7 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
DBG_RETURN(PASS);
}
if (CONN_GET_STATE(result->conn) != CONN_FETCHING_DATA) {
- SET_CLIENT_ERROR(result->conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
+ SET_CLIENT_ERROR(*result->conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_ERR("command out of sync");
DBG_RETURN(FAIL);
@@ -852,8 +852,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
result->unbuf->last_row_data,
row_packet->field_count,
row_packet->fields_metadata,
- result->conn->options.numeric_and_datetime_as_unicode,
- result->conn->options.int_and_float_native,
+ result->conn->options->numeric_and_datetime_as_unicode,
+ result->conn->options->int_and_float_native,
result->conn->stats TSRMLS_CC))
{
DBG_RETURN(FAIL);
@@ -903,8 +903,8 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
*fetched_anything = TRUE;
} else if (ret == FAIL) {
if (row_packet->error_info.error_no) {
- COPY_CLIENT_ERROR(stmt->conn->error_info, row_packet->error_info);
- COPY_CLIENT_ERROR(stmt->error_info, row_packet->error_info);
+ COPY_CLIENT_ERROR(*stmt->conn->error_info, row_packet->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, row_packet->error_info);
}
CONN_SET_STATE(result->conn, CONN_READY);
result->unbuf->eof_reached = TRUE; /* so next time we won't get an error */
@@ -912,13 +912,13 @@ mysqlnd_stmt_fetch_row_unbuffered(MYSQLND_RES *result, void *param, unsigned int
DBG_INF("EOF");
/* Mark the connection as usable again */
result->unbuf->eof_reached = TRUE;
- result->conn->upsert_status.warning_count = row_packet->warning_count;
- result->conn->upsert_status.server_status = row_packet->server_status;
+ result->conn->upsert_status->warning_count = row_packet->warning_count;
+ result->conn->upsert_status->server_status = row_packet->server_status;
/*
result->row_packet will be cleaned when
destroying the result object
*/
- if (result->conn->upsert_status.server_status & SERVER_MORE_RESULTS_EXISTS) {
+ if (result->conn->upsert_status->server_status & SERVER_MORE_RESULTS_EXISTS) {
CONN_SET_STATE(result->conn, CONN_NEXT_RESULT_PENDING);
} else {
CONN_SET_STATE(result->conn, CONN_READY);
@@ -952,13 +952,13 @@ MYSQLND_METHOD(mysqlnd_stmt, use_result)(MYSQLND_STMT * s TSRMLS_DC)
(stmt->cursor_exists && CONN_GET_STATE(conn) != CONN_READY) ||
(stmt->state != MYSQLND_STMT_WAITING_USE_OR_STORE))
{
- SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
+ SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC,
UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_ERR("command out of sync");
DBG_RETURN(NULL);
}
- SET_EMPTY_ERROR(stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
MYSQLND_INC_CONN_STATISTIC(stmt->conn->stats, STAT_PS_UNBUFFERED_SETS);
result = stmt->result;
@@ -997,7 +997,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
if (stmt->state < MYSQLND_STMT_USER_FETCHING) {
/* Only initted - error */
- SET_CLIENT_ERROR(stmt->conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
+ SET_CLIENT_ERROR(*stmt->conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
mysqlnd_out_of_sync);
DBG_ERR("command out of sync");
DBG_RETURN(FAIL);
@@ -1006,8 +1006,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
int4store(buf, stmt->stmt_id);
int4store(buf + STMT_ID_LENGTH, 1); /* for now fetch only one row */
@@ -1015,7 +1015,7 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
if (FAIL == stmt->conn->m->simple_command(stmt->conn, COM_STMT_FETCH, buf, sizeof(buf),
PROT_LAST /* we will handle the response packet*/,
FALSE, TRUE TSRMLS_CC)) {
- COPY_CLIENT_ERROR(stmt->error_info, stmt->conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *stmt->conn->error_info);
DBG_RETURN(FAIL);
}
@@ -1036,8 +1036,8 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
result->unbuf->last_row_data,
row_packet->field_count,
row_packet->fields_metadata,
- result->conn->options.numeric_and_datetime_as_unicode,
- result->conn->options.int_and_float_native,
+ result->conn->options->numeric_and_datetime_as_unicode,
+ result->conn->options->int_and_float_native,
result->conn->stats TSRMLS_CC))
{
DBG_RETURN(FAIL);
@@ -1096,21 +1096,21 @@ mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES *result, void *param, unsigned int fla
} else {
*fetched_anything = FALSE;
- stmt->upsert_status.warning_count =
- stmt->conn->upsert_status.warning_count =
+ stmt->upsert_status->warning_count =
+ stmt->conn->upsert_status->warning_count =
row_packet->warning_count;
- stmt->upsert_status.server_status =
- stmt->conn->upsert_status.server_status =
+ stmt->upsert_status->server_status =
+ stmt->conn->upsert_status->server_status =
row_packet->server_status;
result->unbuf->eof_reached = row_packet->eof;
}
- stmt->upsert_status.warning_count =
- stmt->conn->upsert_status.warning_count =
+ stmt->upsert_status->warning_count =
+ stmt->conn->upsert_status->warning_count =
row_packet->warning_count;
- stmt->upsert_status.server_status =
- stmt->conn->upsert_status.server_status =
+ stmt->upsert_status->server_status =
+ stmt->conn->upsert_status->server_status =
row_packet->server_status;
DBG_INF_FMT("ret=%s fetched=%u server_status=%u warnings=%u eof=%u",
@@ -1147,8 +1147,8 @@ MYSQLND_METHOD(mysqlnd_stmt, fetch)(MYSQLND_STMT * const s, zend_bool * const fe
}
stmt->state = MYSQLND_STMT_USER_FETCHING;
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
DBG_INF_FMT("result_bind=%p separated_once=%u", stmt->result_bind, stmt->result_zvals_separated_once);
/*
@@ -1190,8 +1190,8 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s TSRMLS_DC)
}
DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->stmt_id) {
MYSQLND * conn = stmt->conn;
@@ -1219,9 +1219,9 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s TSRMLS_DC)
FAIL == (ret = conn->m->simple_command(conn, COM_STMT_RESET, cmd_buf,
sizeof(cmd_buf), PROT_OK_PACKET,
FALSE, TRUE TSRMLS_CC))) {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
}
- stmt->upsert_status = conn->upsert_status;
+ *stmt->upsert_status = *conn->upsert_status;
stmt->state = MYSQLND_STMT_PREPARED;
}
@@ -1290,8 +1290,8 @@ MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned in
conn = stmt->conn;
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->state < MYSQLND_STMT_PREPARED) {
SET_STMT_ERROR(stmt, CR_NO_PREPARE_STMT, UNKNOWN_SQLSTATE, mysqlnd_stmt_not_prepared);
@@ -1338,12 +1338,12 @@ MYSQLND_METHOD(mysqlnd_stmt, send_long_data)(MYSQLND_STMT * const s, unsigned in
ret = conn->m->simple_command(conn, cmd, cmd_buf, packet_len, PROT_LAST , FALSE, TRUE TSRMLS_CC);
mnd_efree(cmd_buf);
if (FAIL == ret) {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
}
} else {
ret = FAIL;
- SET_OOM_ERROR(stmt->error_info);
- SET_OOM_ERROR(conn->error_info);
+ SET_OOM_ERROR(*stmt->error_info);
+ SET_OOM_ERROR(*conn->error_info);
}
/*
Cover protocol error: COM_STMT_SEND_LONG_DATA was designed to be quick and not
@@ -1403,8 +1403,8 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_parameters)(MYSQLND_STMT * const s, MYSQLND_PA
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->param_count) {
unsigned int i = 0;
@@ -1476,8 +1476,8 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_parameter)(MYSQLND_STMT * const s, unsigne
DBG_ERR("invalid param_no");
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->param_count) {
if (!stmt->param_bind) {
@@ -1527,8 +1527,8 @@ MYSQLND_METHOD(mysqlnd_stmt, refresh_bind_param)(MYSQLND_STMT * const s TSRMLS_D
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->param_count) {
stmt->send_types_to_server = 1;
@@ -1559,8 +1559,8 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_result)(MYSQLND_STMT * const s,
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->field_count) {
unsigned int i = 0;
@@ -1616,8 +1616,8 @@ MYSQLND_METHOD(mysqlnd_stmt, bind_one_result)(MYSQLND_STMT * const s, unsigned i
DBG_RETURN(FAIL);
}
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
if (stmt->field_count) {
mysqlnd_stmt_separate_one_result_bind(s, param_no TSRMLS_CC);
@@ -1649,7 +1649,7 @@ static uint64_t
MYSQLND_METHOD(mysqlnd_stmt, insert_id)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->upsert_status.last_insert_id : 0;
+ return stmt? stmt->upsert_status->last_insert_id : 0;
}
/* }}} */
@@ -1659,7 +1659,7 @@ static uint64_t
MYSQLND_METHOD(mysqlnd_stmt, affected_rows)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->upsert_status.affected_rows : 0;
+ return stmt? stmt->upsert_status->affected_rows : 0;
}
/* }}} */
@@ -1679,7 +1679,7 @@ static unsigned int
MYSQLND_METHOD(mysqlnd_stmt, warning_count)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->upsert_status.warning_count : 0;
+ return stmt? stmt->upsert_status->warning_count : 0;
}
/* }}} */
@@ -1689,7 +1689,7 @@ static unsigned int
MYSQLND_METHOD(mysqlnd_stmt, server_status)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->upsert_status.server_status : 0;
+ return stmt? stmt->upsert_status->server_status : 0;
}
/* }}} */
@@ -1719,7 +1719,7 @@ static unsigned int
MYSQLND_METHOD(mysqlnd_stmt, errno)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->error_info.error_no : 0;
+ return stmt? stmt->error_info->error_no : 0;
}
/* }}} */
@@ -1729,7 +1729,7 @@ static const char *
MYSQLND_METHOD(mysqlnd_stmt, error)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt? stmt->error_info.error : 0;
+ return stmt? stmt->error_info->error : 0;
}
/* }}} */
@@ -1739,7 +1739,7 @@ static const char *
MYSQLND_METHOD(mysqlnd_stmt, sqlstate)(const MYSQLND_STMT * const s TSRMLS_DC)
{
MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
- return stmt && stmt->error_info.sqlstate[0] ? stmt->error_info.sqlstate:MYSQLND_SQLSTATE_NULL;
+ return stmt && stmt->error_info->sqlstate[0] ? stmt->error_info->sqlstate:MYSQLND_SQLSTATE_NULL;
}
/* }}} */
@@ -1819,7 +1819,7 @@ MYSQLND_METHOD(mysqlnd_stmt, result_metadata)(MYSQLND_STMT * const s TSRMLS_DC)
DBG_RETURN(result);
} while (0);
- SET_OOM_ERROR(stmt->conn->error_info);
+ SET_OOM_ERROR(*stmt->conn->error_info);
if (result) {
result->m.free_result(result, TRUE TSRMLS_CC);
}
@@ -2118,10 +2118,10 @@ MYSQLND_METHOD(mysqlnd_stmt, free_stmt_content)(MYSQLND_STMT * const s TSRMLS_DC
stmt->result->m.free_result_internal(stmt->result TSRMLS_CC);
stmt->result = NULL;
}
- if (stmt->error_info.error_list) {
- zend_llist_clean(stmt->error_info.error_list);
- mnd_pefree(stmt->error_info.error_list, s->persistent);
- stmt->error_info.error_list = NULL;
+ if (stmt->error_info->error_list) {
+ zend_llist_clean(stmt->error_info->error_list);
+ mnd_pefree(stmt->error_info->error_list, s->persistent);
+ stmt->error_info->error_list = NULL;
}
DBG_VOID_RETURN;
@@ -2146,8 +2146,8 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, net_close)(MYSQLND_STMT * const s, zend_boo
conn = stmt->conn;
- SET_EMPTY_ERROR(stmt->error_info);
- SET_EMPTY_ERROR(stmt->conn->error_info);
+ SET_EMPTY_ERROR(*stmt->error_info);
+ SET_EMPTY_ERROR(*stmt->conn->error_info);
/*
If the user decided to close the statement right after execute()
@@ -2180,7 +2180,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, net_close)(MYSQLND_STMT * const s, zend_boo
FAIL == conn->m->simple_command(conn, COM_STMT_CLOSE, cmd_buf, sizeof(cmd_buf),
PROT_LAST /* COM_STMT_CLOSE doesn't send an OK packet*/,
FALSE, TRUE TSRMLS_CC)) {
- COPY_CLIENT_ERROR(stmt->error_info, conn->error_info);
+ COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
DBG_RETURN(FAIL);
}
}