Loading client/client_priv.h +3 −3 Original line number Diff line number Diff line Loading @@ -45,9 +45,9 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif ,OPT_IGNORE_TABLE OPT_IGNORE_TABLE }; client/mysqlshow.c +38 −27 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ #include <sslopt-vars.h> static my_string host=0,opt_password=0,user=0; static my_bool opt_show_keys= 0, opt_compress= 0, opt_status= 0, static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0, tty_password= 0, opt_table_type= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; Loading Loading @@ -71,8 +71,7 @@ int main(int argc, char **argv) char *pos= argv[argc-1], *to; for (to= pos ; *pos ; pos++, to++) { switch (*pos) { switch (*pos) { case '*': *pos= '%'; first_argument_uses_wildcards= 1; Loading Loading @@ -163,6 +162,10 @@ static struct my_option my_long_options[] = {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", (gptr*) &default_charset, (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"count", OPT_COUNT, "Show number of rows per table (may be slow for not MyISAM tables)", (gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -308,6 +311,14 @@ get_options(int *argc,char ***argv) if (tty_password) opt_password=get_tty_password(NullS); if (opt_count) { /* We need to set verbose to 2 as we need to change the output to include the number-of-rows column */ opt_verbose= 2; } return; } Loading @@ -322,7 +333,7 @@ list_dbs(MYSQL *mysql,const char *wild) char query[255]; MYSQL_FIELD *field; MYSQL_RES *result; MYSQL_ROW row, trow, rrow; MYSQL_ROW row, rrow; if (!(result=mysql_list_dbs(mysql,wild))) { Loading Loading @@ -352,11 +363,6 @@ list_dbs(MYSQL *mysql,const char *wild) if (opt_verbose) { /* * Original code by MG16373; Slightly modified by Monty. * Print now the count of tables and rows for each database. */ if (!(mysql_select_db(mysql,row[0]))) { MYSQL_RES *tresult = mysql_list_tables(mysql,(char*)NULL); Loading @@ -366,6 +372,8 @@ list_dbs(MYSQL *mysql,const char *wild) rowcount = 0; if (opt_verbose > 1) { /* Print the count of tables and rows for each database */ MYSQL_ROW trow; while ((trow = mysql_fetch_row(tresult))) { sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]); Loading Loading @@ -487,10 +495,6 @@ list_tables(MYSQL *mysql,const char *db,const char *table) while ((row = mysql_fetch_row(result))) { /* * Modified by MG16373 * Print now the count of rows for each table. */ counter++; if (opt_verbose > 0) { Loading @@ -510,6 +514,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) if (opt_verbose > 1) { /* Print the count of rows for each table */ sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]); if (!(mysql_query(mysql,query))) { Loading Loading @@ -574,7 +579,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) MYSQL_RES *result; MYSQL_ROW row; end=strxmov(query,"show table status from ",db,NullS); end=strxmov(query,"show table status from `",db,"`",NullS); if (wild && wild[0]) strxmov(end," like '",wild,"'",NullS); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) Loading @@ -600,8 +605,8 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) } /* ** list fields uses field interface as an example of how to parse ** a MYSQL FIELD list fields uses field interface as an example of how to parse a MYSQL FIELD */ static int Loading @@ -612,6 +617,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, MYSQL_RES *result; MYSQL_ROW row; ulong rows; LINT_INIT(rows); if (mysql_select_db(mysql,db)) { Loading @@ -619,6 +625,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table, mysql_error(mysql)); return 1; } if (opt_count) { sprintf(query,"select count(*) from `%s`", table); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) { Loading @@ -629,6 +638,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, 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]) Loading @@ -640,8 +650,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table, return 1; } printf("Database: %s Table: %s Rows: %lu", db, table, rows); printf("Database: %s Table: %s", db, table); if (opt_count) printf(" Rows: %lu", rows); if (wild && wild[0]) printf(" Wildcard: %s",wild); putchar('\n'); Loading Loading @@ -675,7 +686,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, /***************************************************************************** ** General functions to print a nice ascii-table from data General functions to print a nice ascii-table from data *****************************************************************************/ static void Loading mysys/my_thr_init.c +5 −6 Original line number Diff line number Diff line Loading @@ -67,12 +67,11 @@ my_bool my_thread_global_init(void) /* Set mutex type to "fast" a.k.a "adaptive" The mutex kind determines what happens if a thread attempts to lock a mutex it already owns with pthread_mutex_lock(3). If the mutex is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends the calling thread forever. If the mutex is of the ``error checking'' kind, pthread_mutex_lock(3) returns immediately with the error code EDEADLK. In this case the thread may steal the mutex from some other thread that is waiting for the same mutex. This will save us some context switches but may cause a thread to 'starve forever' while waiting for the mutex (not likely if the code within the mutex is short). */ pthread_mutexattr_init(&my_fast_mutexattr); pthread_mutexattr_settype(&my_fast_mutexattr, Loading sql/ha_berkeley.cc +1 −3 Original line number Diff line number Diff line Loading @@ -2013,8 +2013,6 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to, !thd->in_lock_tables) lock_type = TL_WRITE_ALLOW_WRITE; lock.type= lock_type; lock_on_read= ((table->reginfo.lock_type > TL_WRITE_ALLOW_READ) ? DB_RMW : 0); } *to++= &lock; return to; Loading sql/ha_berkeley.h +0 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class ha_berkeley: public handler ulong alloced_rec_buff_length; ulong changed_rows; uint primary_key,last_dup_key, hidden_primary_key, version; u_int32_t lock_on_read; bool key_read, using_ignore; bool fix_rec_buff_for_blob(ulong length); byte current_ident[BDB_HIDDEN_PRIMARY_KEY_LENGTH]; Loading Loading
client/client_priv.h +3 −3 Original line number Diff line number Diff line Loading @@ -45,9 +45,9 @@ enum options_client OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH, OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS, OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME, OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT, #ifdef HAVE_NDBCLUSTER_DB ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, #endif ,OPT_IGNORE_TABLE OPT_IGNORE_TABLE };
client/mysqlshow.c +38 −27 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ #include <sslopt-vars.h> static my_string host=0,opt_password=0,user=0; static my_bool opt_show_keys= 0, opt_compress= 0, opt_status= 0, static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0, tty_password= 0, opt_table_type= 0; static uint opt_verbose=0; static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME; Loading Loading @@ -71,8 +71,7 @@ int main(int argc, char **argv) char *pos= argv[argc-1], *to; for (to= pos ; *pos ; pos++, to++) { switch (*pos) { switch (*pos) { case '*': *pos= '%'; first_argument_uses_wildcards= 1; Loading Loading @@ -163,6 +162,10 @@ static struct my_option my_long_options[] = {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", (gptr*) &default_charset, (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"count", OPT_COUNT, "Show number of rows per table (may be slow for not MyISAM tables)", (gptr*) &opt_count, (gptr*) &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"compress", 'C', "Use compression in server/client protocol.", (gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, Loading Loading @@ -308,6 +311,14 @@ get_options(int *argc,char ***argv) if (tty_password) opt_password=get_tty_password(NullS); if (opt_count) { /* We need to set verbose to 2 as we need to change the output to include the number-of-rows column */ opt_verbose= 2; } return; } Loading @@ -322,7 +333,7 @@ list_dbs(MYSQL *mysql,const char *wild) char query[255]; MYSQL_FIELD *field; MYSQL_RES *result; MYSQL_ROW row, trow, rrow; MYSQL_ROW row, rrow; if (!(result=mysql_list_dbs(mysql,wild))) { Loading Loading @@ -352,11 +363,6 @@ list_dbs(MYSQL *mysql,const char *wild) if (opt_verbose) { /* * Original code by MG16373; Slightly modified by Monty. * Print now the count of tables and rows for each database. */ if (!(mysql_select_db(mysql,row[0]))) { MYSQL_RES *tresult = mysql_list_tables(mysql,(char*)NULL); Loading @@ -366,6 +372,8 @@ list_dbs(MYSQL *mysql,const char *wild) rowcount = 0; if (opt_verbose > 1) { /* Print the count of tables and rows for each database */ MYSQL_ROW trow; while ((trow = mysql_fetch_row(tresult))) { sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]); Loading Loading @@ -487,10 +495,6 @@ list_tables(MYSQL *mysql,const char *db,const char *table) while ((row = mysql_fetch_row(result))) { /* * Modified by MG16373 * Print now the count of rows for each table. */ counter++; if (opt_verbose > 0) { Loading @@ -510,6 +514,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table) if (opt_verbose > 1) { /* Print the count of rows for each table */ sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]); if (!(mysql_query(mysql,query))) { Loading Loading @@ -574,7 +579,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) MYSQL_RES *result; MYSQL_ROW row; end=strxmov(query,"show table status from ",db,NullS); end=strxmov(query,"show table status from `",db,"`",NullS); if (wild && wild[0]) strxmov(end," like '",wild,"'",NullS); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) Loading @@ -600,8 +605,8 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) } /* ** list fields uses field interface as an example of how to parse ** a MYSQL FIELD list fields uses field interface as an example of how to parse a MYSQL FIELD */ static int Loading @@ -612,6 +617,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, MYSQL_RES *result; MYSQL_ROW row; ulong rows; LINT_INIT(rows); if (mysql_select_db(mysql,db)) { Loading @@ -619,6 +625,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table, mysql_error(mysql)); return 1; } if (opt_count) { sprintf(query,"select count(*) from `%s`", table); if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) { Loading @@ -629,6 +638,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, 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]) Loading @@ -640,8 +650,9 @@ list_fields(MYSQL *mysql,const char *db,const char *table, return 1; } printf("Database: %s Table: %s Rows: %lu", db, table, rows); printf("Database: %s Table: %s", db, table); if (opt_count) printf(" Rows: %lu", rows); if (wild && wild[0]) printf(" Wildcard: %s",wild); putchar('\n'); Loading Loading @@ -675,7 +686,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table, /***************************************************************************** ** General functions to print a nice ascii-table from data General functions to print a nice ascii-table from data *****************************************************************************/ static void Loading
mysys/my_thr_init.c +5 −6 Original line number Diff line number Diff line Loading @@ -67,12 +67,11 @@ my_bool my_thread_global_init(void) /* Set mutex type to "fast" a.k.a "adaptive" The mutex kind determines what happens if a thread attempts to lock a mutex it already owns with pthread_mutex_lock(3). If the mutex is of the ``fast'' kind, pthread_mutex_lock(3) simply suspends the calling thread forever. If the mutex is of the ``error checking'' kind, pthread_mutex_lock(3) returns immediately with the error code EDEADLK. In this case the thread may steal the mutex from some other thread that is waiting for the same mutex. This will save us some context switches but may cause a thread to 'starve forever' while waiting for the mutex (not likely if the code within the mutex is short). */ pthread_mutexattr_init(&my_fast_mutexattr); pthread_mutexattr_settype(&my_fast_mutexattr, Loading
sql/ha_berkeley.cc +1 −3 Original line number Diff line number Diff line Loading @@ -2013,8 +2013,6 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to, !thd->in_lock_tables) lock_type = TL_WRITE_ALLOW_WRITE; lock.type= lock_type; lock_on_read= ((table->reginfo.lock_type > TL_WRITE_ALLOW_READ) ? DB_RMW : 0); } *to++= &lock; return to; Loading
sql/ha_berkeley.h +0 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class ha_berkeley: public handler ulong alloced_rec_buff_length; ulong changed_rows; uint primary_key,last_dup_key, hidden_primary_key, version; u_int32_t lock_on_read; bool key_read, using_ignore; bool fix_rec_buff_for_blob(ulong length); byte current_ident[BDB_HIDDEN_PRIMARY_KEY_LENGTH]; Loading