MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mf_iocache.cc
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
35 #include "sql_priv.h"
36 #include "sql_class.h" // THD
37 #ifdef HAVE_REPLICATION
38 
39 extern "C" {
40 
51 int _my_b_net_read(register IO_CACHE *info, uchar *Buffer,
52  size_t Count __attribute__((unused)))
53 {
54  ulong read_length;
55  NET *net= &(current_thd)->net;
56  DBUG_ENTER("_my_b_net_read");
57 
58  if (!info->end_of_file)
59  DBUG_RETURN(1); /* because my_b_get (no _) takes 1 byte at a time */
60  read_length=my_net_read(net);
61  if (read_length == packet_error)
62  {
63  info->error= -1;
64  DBUG_RETURN(1);
65  }
66  if (read_length == 0)
67  {
68  info->end_of_file= 0; /* End of file from client */
69  DBUG_RETURN(1);
70  }
71  /* to set up stuff for my_b_get (no _) */
72  info->read_end = (info->read_pos = (uchar*) net->read_pos) + read_length;
73  Buffer[0] = info->read_pos[0]; /* length is always 1 */
74 
75  /*
76  info->request_pos is used by log_loaded_block() to know the size
77  of the current block.
78  info->pos_in_file is used by log_loaded_block() too.
79  */
80  info->pos_in_file+= read_length;
81  info->request_pos=info->read_pos;
82 
83  info->read_pos++;
84 
85  DBUG_RETURN(0);
86 }
87 
88 } /* extern "C" */
89 #endif /* HAVE_REPLICATION */
90 
91