]> granicus.if.org Git - php/commitdiff
MNDR:
authorAndrey Hristov <andrey@php.net>
Mon, 2 Nov 2015 14:59:19 +0000 (15:59 +0100)
committerAndrey Hristov <andrey@php.net>
Thu, 12 Nov 2015 15:19:16 +0000 (16:19 +0100)
- remove COM_FIELD_LIST

ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd_result_meta.c
ext/mysqlnd/mysqlnd_structs.h
ext/mysqlnd/mysqlnd_wireprotocol.c
ext/mysqlnd/mysqlnd_wireprotocol.h

index f01d6687c1b2c05fa93bf966a7f2006062105785..3fb0d36a133a12c5622b2b27b3980a9c0fb4c7fc 100644 (file)
@@ -1373,72 +1373,6 @@ mysqlnd_poll(MYSQLND **r_array, MYSQLND **e_array, MYSQLND ***dont_poll, long se
 /* }}} */
 
 
-/*
-  COM_FIELD_LIST is special, different from a SHOW FIELDS FROM :
-  - There is no result set header - status from the command, which
-    impacts us to allocate big chunk of memory for reading the metadata.
-  - The EOF packet is consumed by the metadata packet reader.
-*/
-
-/* {{{ mysqlnd_conn_data::list_fields */
-MYSQLND_RES *
-MYSQLND_METHOD(mysqlnd_conn_data, list_fields)(MYSQLND_CONN_DATA * conn, const char *table, const char *achtung_wild)
-{
-       const size_t this_func = STRUCT_OFFSET(MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data), list_fields);
-       MYSQLND_RES * result = NULL;
-       DBG_ENTER("mysqlnd_conn_data::list_fields");
-       DBG_INF_FMT("conn=%llu table=%s wild=%s", conn->thread_id, table? table:"",achtung_wild? achtung_wild:"");
-
-       if (PASS == conn->m->local_tx_start(conn, this_func)) {
-               do {
-                       enum_func_status ret = FAIL;
-                       const MYSQLND_CSTRING tbl = {table, strlen(table)};
-                       const MYSQLND_CSTRING wildcard = {achtung_wild, strlen(achtung_wild)};
-
-                       struct st_mysqlnd_protocol_command * command = conn->command_factory(COM_FIELD_LIST, conn, tbl, wildcard);
-                       if (command) {
-                               ret = command->run(command);
-                               command->free_command(command);
-                       }
-                       if (ret == FAIL) {
-                               break;
-                       }
-
-                       /*
-                          Prepare for the worst case.
-                          MyISAM goes to 2500 BIT columns, double it for safety.
-                       */
-                       result = conn->m->result_init(5000, conn->persistent);
-                       if (!result) {
-                               break;
-                       }
-
-                       if (FAIL == result->m.read_result_metadata(result, conn)) {
-                               DBG_ERR("Error occurred while reading metadata");
-                               result->m.free_result(result, TRUE);
-                               result = NULL;
-                               break;
-                       }
-
-                       result->type = MYSQLND_RES_NORMAL;
-                       result->unbuf = mysqlnd_result_unbuffered_init(result->field_count, FALSE, result->persistent);
-                       if (!result->unbuf) {
-                               /* OOM */
-                               SET_OOM_ERROR(conn->error_info);
-                               result->m.free_result(result, TRUE);
-                               result = NULL;
-                               break;
-                       }
-                       result->unbuf->eof_reached = TRUE;
-               } while (0);
-               conn->m->local_tx_end(conn, this_func, result == NULL? FAIL:PASS);
-       }
-
-       DBG_RETURN(result);
-}
-/* }}} */
-
-
 /* {{{ mysqlnd_conn_data::list_method */
 MYSQLND_RES *
 MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const char * query, const char *achtung_wild, char *par1)
@@ -2894,7 +2828,6 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_conn_data)
        MYSQLND_METHOD(mysqlnd_conn_data, get_proto_info),
        MYSQLND_METHOD(mysqlnd_conn_data, info),
        MYSQLND_METHOD(mysqlnd_conn_data, charset_name),
-       MYSQLND_METHOD(mysqlnd_conn_data, list_fields),
        MYSQLND_METHOD(mysqlnd_conn_data, list_method),
 
        MYSQLND_METHOD(mysqlnd_conn_data, insert_id),
@@ -2916,7 +2849,6 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_conn_data)
        MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, get_reference),
        MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_reference),
 
-//     MYSQLND_METHOD(mysqlnd_conn_data, send_command_handle_response),
        MYSQLND_METHOD(mysqlnd_conn_data, restart_psession),
        MYSQLND_METHOD(mysqlnd_conn_data, end_psession),
        MYSQLND_METHOD(mysqlnd_conn_data, send_close),
index 9394f627e42fea77750a4e7f80dafd0fcab3be15..85c979458330114fd0894332e73be3d1ce7c36c8 100644 (file)
@@ -84,18 +84,9 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
                        DBG_RETURN(FAIL);
                }
 
-               if (field_packet->stupid_list_fields_eof == TRUE) {
-                       meta->field_count = i;
-                       break;
-               }
-
                if (mysqlnd_ps_fetch_functions[meta->fields[i].type].func == NULL) {
-                       DBG_ERR_FMT("Unknown type %u sent by the server.  Please send a report to the developers",
-                                               meta->fields[i].type);
-                       php_error_docref(NULL, E_WARNING,
-                                                        "Unknown type %u sent by the server. "
-                                                        "Please send a report to the developers",
-                                                        meta->fields[i].type);
+                       DBG_ERR_FMT("Unknown type %u sent by the server.  Please send a report to the developers", meta->fields[i].type);
+                       php_error_docref(NULL, E_WARNING, "Unknown type %u sent by the server. Please send a report to the developers", meta->fields[i].type);
                        PACKET_FREE(field_packet);
                        DBG_RETURN(FAIL);
                }
index f1db6f424df5038534a27a31e5324579670d1be8..8c15a7b885c0fe26bd2af5174462d965210fc963 100644 (file)
@@ -493,7 +493,6 @@ typedef const char *                (*func_mysqlnd_conn_data__get_host_information)(const MYSQ
 typedef unsigned int           (*func_mysqlnd_conn_data__get_protocol_information)(const MYSQLND_CONN_DATA * const conn);
 typedef const char *           (*func_mysqlnd_conn_data__get_last_message)(const MYSQLND_CONN_DATA * const conn);
 typedef const char *           (*func_mysqlnd_conn_data__charset_name)(const MYSQLND_CONN_DATA * const conn);
-typedef MYSQLND_RES *          (*func_mysqlnd_conn_data__list_fields)(MYSQLND_CONN_DATA * conn, const char * table, const char * achtung_wild);
 typedef MYSQLND_RES *          (*func_mysqlnd_conn_data__list_method)(MYSQLND_CONN_DATA * conn, const char * query, const char * achtung_wild, char *par1);
 
 typedef uint64_t                       (*func_mysqlnd_conn_data__get_last_insert_id)(const MYSQLND_CONN_DATA * const conn);
@@ -585,7 +584,6 @@ MYSQLND_CLASS_METHODS_TYPE(mysqlnd_conn_data)
        func_mysqlnd_conn_data__get_protocol_information get_protocol_information;
        func_mysqlnd_conn_data__get_last_message get_last_message;
        func_mysqlnd_conn_data__charset_name charset_name;
-       func_mysqlnd_conn_data__list_fields list_fields;
        func_mysqlnd_conn_data__list_method list_method;
 
        func_mysqlnd_conn_data__get_last_insert_id get_last_insert_id;
index ad89fc000757d5c5224e64d238da8ec5f00f1fc2..975239011f62667ee1fb6e09e1203f823aae3513 100644 (file)
@@ -1292,9 +1292,8 @@ php_mysqlnd_rset_field_read(void * _packet)
                DBG_ERR_FMT("Server error : (%u) %s", packet->error_info.error_no, packet->error_info.error);
                DBG_RETURN(PASS);
        } else if (EODATA_MARKER == *p && packet->header.size < 8) {
-               /* Premature EOF. That should be COM_FIELD_LIST */
+               /* Premature EOF. That should be COM_FIELD_LIST. But we don't support COM_FIELD_LIST anymore, thus this should not happen */
                DBG_INF("Premature EOF. That should be COM_FIELD_LIST");
-               packet->stupid_list_fields_eof = TRUE;
                DBG_RETURN(PASS);
        }
 
@@ -3114,79 +3113,6 @@ mysqlnd_com_ping_create_command(va_list args)
 }
 /* }}} */
 
-/************************** COM_FIELD_LIST ******************************************/
-struct st_mysqlnd_protocol_com_field_list_command
-{
-       struct st_mysqlnd_protocol_command parent;
-       struct st_mysqlnd_com_field_list_context
-       {
-               MYSQLND_CONN_DATA * conn;
-               MYSQLND_CSTRING table;
-               MYSQLND_CSTRING achtung_wild;
-       } context;
-};
-
-
-/* {{{ mysqlnd_com_field_list_run */
-static enum_func_status
-mysqlnd_com_field_list_run(void *cmd)
-{
-       struct st_mysqlnd_protocol_com_field_list_command * command = (struct st_mysqlnd_protocol_com_field_list_command *) cmd;
-       enum_func_status ret = FAIL;
-       MYSQLND_CONN_DATA * conn = command->context.conn;
-       /* db + \0 + wild + \0 (for wild) */
-       zend_uchar buff[MYSQLND_MAX_ALLOWED_DB_LEN * 2 + 1 + 1], *p = buff;
-
-       DBG_ENTER("mysqlnd_com_field_list_run");
-
-       if (command->context.table.s && command->context.table.l) {
-               size_t to_copy = MIN(command->context.table.l, MYSQLND_MAX_ALLOWED_DB_LEN);
-               memcpy(p, command->context.table.s, to_copy);
-               p += to_copy;
-               *p++ = '\0';
-       }
-
-       if (command->context.achtung_wild.s && command->context.achtung_wild.l) {
-               size_t to_copy = MIN(command->context.achtung_wild.l, MYSQLND_MAX_ALLOWED_DB_LEN);
-               memcpy(p, command->context.achtung_wild.s, to_copy);
-               p += to_copy;
-               *p++ = '\0';
-       }
-
-       ret = send_command(COM_FIELD_LIST, buff, p - buff, FALSE,
-                                          &conn->state,
-                                          conn->error_info,
-                                          conn->upsert_status,
-                                          conn->stats,
-                                          conn->payload_decoder_factory,
-                                          conn->m->send_close,
-                                          conn);
-
-       DBG_RETURN(ret);
-}
-/* }}} */
-
-
-/* {{{ mysqlnd_com_field_list_create_command */
-static struct st_mysqlnd_protocol_command *
-mysqlnd_com_field_list_create_command(va_list args)
-{
-       struct st_mysqlnd_protocol_com_field_list_command * command;
-       DBG_ENTER("mysqlnd_com_field_list_create_command");
-       command = mnd_ecalloc(1, sizeof(struct st_mysqlnd_protocol_com_field_list_command));
-       if (command) {
-               command->context.conn = va_arg(args, MYSQLND_CONN_DATA *);
-               command->context.table = va_arg(args, MYSQLND_CSTRING);
-               command->context.achtung_wild = va_arg(args, MYSQLND_CSTRING);
-
-               command->parent.free_command = mysqlnd_com_no_params_free_command;
-               command->parent.run = mysqlnd_com_field_list_run;
-       }
-
-       DBG_RETURN((struct st_mysqlnd_protocol_command *) command);
-}
-/* }}} */
-
 
 /************************** COM_STATISTICS ******************************************/
 struct st_mysqlnd_protocol_com_statistics_command
@@ -4174,9 +4100,6 @@ mysqlnd_get_command(enum php_mysqlnd_server_command command, ...)
                case COM_PING:
                        ret = mysqlnd_com_ping_create_command(args);
                        break;
-               case COM_FIELD_LIST:
-                       ret = mysqlnd_com_field_list_create_command(args);
-                       break;
                case COM_STATISTICS:
                        ret = mysqlnd_com_statistics_create_command(args);
                        break;
index 8915cfd3947464f21e0654b6b11e56953e223c5f..2643ea55647ee8414622369a2b205df20c8d97cc 100644 (file)
@@ -207,7 +207,6 @@ typedef struct st_mysqlnd_packet_res_field {
        MYSQLND_FIELD                   *metadata;
        /* For table definitions, empty for result sets */
        zend_bool                               skip_parsing;
-       zend_bool                               stupid_list_fields_eof;
        zend_bool                               persistent_alloc;
 
        MYSQLND_ERROR_INFO              error_info;