diff options
author | unknown <monty@mashka.mysql.fi> | 2002-12-11 09:17:51 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-12-11 09:17:51 +0200 |
commit | f918dfc8b2e449fc55c6f8466bc1a923f47e5a44 (patch) | |
tree | 2f31768712119785f5bf2520a2d7e6dd4dfe37b5 /sql/sql_repl.cc | |
parent | b392b78400abf319550eedd636faa9eae66b9510 (diff) | |
download | mariadb-git-f918dfc8b2e449fc55c6f8466bc1a923f47e5a44.tar.gz |
rename of net_pkg.cc to protocol.cc
Class for sending data from server to client (Protocol)
This handles both the old ( <= 4.0 ) protocol and then new binary protocol that is used for prepared statements.
libmysql/libmysql.c:
Jump over reserved bits in the binary protocol
libmysqld/Makefile.am:
rename of net_pkg.cc to protocol.cc
mysql-test/r/case.result:
Fixed previously wrong test
mysql-test/r/cast.result:
Fixed previously wrong test
sql/Makefile.am:
Rename of net_pkg.cc to protocol.cc
sql/field.cc:
Binary protocol
Added key handling functions for new VARCHAR type
sql/field.h:
New protocol
sql/ha_berkeley.cc:
New protocol
sql/ha_berkeley.h:
New protocol
sql/ha_innodb.cc:
New protocol
sql/ha_myisam.cc:
New protocol
sql/item.cc:
New protocol
sql/item.h:
New protocol
sql/item_func.cc:
Removed old code from 3.23
sql/item_func.h:
Set cached_result_type as it was previosly used before set
sql/item_subselect.cc:
Standard make_field() is now good enough
sql/item_subselect.h:
Use default make_field()
sql/item_sum.cc:
Clean up Item_sum::make_field()
sql/item_sum.h:
Use standard make_field()
sql/item_timefunc.h:
return correct types for casts()
Use standard make_field()
sql/log_event.cc:
New protocol
sql/log_event.h:
New protocol
sql/mysql_priv.h:
Move things to protocol.h
sql/opt_range.cc:
Indentation cleanups + small optimization
sql/procedure.h:
Use MYSQL_TYPE instead of FIELD_TYPE
sql/protocol.cc:
Class for sending data from server to client.
This handles both the old ( <= 4.0 ) protocol and then new binary protocol that is used for prepared statements.
sql/repl_failsafe.cc:
New protocol
sql/slave.cc:
New protocol
sql/sql_acl.cc:
New protocol
sql/sql_base.cc:
Move send_fields() to protocol.cc
sql/sql_class.cc:
New protocol
sql/sql_class.h:
New protocol
sql/sql_db.cc:
New protocol
sql/sql_error.cc:
New protocol
sql/sql_handler.cc:
New protocol
sql/sql_help.cc:
New protocol
sql/sql_parse.cc:
Remove wrong assert (variable was not initalized at this point)
sql/sql_prepare.cc:
New protocol
sql/sql_repl.cc:
New protocol
sql/sql_select.cc:
New protocol
sql/sql_show.cc:
New protocol
sql/sql_string.h:
New functions used by the protocol functions
sql/sql_table.cc:
New protocol
sql/structs.h:
Make second_part ulong to prepare for ANSI sub-seconds
sql/time.cc:
New convert function needed by the new protocol functions
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 23951cec29f..63cd192e539 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -928,14 +928,15 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, int show_binlog_events(THD* thd) { + Protocol *protocol= thd->protocol; DBUG_ENTER("show_binlog_events"); List<Item> field_list; - const char* errmsg = 0; + const char *errmsg = 0; IO_CACHE log; File file = -1; Log_event::init_show_field_list(&field_list); - if (send_fields(thd, field_list, 1)) + if (protocol-> send_fields(&field_list, 1)) DBUG_RETURN(-1); if (mysql_bin_log.is_open()) @@ -983,7 +984,7 @@ int show_binlog_events(THD* thd) (ev = Log_event::read_log_event(&log,(pthread_mutex_t*)0,0)); ) { if (event_count >= limit_start && - ev->net_send(thd, linfo.log_file_name, pos)) + ev->net_send(protocol, linfo.log_file_name, pos)) { errmsg = "Net error"; delete ev; @@ -1029,28 +1030,30 @@ err: int show_binlog_info(THD* thd) { + Protocol *protocol= thd->protocol; DBUG_ENTER("show_binlog_info"); List<Item> field_list; field_list.push_back(new Item_empty_string("File", FN_REFLEN)); - field_list.push_back(new Item_empty_string("Position",20)); - field_list.push_back(new Item_empty_string("Binlog_do_db",20)); - field_list.push_back(new Item_empty_string("Binlog_ignore_db",20)); + field_list.push_back(new Item_return_int("Position",20, + MYSQL_TYPE_LONGLONG)); + field_list.push_back(new Item_empty_string("Binlog_do_db",255)); + field_list.push_back(new Item_empty_string("Binlog_ignore_db",255)); - if (send_fields(thd, field_list, 1)) + if (protocol->send_fields(&field_list, 1)) DBUG_RETURN(-1); - String* packet = &thd->packet; - packet->length(0); + protocol->prepare_for_resend(); + if (mysql_bin_log.is_open()) { LOG_INFO li; mysql_bin_log.get_current_log(&li); int dir_len = dirname_length(li.log_file_name); - net_store_data(packet, li.log_file_name + dir_len); - net_store_data(packet, (longlong)li.pos); - net_store_data(packet, &binlog_do_db); - net_store_data(packet, &binlog_ignore_db); - if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) + protocol->store(li.log_file_name + dir_len); + protocol->store((ulonglong) li.pos); + protocol->store(&binlog_do_db); + protocol->store(&binlog_ignore_db); + if (protocol->write()) DBUG_RETURN(-1); } send_eof(thd); @@ -1079,6 +1082,8 @@ int show_binlogs(THD* thd) List<Item> field_list; String *packet = &thd->packet; uint length; + Protocol *protocol= thd->protocol; + DBUG_ENTER("show_binlogs"); if (!mysql_bin_log.is_open()) { @@ -1088,8 +1093,8 @@ int show_binlogs(THD* thd) } field_list.push_back(new Item_empty_string("Log_name", 255)); - if (send_fields(thd, field_list, 1)) - return 1; + if (protocol->send_fields(&field_list, 1)) + DBUG_RETURN(1); mysql_bin_log.lock_index(); index_file=mysql_bin_log.get_index_file(); @@ -1101,19 +1106,19 @@ int show_binlogs(THD* thd) int dir_len = dirname_length(fname); packet->length(0); /* The -1 is for removing newline from fname */ - net_store_data(packet, fname + dir_len, length-1-dir_len); - if (my_net_write(net, (char*) packet->ptr(), packet->length())) + protocol->store(fname + dir_len, length-1-dir_len); + if (protocol->write()) goto err; } mysql_bin_log.unlock_index(); send_eof(thd); - return 0; + DBUG_RETURN(0); err_with_msg: send_error(thd, ER_UNKNOWN_ERROR, errmsg); err: mysql_bin_log.unlock_index(); - return 1; + DBUG_RETURN(1); } |