mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
3c78bfe7f1
- The client gets a progress report message that triggers a callback function if requested with mysql_options(MYSQL_PROGRESS_CALLBACK, function) - Added Progress field last to 'show processlist' - Stage, Max_stage and Progress field added to information_schema.progresslist - The 'mysql' client by defaults enables progress reports when the output is a tty. - Added progress_report_time time variable to configure how often progress reports is sent to client Added read only system variable 'in_transaction' which is 1 if we have executed a BEGIN statement. client/client_priv.h: Added OPT_REPORT_PROGRESS client/mysql.cc: Added option --progress-reports (on by default if not batch mode) Progress reports is written to stdout for long running commands include/Makefile.am: Added mysql/service_progress_report.h include/myisamchk.h: Added variables to be able to do progress reporting in Aria and later in MyISAM include/mysql.h: Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK include/mysql.h.pp: Added new mysql_options() parameter: MYSQL_PROGRESS_CALLBACK include/mysql/plugin.h: Added functions for reporting progress. include/mysql/plugin_auth.h.pp: Added functions for reporting progress. include/mysql_com.h: Added CLIENT_PROGRESS mysql_real_connect() flag. include/sql_common.h: Added callback function for reporting progress mysql-test/r/old-mode.result: Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode. mysql-test/suite/funcs_1/datadict/datadict_priv.inc: Added new column mysql-test/suite/funcs_1/datadict/processlist_priv.inc: Test all new PROCESSLIST columns mysql-test/suite/funcs_1/r/is_columns_is.result: Updated results mysql-test/suite/funcs_1/r/is_columns_is_embedded.result: Updated results mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result: Updated results mysql-test/suite/funcs_1/r/is_tables_is_embedded.result: Updated results mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result: Updated results mysql-test/suite/funcs_1/r/processlist_priv_ps.result: Updated results mysql-test/suite/funcs_1/r/processlist_val_no_prot.result: Updated results mysql-test/suite/funcs_1/r/processlist_val_ps.result: Updated results mysql-test/suite/pbxt/r/pbxt_locking.result: Updated results mysql-test/suite/pbxt/r/skip_name_resolve.result: Updated results mysql-test/t/old-mode.test: Ensure that SHOW PROGRESSLIST doesn't have the Progress column in old mode. plugin/handler_socket/handlersocket/Makefile.am: Added -lmysqlservices scripts/mytop.sh: Made 'State' field width dynamic. Added 'Progress' to process list display. sql-common/client.c: Added handling of progress messages. Removed check_license() function. sql/mysql_priv.h: Added opt_progress_report_time sql/mysqld.cc: Added progress_report_time time variable to configure how often progress reports is sent to client sql/protocol.cc: Added net_send_progress_packet() sql/protocol.h: New prototypes sql/set_var.cc: Added variables progress_report_time and in_transaction sql/sql_acl.cc: Safety fix: Made client_capabilities ulonglong sql/sql_class.cc: Added interface functions for progress reporting sql/sql_class.h: Added varibles in THD for progress reporting. Added CF_REPORT_PROGRESS sql/sql_load.cc: Added progress reporting for LOAD DATA INFILE sql/sql_parse.cc: Added CF_REPORT_PROGRESS for top level commands for which it's safe to send progress reports to client sql/sql_show.cc: Added Progress field last to 'show processlist' Stage, Max_stage and Progress field added to information_schema.progresslist sql/sql_table.cc: Added progress reporting for ALTER TABLE Added THD as argument to copy_data_between_tables() storage/maria/ha_maria.cc: Added progress reporting for check table, repair table, analyze table Fixed a bug in start_bulk_insert() that caused alter table to always run with all keys enabled. storage/maria/ma_check.c: Added progress reporting Remember old state before starting repair. This removes some warnings from optimize_table if create-with-sort fails. storage/maria/ma_check_standalone.h: Added dummy reporting function for standalone Aria programs. storage/maria/ma_sort.c: Added progress reporting storage/maria/maria_chk.c: Updated version storage/maria/maria_def.h: Added new prototypes tests/mysql_client_test.c: Added test case for progress reporting
184 lines
6.4 KiB
C++
184 lines
6.4 KiB
C++
/* Copyright (C) 2002-2006 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifdef USE_PRAGMA_INTERFACE
|
|
#pragma interface /* gcc class implementation */
|
|
#endif
|
|
|
|
|
|
class i_string;
|
|
class THD;
|
|
typedef struct st_mysql_field MYSQL_FIELD;
|
|
typedef struct st_mysql_rows MYSQL_ROWS;
|
|
|
|
class Protocol
|
|
{
|
|
protected:
|
|
THD *thd;
|
|
String *packet;
|
|
String *convert;
|
|
uint field_pos;
|
|
#ifndef DBUG_OFF
|
|
enum enum_field_types *field_types;
|
|
#endif
|
|
uint field_count;
|
|
#ifndef EMBEDDED_LIBRARY
|
|
bool net_store_data(const uchar *from, size_t length);
|
|
#else
|
|
virtual bool net_store_data(const uchar *from, size_t length);
|
|
char **next_field;
|
|
MYSQL_FIELD *next_mysql_field;
|
|
MEM_ROOT *alloc;
|
|
#endif
|
|
bool net_store_data(const uchar *from, size_t length,
|
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
|
bool store_string_aux(const char *from, size_t length,
|
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
|
public:
|
|
Protocol() {}
|
|
Protocol(THD *thd_arg) { init(thd_arg); }
|
|
virtual ~Protocol() {}
|
|
void init(THD* thd_arg);
|
|
|
|
enum { SEND_NUM_ROWS= 1, SEND_DEFAULTS= 2, SEND_EOF= 4 };
|
|
virtual bool send_fields(List<Item> *list, uint flags);
|
|
|
|
bool store(I_List<i_string> *str_list);
|
|
bool store(const char *from, CHARSET_INFO *cs);
|
|
String *storage_packet() { return packet; }
|
|
inline void free() { packet->free(); }
|
|
virtual bool write();
|
|
inline bool store(int from)
|
|
{ return store_long((longlong) from); }
|
|
inline bool store(uint32 from)
|
|
{ return store_long((longlong) from); }
|
|
inline bool store(longlong from)
|
|
{ return store_longlong((longlong) from, 0); }
|
|
inline bool store(ulonglong from)
|
|
{ return store_longlong((longlong) from, 1); }
|
|
inline bool store(String *str)
|
|
{ return store((char*) str->ptr(), str->length(), str->charset()); }
|
|
|
|
virtual bool prepare_for_send(List<Item> *item_list)
|
|
{
|
|
field_count=item_list->elements;
|
|
return 0;
|
|
}
|
|
virtual bool flush();
|
|
virtual void end_partial_result_set(THD *thd);
|
|
virtual void prepare_for_resend()=0;
|
|
|
|
virtual bool store_null()=0;
|
|
virtual bool store_tiny(longlong from)=0;
|
|
virtual bool store_short(longlong from)=0;
|
|
virtual bool store_long(longlong from)=0;
|
|
virtual bool store_longlong(longlong from, bool unsigned_flag)=0;
|
|
virtual bool store_decimal(const my_decimal *)=0;
|
|
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs)=0;
|
|
virtual bool store(const char *from, size_t length,
|
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)=0;
|
|
virtual bool store(float from, uint32 decimals, String *buffer)=0;
|
|
virtual bool store(double from, uint32 decimals, String *buffer)=0;
|
|
virtual bool store(MYSQL_TIME *time, int decimals)=0;
|
|
virtual bool store_date(MYSQL_TIME *time)=0;
|
|
virtual bool store_time(MYSQL_TIME *time, int decimals)=0;
|
|
virtual bool store(Field *field)=0;
|
|
#ifdef EMBEDDED_LIBRARY
|
|
int begin_dataset();
|
|
virtual void remove_last_row() {}
|
|
#else
|
|
void remove_last_row() {}
|
|
#endif
|
|
enum enum_protocol_type
|
|
{
|
|
PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1
|
|
/*
|
|
before adding here or change the values, consider that it is cast to a
|
|
bit in sql_cache.cc.
|
|
*/
|
|
};
|
|
virtual enum enum_protocol_type type()= 0;
|
|
};
|
|
|
|
|
|
/** Class used for the old (MySQL 4.0 protocol). */
|
|
|
|
class Protocol_text :public Protocol
|
|
{
|
|
public:
|
|
Protocol_text() {}
|
|
Protocol_text(THD *thd_arg) :Protocol(thd_arg) {}
|
|
virtual void prepare_for_resend();
|
|
virtual bool store_null();
|
|
virtual bool store_tiny(longlong from);
|
|
virtual bool store_short(longlong from);
|
|
virtual bool store_long(longlong from);
|
|
virtual bool store_longlong(longlong from, bool unsigned_flag);
|
|
virtual bool store_decimal(const my_decimal *);
|
|
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
|
|
virtual bool store(const char *from, size_t length,
|
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
|
virtual bool store(MYSQL_TIME *time, int decimals);
|
|
virtual bool store_date(MYSQL_TIME *time);
|
|
virtual bool store_time(MYSQL_TIME *time, int decimals);
|
|
virtual bool store(float nr, uint32 decimals, String *buffer);
|
|
virtual bool store(double from, uint32 decimals, String *buffer);
|
|
virtual bool store(Field *field);
|
|
#ifdef EMBEDDED_LIBRARY
|
|
void remove_last_row();
|
|
#endif
|
|
virtual enum enum_protocol_type type() { return PROTOCOL_TEXT; };
|
|
};
|
|
|
|
|
|
class Protocol_binary :public Protocol
|
|
{
|
|
private:
|
|
uint bit_fields;
|
|
public:
|
|
Protocol_binary() {}
|
|
Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {}
|
|
virtual bool prepare_for_send(List<Item> *item_list);
|
|
virtual void prepare_for_resend();
|
|
#ifdef EMBEDDED_LIBRARY
|
|
virtual bool write();
|
|
bool net_store_data(const uchar *from, size_t length);
|
|
#endif
|
|
virtual bool store_null();
|
|
virtual bool store_tiny(longlong from);
|
|
virtual bool store_short(longlong from);
|
|
virtual bool store_long(longlong from);
|
|
virtual bool store_longlong(longlong from, bool unsigned_flag);
|
|
virtual bool store_decimal(const my_decimal *);
|
|
virtual bool store(const char *from, size_t length, CHARSET_INFO *cs);
|
|
virtual bool store(const char *from, size_t length,
|
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs);
|
|
virtual bool store(MYSQL_TIME *time, int decimals);
|
|
virtual bool store_date(MYSQL_TIME *time);
|
|
virtual bool store_time(MYSQL_TIME *time, int decimals);
|
|
virtual bool store(float nr, uint32 decimals, String *buffer);
|
|
virtual bool store(double from, uint32 decimals, String *buffer);
|
|
virtual bool store(Field *field);
|
|
virtual enum enum_protocol_type type() { return PROTOCOL_BINARY; };
|
|
};
|
|
|
|
void send_warning(THD *thd, uint sql_errno, const char *err=0);
|
|
bool net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
|
|
void net_end_statement(THD *thd);
|
|
void net_send_progress_packet(THD *thd);
|
|
uchar *net_store_data(uchar *to,const uchar *from, size_t length);
|
|
uchar *net_store_data(uchar *to,int32 from);
|
|
uchar *net_store_data(uchar *to,longlong from);
|
|
|