From 6051a477762c030dfdc7f2bf4cfecd2a54d0ab2a Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 2 Oct 2015 14:23:15 +0200 Subject: MNDR - Rename simple_command* to send_command --- ext/mysqlnd/mysqlnd_loaddata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 9679bec4df..da09c71cca 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -212,7 +212,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen infile_error: /* get response from server and update upsert values */ - if (FAIL == conn->m->simple_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_QUERY, FALSE)) { + if (FAIL == conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_QUERY, FALSE)) { result = FAIL; } -- cgit v1.2.1 From 4bb784cd0d80c330364cdfebc824a434cc27f05a Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 30 Oct 2015 11:35:58 +0100 Subject: MNDR: - make MYSQLND_ERROR_INFO a class --- ext/mysqlnd/mysqlnd_loaddata.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index da09c71cca..b3f4140474 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -176,7 +176,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen *is_warning = TRUE; /* error occurred */ tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf)); - SET_CLIENT_ERROR(*conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); + SET_CLIENT_ERROR(conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); /* write empty packet to server */ ret = net->data->m.send_ex(net, empty_packet, 0, conn->stats, conn->error_info); goto infile_error; @@ -186,14 +186,14 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen while ((bufsize = infile.local_infile_read (info, buf + MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE)) > 0) { if ((ret = net->data->m.send_ex(net, buf, bufsize, conn->stats, conn->error_info)) == 0) { DBG_ERR_FMT("Error during read : %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); - SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); + SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); goto infile_error; } } /* send empty packet for eof */ if ((ret = net->data->m.send_ex(net, empty_packet, 0, conn->stats, conn->error_info)) == 0) { - SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); + SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); goto infile_error; } @@ -204,7 +204,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen *is_warning = TRUE; DBG_ERR_FMT("Bufsize < 0, warning, %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf)); - SET_CLIENT_ERROR(*conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); + SET_CLIENT_ERROR(conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); goto infile_error; } -- cgit v1.2.1 From aa4966d4e37076ed560ba0a10f0758863d8af389 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 30 Oct 2015 16:05:55 +0100 Subject: MNDR: - now send_command_handle_response() also doesn't depend directly on MYSQLND_CONN_DATA --- ext/mysqlnd/mysqlnd_loaddata.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index b3f4140474..b43607443e 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -141,7 +141,7 @@ static const char *lost_conn = "Lost connection to MySQL server during LOAD DATA /* {{{ mysqlnd_handle_local_infile */ enum_func_status -mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zend_bool * is_warning) +mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filename, zend_bool * is_warning) { zend_uchar *buf = NULL; zend_uchar empty_packet[MYSQLND_HEADER_SIZE]; @@ -212,7 +212,8 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * filename, zen infile_error: /* get response from server and update upsert values */ - if (FAIL == conn->m->send_command_handle_response(conn, PROT_OK_PACKET, FALSE, COM_QUERY, FALSE)) { + if (FAIL == send_command_handle_response(PROT_OK_PACKET, FALSE, COM_QUERY, FALSE, + conn->error_info, conn->upsert_status, conn->payload_decoder_factory, &conn->last_message, conn->persistent)) { result = FAIL; } -- cgit v1.2.1 From 7e6f9a84cb8693ec24ec44d902c15d99300d3641 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Mon, 2 Nov 2015 14:16:18 +0100 Subject: MNDR: - split handle_response() into handle_OK and handle_EOF --- ext/mysqlnd/mysqlnd_loaddata.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index b43607443e..51e887c128 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -136,7 +136,7 @@ mysqlnd_local_infile_default(MYSQLND_CONN_DATA * conn) /* }}} */ -static const char *lost_conn = "Lost connection to MySQL server during LOAD DATA of local file"; +static const char *lost_conn = "Lost connection to MySQL server during LOAD DATA of a local file"; /* {{{ mysqlnd_handle_local_infile */ @@ -213,7 +213,11 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam infile_error: /* get response from server and update upsert values */ if (FAIL == send_command_handle_response(PROT_OK_PACKET, FALSE, COM_QUERY, FALSE, - conn->error_info, conn->upsert_status, conn->payload_decoder_factory, &conn->last_message, conn->persistent)) { + conn->error_info, + conn->upsert_status, + conn->payload_decoder_factory, + &conn->last_message, + conn->persistent)) { result = FAIL; } -- cgit v1.2.1 From 0d3329fc9310e3f7d9e6e28ee0f3f386e06031d7 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 6 Nov 2015 16:36:02 +0100 Subject: MNDR: - send_command and send_command_handle_response_* moved to a structure --- ext/mysqlnd/mysqlnd_loaddata.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 51e887c128..65e696f079 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -212,12 +212,13 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam infile_error: /* get response from server and update upsert values */ - if (FAIL == send_command_handle_response(PROT_OK_PACKET, FALSE, COM_QUERY, FALSE, - conn->error_info, - conn->upsert_status, - conn->payload_decoder_factory, - &conn->last_message, - conn->persistent)) { + if (FAIL == conn->payload_decoder_factory->m.send_command_handle_response( + conn->payload_decoder_factory, + PROT_OK_PACKET, FALSE, COM_QUERY, FALSE, + conn->error_info, + conn->upsert_status, + &conn->last_message, + conn->persistent)) { result = FAIL; } -- cgit v1.2.1 From e9f3139f438ef712d82b69984a65da4230fdfeb2 Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Mon, 9 Nov 2015 14:56:16 +0100 Subject: MNDR: - split MYSQLND_NET into MYSQLND_NET and MYSQLND_VIO MYSQLND_NET is above MYSQLND_VIO. _NET takes care of protocol packet counting (even with compressed), while VIO is just about the network (or in case of windows, non-network, but PIPE) transport. --- ext/mysqlnd/mysqlnd_loaddata.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 65e696f079..70688d32ca 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -152,13 +152,14 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam size_t ret; MYSQLND_INFILE infile; MYSQLND_NET * net = conn->net; + MYSQLND_VIO * vio = conn->vio; DBG_ENTER("mysqlnd_handle_local_infile"); if (!(conn->options->flags & CLIENT_LOCAL_FILES)) { php_error_docref(NULL, E_WARNING, "LOAD DATA LOCAL INFILE forbidden"); /* write empty packet to server */ - ret = net->data->m.send_ex(net, empty_packet, 0, conn->stats, conn->error_info); + ret = net->data->m.send(net, vio, empty_packet, 0, conn->stats, conn->error_info); *is_warning = TRUE; goto infile_error; } @@ -178,13 +179,13 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam tmp_error_no = infile.local_infile_error(info, tmp_buf, sizeof(tmp_buf)); SET_CLIENT_ERROR(conn->error_info, tmp_error_no, UNKNOWN_SQLSTATE, tmp_buf); /* write empty packet to server */ - ret = net->data->m.send_ex(net, empty_packet, 0, conn->stats, conn->error_info); + ret = net->data->m.send(net, vio, empty_packet, 0, conn->stats, conn->error_info); goto infile_error; } /* read data */ while ((bufsize = infile.local_infile_read (info, buf + MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE)) > 0) { - if ((ret = net->data->m.send_ex(net, buf, bufsize, conn->stats, conn->error_info)) == 0) { + if ((ret = net->data->m.send(net, vio, buf, bufsize, conn->stats, conn->error_info)) == 0) { DBG_ERR_FMT("Error during read : %d %s %s", CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); goto infile_error; @@ -192,7 +193,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam } /* send empty packet for eof */ - if ((ret = net->data->m.send_ex(net, empty_packet, 0, conn->stats, conn->error_info)) == 0) { + if ((ret = net->data->m.send(net, vio, empty_packet, 0, conn->stats, conn->error_info)) == 0) { SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn); goto infile_error; } -- cgit v1.2.1 From 654d1a7caf068c67560fd49c86cf6f6354322d6f Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Tue, 10 Nov 2015 11:02:33 +0100 Subject: MNDR: - rename MYSQLND_NET to MYSQLND_PPEC (protocol packet envelope codec). PPEC does only the encoding and decoding to the protocol frame. --- ext/mysqlnd/mysqlnd_loaddata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 70688d32ca..bd8434fd1e 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -151,7 +151,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam int bufsize; size_t ret; MYSQLND_INFILE infile; - MYSQLND_NET * net = conn->net; + MYSQLND_PPEC * net = conn->net; MYSQLND_VIO * vio = conn->vio; DBG_ENTER("mysqlnd_handle_local_infile"); -- cgit v1.2.1 From a530ecff978cbf2e67a774cae40899d3934c163a Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Tue, 10 Nov 2015 11:53:19 +0100 Subject: MNDR: - better name for MYSQLND_PPEC - MYSQLND_PFC (protocol frame codec) --- ext/mysqlnd/mysqlnd_loaddata.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index bd8434fd1e..4eb85e20e0 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -17,7 +17,6 @@ | Georg Richter | +----------------------------------------------------------------------+ */ - #include "php.h" #include "php_globals.h" #include "mysqlnd.h" @@ -151,7 +150,7 @@ mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filenam int bufsize; size_t ret; MYSQLND_INFILE infile; - MYSQLND_PPEC * net = conn->net; + MYSQLND_PFC * net = conn->protocol_frame_codec; MYSQLND_VIO * vio = conn->vio; DBG_ENTER("mysqlnd_handle_local_infile"); -- cgit v1.2.1 From e8ace2d4db77789f1d8ae452c008a2b952dbe29d Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Tue, 10 Nov 2015 13:32:59 +0100 Subject: MNDR: - remove inclusion of uneeded headers --- ext/mysqlnd/mysqlnd_loaddata.c | 1 - 1 file changed, 1 deletion(-) (limited to 'ext/mysqlnd/mysqlnd_loaddata.c') diff --git a/ext/mysqlnd/mysqlnd_loaddata.c b/ext/mysqlnd/mysqlnd_loaddata.c index 4eb85e20e0..d9ad4824d4 100644 --- a/ext/mysqlnd/mysqlnd_loaddata.c +++ b/ext/mysqlnd/mysqlnd_loaddata.c @@ -18,7 +18,6 @@ +----------------------------------------------------------------------+ */ #include "php.h" -#include "php_globals.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" #include "mysqlnd_priv.h" -- cgit v1.2.1