mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
MNDR:
- remove COM_FIELD_LIST
This commit is contained in:
parent
75a1fcc724
commit
fefc3045a3
5 changed files with 3 additions and 160 deletions
|
@ -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_conn_data::list_method */
|
||||||
MYSQLND_RES *
|
MYSQLND_RES *
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, list_method)(MYSQLND_CONN_DATA * conn, const char * query, const char *achtung_wild, char *par1)
|
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, get_proto_info),
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, info),
|
MYSQLND_METHOD(mysqlnd_conn_data, info),
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, charset_name),
|
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, list_method),
|
||||||
|
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, insert_id),
|
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, get_reference),
|
||||||
MYSQLND_METHOD_PRIVATE(mysqlnd_conn_data, free_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, restart_psession),
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, end_psession),
|
MYSQLND_METHOD(mysqlnd_conn_data, end_psession),
|
||||||
MYSQLND_METHOD(mysqlnd_conn_data, send_close),
|
MYSQLND_METHOD(mysqlnd_conn_data, send_close),
|
||||||
|
|
|
@ -84,18 +84,9 @@ MYSQLND_METHOD(mysqlnd_res_meta, read_metadata)(MYSQLND_RES_METADATA * const met
|
||||||
DBG_RETURN(FAIL);
|
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) {
|
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",
|
DBG_ERR_FMT("Unknown type %u sent by the server. Please send a report to the developers", meta->fields[i].type);
|
||||||
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);
|
||||||
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);
|
PACKET_FREE(field_packet);
|
||||||
DBG_RETURN(FAIL);
|
DBG_RETURN(FAIL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 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__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 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 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);
|
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_protocol_information get_protocol_information;
|
||||||
func_mysqlnd_conn_data__get_last_message get_last_message;
|
func_mysqlnd_conn_data__get_last_message get_last_message;
|
||||||
func_mysqlnd_conn_data__charset_name charset_name;
|
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__list_method list_method;
|
||||||
|
|
||||||
func_mysqlnd_conn_data__get_last_insert_id get_last_insert_id;
|
func_mysqlnd_conn_data__get_last_insert_id get_last_insert_id;
|
||||||
|
|
|
@ -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_ERR_FMT("Server error : (%u) %s", packet->error_info.error_no, packet->error_info.error);
|
||||||
DBG_RETURN(PASS);
|
DBG_RETURN(PASS);
|
||||||
} else if (EODATA_MARKER == *p && packet->header.size < 8) {
|
} 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");
|
DBG_INF("Premature EOF. That should be COM_FIELD_LIST");
|
||||||
packet->stupid_list_fields_eof = TRUE;
|
|
||||||
DBG_RETURN(PASS);
|
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 ******************************************/
|
/************************** COM_STATISTICS ******************************************/
|
||||||
struct st_mysqlnd_protocol_com_statistics_command
|
struct st_mysqlnd_protocol_com_statistics_command
|
||||||
|
@ -4174,9 +4100,6 @@ mysqlnd_get_command(enum php_mysqlnd_server_command command, ...)
|
||||||
case COM_PING:
|
case COM_PING:
|
||||||
ret = mysqlnd_com_ping_create_command(args);
|
ret = mysqlnd_com_ping_create_command(args);
|
||||||
break;
|
break;
|
||||||
case COM_FIELD_LIST:
|
|
||||||
ret = mysqlnd_com_field_list_create_command(args);
|
|
||||||
break;
|
|
||||||
case COM_STATISTICS:
|
case COM_STATISTICS:
|
||||||
ret = mysqlnd_com_statistics_create_command(args);
|
ret = mysqlnd_com_statistics_create_command(args);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -207,7 +207,6 @@ typedef struct st_mysqlnd_packet_res_field {
|
||||||
MYSQLND_FIELD *metadata;
|
MYSQLND_FIELD *metadata;
|
||||||
/* For table definitions, empty for result sets */
|
/* For table definitions, empty for result sets */
|
||||||
zend_bool skip_parsing;
|
zend_bool skip_parsing;
|
||||||
zend_bool stupid_list_fields_eof;
|
|
||||||
zend_bool persistent_alloc;
|
zend_bool persistent_alloc;
|
||||||
|
|
||||||
MYSQLND_ERROR_INFO error_info;
|
MYSQLND_ERROR_INFO error_info;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue