diff options
-rw-r--r-- | VC++Files/winmysqladmin/mysql.h | 2 | ||||
-rw-r--r-- | client/mysqlshow.c | 16 | ||||
-rw-r--r-- | include/mysql.h | 2 | ||||
-rw-r--r-- | libmysqld/lib_sql.cc | 5 | ||||
-rw-r--r-- | sql-common/client.c | 2 | ||||
-rw-r--r-- | sql/protocol.cc | 10 | ||||
-rw-r--r-- | sql/protocol.h | 1 |
7 files changed, 16 insertions, 22 deletions
diff --git a/VC++Files/winmysqladmin/mysql.h b/VC++Files/winmysqladmin/mysql.h index f01b55f5d3f..734d78efea0 100644 --- a/VC++Files/winmysqladmin/mysql.h +++ b/VC++Files/winmysqladmin/mysql.h @@ -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; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index eee96a9c3eb..5631d296a54 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -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'); diff --git a/include/mysql.h b/include/mysql.h index b87b865608e..24f1961a260 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -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; diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 79fe36615b9..74a1c8c7922 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -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 diff --git a/sql-common/client.c b/sql-common/client.c index df7a3fe4974..59e27e4090a 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -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); diff --git a/sql/protocol.cc b/sql/protocol.cc index 71908d2a958..dc9ab7bf795 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -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"); diff --git a/sql/protocol.h b/sql/protocol.h index ad2593d3ab7..de379db541b 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -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; } |