diff options
author | unknown <monty@donna.mysql.com> | 2000-11-16 03:58:58 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-11-16 03:58:58 +0200 |
commit | 3e6dac34cd5b8ef322d375f3af22137822656c8a (patch) | |
tree | 4b8f3df4d2aef33906b1e7e311b909e12f38539e /sql/sql_repl.cc | |
parent | c7d2c59ceb4e3548eb74e5d8fba16e0f41ffc7d9 (diff) | |
download | mariadb-git-3e6dac34cd5b8ef322d375f3af22137822656c8a.tar.gz |
changed to use IO_CACHE instead of FILE
Docs/manual.texi:
Type fixes
myisam/mi_create.c:
Fixed bug in update from different processes
myisam/mi_locking.c:
Fixed bug in update from different processes
myisam/mi_open.c:
Fixed bug in update from different processes
myisam/mi_search.c:
Fixed bug in update from different processes
myisam/myisamdef.h:
Fixed bug in update from different processes
mysys/Makefile.am:
Added mf_iocache2.c
sql/log.cc:
Changed to use IO_CACHE instead of FILE
sql/sql_class.h:
Changed to use IO_CACHE instead of FILE
sql/sql_repl.cc:
Changed to use IO_CACHE instead of FILE
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r-- | sql/sql_repl.cc | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 5cdb5ab0706..ba155c72e49 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -720,66 +720,66 @@ int show_binlog_info(THD* thd) int show_binlogs(THD* thd) { const char* errmsg = 0; - FILE* index_file; + File index_file; char fname[FN_REFLEN]; NET* net = &thd->net; List<Item> field_list; String* packet = &thd->packet; + IO_CACHE io_cache; + uint length; if(!mysql_bin_log.is_open()) - { - errmsg = "binlog is not open"; - goto err; - } + { + errmsg = "binlog is not open"; + goto err; + } field_list.push_back(new Item_empty_string("Log_name", 128)); if(send_fields(thd, field_list, 1)) - { - sql_print_error("Failed in send_fields"); - return 1; - } + { + sql_print_error("Failed in send_fields"); + return 1; + } mysql_bin_log.lock_index(); index_file = mysql_bin_log.get_index_file(); - if(!index_file) - { - errmsg = "Uninitialized index file pointer"; - mysql_bin_log.unlock_index(); - goto err; - } - if(my_fseek(index_file, 0, MY_SEEK_SET, MYF(MY_WME))) - { - errmsg = "Failed on fseek()"; - mysql_bin_log.unlock_index(); - goto err; - } - - while(fgets(fname, sizeof(fname), index_file)) + if (index_file < 0) + { + errmsg = "Uninitialized index file pointer"; + goto err2; + } + if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, 0, 0, + MYF(MY_WME))) + { + errmsg = "Failed on init_io_cache()"; + goto err2; + } + while ((length=my_b_gets(&io_cache, fname, sizeof(fname)))) + { + fname[--length]=0; + int dir_len = dirname_length(fname); + packet->length(0); + net_store_data(packet, fname + dir_len, length-dir_len); + if(my_net_write(net, (char*) packet->ptr(), packet->length())) { - char* fname_end; - *(fname_end = (strend(fname) - 1)) = 0; - int dir_len = dirname_length(fname); - packet->length(0); - net_store_data(packet, fname + dir_len, (fname_end - fname)-dir_len); - if(my_net_write(net, (char*) packet->ptr(), packet->length())) - { - sql_print_error("Failed in my_net_write"); - mysql_bin_log.unlock_index(); - return 1; - } + sql_print_error("Failed in my_net_write"); + end_io_cache(&io_cache); + mysql_bin_log.unlock_index(); + return 1; } + } mysql_bin_log.unlock_index(); + end_io_cache(&io_cache); send_eof(net); - err: - if(errmsg) - { - send_error(net, 0, errmsg); - return 1; - } - - send_ok(net); return 0; + +err2: + mysql_bin_log.unlock_index(); + end_io_cache(&io_cache); +err: + send_error(net, 0, errmsg); + return 1; } |