~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_cache.c

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/*
17
17
  Functions for read record cacheing with myisam
33
33
*/
34
34
 
35
35
 
36
 
#include "myisam_priv.h"
37
 
 
38
 
#include <algorithm>
39
 
 
40
 
using namespace std;
41
 
using namespace drizzled;
42
 
 
43
 
 
44
 
int _mi_read_cache(internal::IO_CACHE *info, unsigned char *buff, internal::my_off_t pos, uint32_t length,
 
36
#include "myisamdef.h"
 
37
 
 
38
int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
45
39
                   int flag)
46
40
{
47
 
  uint32_t read_length,in_buff_length;
48
 
  internal::my_off_t offset;
49
 
  unsigned char *in_buff_pos;
 
41
  uint read_length,in_buff_length;
 
42
  my_off_t offset;
 
43
  uchar *in_buff_pos;
50
44
 
51
45
  if (pos < info->pos_in_file)
52
46
  {
53
47
    read_length=length;
54
 
    if ((internal::my_off_t) read_length > (internal::my_off_t) (info->pos_in_file-pos))
 
48
    if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
55
49
      read_length=(uint) (info->pos_in_file-pos);
56
50
    info->seek_not_done=1;
57
51
    if (my_pread(info->file,buff,read_length,pos,MYF(MY_NABP)))
62
56
    buff+=read_length;
63
57
  }
64
58
  if (pos >= info->pos_in_file &&
65
 
      (offset= (internal::my_off_t) (pos - info->pos_in_file)) <
66
 
      (internal::my_off_t) (info->read_end - info->request_pos))
 
59
      (offset= (my_off_t) (pos - info->pos_in_file)) <
 
60
      (my_off_t) (info->read_end - info->request_pos))
67
61
  {
68
62
    in_buff_pos=info->request_pos+(uint) offset;
69
 
    in_buff_length= min(length, (uint32_t) (info->read_end-in_buff_pos));
 
63
    in_buff_length= min(length, (size_t) (info->read_end-in_buff_pos));
70
64
    memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
71
65
    if (!(length-=in_buff_length))
72
66
      return(0);
99
93
  if (!(flag & READING_HEADER) || (int) read_length == -1 ||
100
94
      read_length+in_buff_length < 3)
101
95
  {
102
 
    if (!errno || errno == -1)
103
 
      errno=HA_ERR_WRONG_IN_RECORD;
 
96
    if (!my_errno || my_errno == -1)
 
97
      my_errno=HA_ERR_WRONG_IN_RECORD;
104
98
    return(1);
105
99
  }
106
100
  memset(buff+read_length, 0,