diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-06-14 13:55:28 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-14 13:55:28 +0200 |
commit | ae29ea2d86cd3fe5b2016baf595744cfb44c52cd (patch) | |
tree | 6f5017d7d25380d567084842e35015f52724e8d1 /client/mysqlshow.c | |
parent | 1b50d599606244677215fbe7b05be1a891fecf18 (diff) | |
parent | ef3f09f0c9e62ea1bf86b33b5d97e954b3ae34fe (diff) | |
download | mariadb-git-ae29ea2d86cd3fe5b2016baf595744cfb44c52cd.tar.gz |
Merge branch 'mysql/5.5' into 5.5
Diffstat (limited to 'client/mysqlshow.c')
-rw-r--r-- | client/mysqlshow.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 64a6a65b3cb..4349c063ee8 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -51,9 +51,9 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table); static int list_table_status(MYSQL *mysql,const char *db,const char *table); static int list_fields(MYSQL *mysql,const char *db,const char *table, const char *field); -static void print_header(const char *header,uint head_length,...); -static void print_row(const char *header,uint head_length,...); -static void print_trailer(uint length,...); +static void print_header(const char *header,size_t head_length,...); +static void print_row(const char *header,size_t head_length,...); +static void print_trailer(size_t length,...); static void print_res_header(MYSQL_RES *result); static void print_res_top(MYSQL_RES *result); static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur); @@ -366,7 +366,8 @@ static int list_dbs(MYSQL *mysql,const char *wild) { const char *header; - uint length, counter = 0; + size_t length = 0; + uint counter = 0; ulong rowcount = 0L; char tables[NAME_LEN+1], rows[NAME_LEN+1]; char query[NAME_LEN + 100]; @@ -404,7 +405,7 @@ list_dbs(MYSQL *mysql,const char *wild) printf("Wildcard: %s\n",wild); header="Databases"; - length=(uint) strlen(header); + length= strlen(header); field=mysql_fetch_field(result); if (length < field->max_length) length=field->max_length; @@ -492,7 +493,8 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table) { const char *header; - uint head_length, counter = 0; + size_t head_length; + uint counter = 0; char query[NAME_LEN + 100], rows[NAME_LEN], fields[16]; MYSQL_FIELD *field; MYSQL_RES *result; @@ -529,7 +531,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) putchar('\n'); header="Tables"; - head_length=(uint) strlen(header); + head_length= strlen(header); field=mysql_fetch_field(result); if (head_length < field->max_length) head_length=field->max_length; @@ -647,7 +649,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) len= sizeof(query); len-= my_snprintf(query, len, "show table status from `%s`", db); if (wild && wild[0] && len) - strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); + strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) { fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", @@ -680,7 +682,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, const char *wild) { char query[NAME_LEN + 100]; - int len; + size_t len; MYSQL_RES *result; MYSQL_ROW row; ulong UNINIT_VAR(rows); @@ -710,7 +712,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`", table); if (wild && wild[0] && len) - strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); + strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) { fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n", @@ -758,10 +760,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table, *****************************************************************************/ static void -print_header(const char *header,uint head_length,...) +print_header(const char *header,size_t head_length,...) { va_list args; - uint length,i,str_length,pre_space; + size_t length,i,str_length,pre_space; const char *field; va_start(args,head_length); @@ -784,10 +786,10 @@ print_header(const char *header,uint head_length,...) putchar('|'); for (;;) { - str_length=(uint) strlen(field); + str_length= strlen(field); if (str_length > length) str_length=length+1; - pre_space=(uint) (((int) length-(int) str_length)/2)+1; + pre_space= ((length- str_length)/2)+1; for (i=0 ; i < pre_space ; i++) putchar(' '); for (i = 0 ; i < str_length ; i++) @@ -821,11 +823,11 @@ print_header(const char *header,uint head_length,...) static void -print_row(const char *header,uint head_length,...) +print_row(const char *header,size_t head_length,...) { va_list args; const char *field; - uint i,length,field_length; + size_t i,length,field_length; va_start(args,head_length); field=header; length=head_length; @@ -834,7 +836,7 @@ print_row(const char *header,uint head_length,...) putchar('|'); putchar(' '); fputs(field,stdout); - field_length=(uint) strlen(field); + field_length= strlen(field); for (i=field_length ; i <= length ; i++) putchar(' '); if (!(field=va_arg(args,char *))) @@ -848,10 +850,10 @@ print_row(const char *header,uint head_length,...) static void -print_trailer(uint head_length,...) +print_trailer(size_t head_length,...) { va_list args; - uint length,i; + size_t length,i; va_start(args,head_length); length=head_length; @@ -894,7 +896,7 @@ static void print_res_top(MYSQL_RES *result) mysql_field_seek(result,0); while((field = mysql_fetch_field(result))) { - if ((length=(uint) strlen(field->name)) > field->max_length) + if ((length= strlen(field->name)) > field->max_length) field->max_length=length; else length=field->max_length; |