~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/my_handler.cc

Further drizzleclient cleanup. Starting to move all NET related functions into Protocol, removed some dead code, removing drizzleclient dependencies spread throughout drizzled.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2002-2006 MySQL AB
2
 
   
3
 
   This library is free software; you can redistribute it and/or
4
 
   modify it under the terms of the GNU Library General Public
5
 
   License as published by the Free Software Foundation; version 2
6
 
   of the License.
7
 
   
8
 
   This library is distributed in the hope that it will be useful,
9
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
   Library General Public License for more details.
12
 
 
13
 
   You should have received a copy of the GNU Library General Public
14
 
   License along with this library; if not, write to the Free
15
 
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16
 
   MA 02111-1307, USA */
17
 
 
18
 
#include "mysys_priv.h"
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
20
#include <drizzled/global.h>
19
21
 
20
22
#include <mystrings/m_ctype.h>
21
23
#include <drizzled/base.h>
22
 
#include <my_handler.h>
23
 
#include <my_sys.h>
24
 
 
25
 
#include "my_handler_errors.h"
 
24
#include <storage/myisam/my_handler.h>
 
25
#include <mysys/my_sys.h>
26
26
 
27
27
/**
28
28
  Swap the contents of two variables.
105
105
    next_flag   How keys should be compared
106
106
                If bit SEARCH_FIND is not set the keys includes the row
107
107
                position and this should also be compared
108
 
    diff_pos    OUT Number of first keypart where values differ, counting 
 
108
    diff_pos    OUT Number of first keypart where values differ, counting
109
109
                from one.
110
110
    diff_pos[1] OUT  (b + diff_pos[1]) points to first value in tuple b
111
111
                      that is different from corresponding value in tuple a.
112
 
  
113
 
  EXAMPLES 
 
112
 
 
113
  EXAMPLES
114
114
   Example1: if the function is called for tuples
115
115
     ('aaa','bbb') and ('eee','fff'), then
116
116
     diff_pos[0] = 1 (as 'aaa' != 'eee')
268
268
        b+= b_length;
269
269
        break;
270
270
      }
271
 
      break;
272
271
    case HA_KEYTYPE_VARBINARY1:
273
272
    case HA_KEYTYPE_VARBINARY2:
274
273
      {
286
285
        b+=b_length;
287
286
        break;
288
287
      }
289
 
      break;
290
288
    case HA_KEYTYPE_INT8:
291
289
    {
292
290
      int i_1= (int) *((signed char*) a);
579
577
 
580
578
 
581
579
 
582
 
/*
583
 
  Register handler error messages for usage with my_error()
584
 
 
585
 
  NOTES
586
 
    This is safe to call multiple times as my_error_register()
587
 
    will ignore calls to register already registered error numbers.
588
 
*/
589
 
 
590
 
 
591
 
void my_handler_error_register(void)
592
 
{
593
 
  /*
594
 
    If you got compilation error here about compile_time_assert array, check
595
 
    that every HA_ERR_xxx constant has a corresponding error message in
596
 
    handler_error_messages[] list (check mysys/ma_handler_errors.h and
597
 
    include/my_base.h).
598
 
 
599
 
    TODO: Remove fix the handler_error_messages so that this hack isn't 
600
 
          necessary.
601
 
  */
602
 
#ifdef __GNUC__
603
 
  char compile_time_assert[(HA_ERR_FIRST +
604
 
                            array_elements(handler_error_messages) ==
605
 
                            HA_ERR_LAST + 1) ? 1 : -1]
606
 
      __attribute__ ((__unused__));
607
 
#endif
608
 
  my_error_register(handler_error_messages, HA_ERR_FIRST,
609
 
                    HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
610
 
}
611
 
 
612
 
 
613
 
void my_handler_error_unregister(void)
614
 
{
615
 
  my_error_unregister(HA_ERR_FIRST,
616
 
                      HA_ERR_FIRST+ array_elements(handler_error_messages)-1);
617
 
}