Commit 2189e5e7 authored by unknown's avatar unknown

BUG#9391 mysqlshow prints incorrect "rows" information

 - Removed use of mysql->extra_info
 - Removed unused function send_records_num


VC++Files/winmysqladmin/mysql.h:
  Comment extra_info as not used anymore
client/mysqlshow.c:
  Remove use of extra info. Instead read number of records in table using SELECT COUNT(*)
include/mysql.h:
  Comment extra_info as not used anymore
libmysqld/lib_sql.cc:
  Removed unused function send_records_num
sql-common/client.c:
  Remove use of extra_info since number of records is not sent in the protocol anymore
sql/protocol.cc:
  Removed unused function send_records_num
sql/protocol.h:
  Removed unused function send_records_num
parent 5630f073
......@@ -145,7 +145,7 @@ typedef struct st_mysql {
unsigned long thread_id; /* Id for connection in server */
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
my_ulonglong extra_info; /* Not used */
unsigned long packet_length;
enum mysql_status status;
MYSQL_FIELD *fields;
......
......@@ -611,6 +611,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
char query[1024],*end;
MYSQL_RES *result;
MYSQL_ROW row;
ulong rows;
if (mysql_select_db(mysql,db))
{
......@@ -618,6 +619,17 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
mysql_error(mysql));
return 1;
}
sprintf(query,"select count(*) from `%s`", table);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{
fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
my_progname,db,table,mysql_error(mysql));
return 1;
}
row = mysql_fetch_row(result);
rows = (ulong) strtoull(row[0], (char**) 0, 10);
mysql_free_result(result);
end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`");
if (wild && wild[0])
strxmov(end," like '",wild,"'",NullS);
......@@ -628,8 +640,8 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
return 1;
}
printf("Database: %s Table: %s Rows: %lu", db,table,
(ulong) mysql->extra_info);
printf("Database: %s Table: %s Rows: %lu", db, table, rows);
if (wild && wild[0])
printf(" Wildcard: %s",wild);
putchar('\n');
......
......@@ -231,7 +231,7 @@ typedef struct st_mysql
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
my_ulonglong extra_info; /* Not used */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port;
......
......@@ -709,11 +709,6 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
DBUG_RETURN(1); /* purecov: inspected */
}
bool Protocol::send_records_num(List<Item> *list, ulonglong records)
{
return false;
}
bool Protocol::write()
{
if (!thd->mysql) // bootstrap file handling
......
......@@ -2446,8 +2446,6 @@ get_info:
if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))
mysql->server_status|= SERVER_STATUS_IN_TRANS;
mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */
if (!(fields=(*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,
protocol_41(mysql) ? 7 : 5)))
DBUG_RETURN(1);
......
......@@ -645,16 +645,6 @@ err:
}
bool Protocol::send_records_num(List<Item> *list, ulonglong records)
{
char *pos;
char buff[20];
pos=net_store_length(buff, (uint) list->elements);
pos=net_store_length(pos, records);
return my_net_write(&thd->net, buff,(uint) (pos-buff));
}
bool Protocol::write()
{
DBUG_ENTER("Protocol::write");
......
......@@ -54,7 +54,6 @@ public:
enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
virtual bool send_fields(List<Item> *list, uint flags);
bool send_records_num(List<Item> *list, ulonglong records);
bool store(I_List<i_string> *str_list);
bool store(const char *from, CHARSET_INFO *cs);
String *storage_packet() { return packet; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment