diff options
author | unknown <msvensson@neptunus.(none)> | 2005-04-13 12:22:20 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2005-04-13 12:22:20 +0200 |
commit | 2189e5e7bd8530eeb1f866a6304651f54cdcad75 (patch) | |
tree | 0c4e2952b0743607c4188361b2f0b86fca004c16 /client/mysqlshow.c | |
parent | 5630f0731ab020471108c67e7ae962ba6eaef625 (diff) | |
download | mariadb-git-2189e5e7bd8530eeb1f866a6304651f54cdcad75.tar.gz |
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
Diffstat (limited to 'client/mysqlshow.c')
-rw-r--r-- | client/mysqlshow.c | 16 |
1 files changed, 14 insertions, 2 deletions
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'); |