mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	- Added a handler call (prepare_index_scan()) to inform storage engines that an index scan is about to take place. - Extended the maximun key parts for an index from 16 to 32 - Extended MyISAM and Maria engines to support up to 32 parts Added checks for return value from ha_index_init() include/my_handler.h: Extended number of key parts for MyISAM and Maria from 16 to 32 include/my_pthread.h: Ensure we always have 256M of stack. (Required to be able to handle the current number of keys and key parts in MyISAM) mysql-test/r/create.result: Extended to test for 32 key parts mysql-test/r/myisam.result: Test that we can create 32 but not 33 key parts mysql-test/r/ps_1general.result: Length of ref is now 2048 as we can have more key parts mysql-test/r/ps_2myisam.result: Length of ref is now 2048 as we can have more key parts mysql-test/r/ps_3innodb.result: Length of ref is now 2048 as we can have more key parts mysql-test/r/ps_4heap.result: Length of ref is now 2048 as we can have more key parts mysql-test/r/ps_5merge.result: Length of ref is now 2048 as we can have more key parts mysql-test/suite/maria/r/maria.result: Max key length is now 1208 bytes mysql-test/suite/maria/r/maria3.result: Max key length is now 1208 bytes mysql-test/suite/maria/r/ps_maria.result: Max key length is now 1208 byte mysql-test/t/create.test: Extended to test for 32 key parts mysql-test/t/myisam.test: Test that we can create 32 but not 33 key parts sql/handler.cc: Check return value from ha_index_init() sql/handler.h: Added a handler call (prepare_index_scan()) to inform storage engines that an index scan is about to take place. sql/sql_select.cc: Checks all return values from ha_index_init() Call prepare_index_scan()) to inform storage engines that an index scan is about to take place. Fixed indentation sql/table.cc: Fixed wrong types for key_length (rest of code assumed this was 32 bit) sql/unireg.h: Extended the maximun key parts for an index from 16 to 32 storage/maria/ha_maria.cc: Don't allocate HA_CHECK on the stack in functions where we call repair() as HA_CHECK is HUGE and will overflow stack storage/myisam/ha_myisam.cc: Don't allocate HA_CHECK on the stack in functions where we call repair() as HA_CHECK is HUGE and will overflow stack storage/myisam/mi_check.c: Fixed wrong check if value overflow tests/mysql_client_test.c: Added fflush() to fix output in case of error Fixed wrong check of 'ref' length in EXPLAIN
		
			
				
	
	
		
			131 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			131 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* Copyright (C) 2002-2006 MySQL AB
 | 
						|
 | 
						|
   This library is free software; you can redistribute it and/or
 | 
						|
   modify it under the terms of the GNU Library General Public
 | 
						|
   License as published by the Free Software Foundation; version 2
 | 
						|
   of the License.
 | 
						|
 | 
						|
   This library is distributed in the hope that it will be useful,
 | 
						|
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
						|
   Library General Public License for more details.
 | 
						|
 | 
						|
   You should have received a copy of the GNU Library General Public
 | 
						|
   License along with this library; if not, write to the Free
 | 
						|
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 | 
						|
   MA 02111-1307, USA */
 | 
						|
 | 
						|
#ifndef _my_handler_h
 | 
						|
#define _my_handler_h
 | 
						|
 | 
						|
#include "myisampack.h"
 | 
						|
 | 
						|
#ifdef	__cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/*
 | 
						|
  There is a hard limit for the maximum number of keys as there are only
 | 
						|
  8 bits in the index file header for the number of keys in a table.
 | 
						|
  This means that 0..255 keys can exist for a table. The idea of
 | 
						|
  HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
 | 
						|
  a MyISAM table for which one has more keys than MyISAM is normally
 | 
						|
  compiled for. If you don't have this, you will get a core dump when
 | 
						|
  running myisamchk compiled for 128 keys on a table with 255 keys.
 | 
						|
*/
 | 
						|
 | 
						|
#define HA_MAX_POSSIBLE_KEY         255         /* For myisamchk */
 | 
						|
/*
 | 
						|
  The following defines can be increased if necessary.
 | 
						|
  But beware the dependency of HA_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
 | 
						|
*/
 | 
						|
 | 
						|
#define HA_MAX_KEY_LENGTH           1000        /* Max length in bytes */
 | 
						|
#define HA_MAX_KEY_SEG              32          /* Max segments for key */
 | 
						|
 | 
						|
#define HA_MAX_POSSIBLE_KEY_BUFF    (HA_MAX_KEY_LENGTH + 24+ 6+6) 
 | 
						|
#define HA_MAX_KEY_BUFF  (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
 | 
						|
#define HA_MAX_MSG_BUF      1024 /* used in CHECK TABLE, REPAIR TABLE */
 | 
						|
 | 
						|
typedef struct st_HA_KEYSEG		/* Key-portion */
 | 
						|
{
 | 
						|
  CHARSET_INFO *charset;
 | 
						|
  uint32 start;				/* Start of key in record */
 | 
						|
  uint32 null_pos;			/* position to NULL indicator */
 | 
						|
  uint16 bit_pos;                       /* Position to bit part */
 | 
						|
  uint16 flag;
 | 
						|
  uint16 length;			/* Keylength */
 | 
						|
  uint8  type;				/* Type of key (for sort) */
 | 
						|
  uint8  language;
 | 
						|
  uint8  null_bit;			/* bitmask to test for NULL */
 | 
						|
  uint8  bit_start,bit_end;		/* if bit field */
 | 
						|
  uint8  bit_length;                    /* Length of bit part */
 | 
						|
} HA_KEYSEG;
 | 
						|
 | 
						|
#define get_key_length(length,key) \
 | 
						|
{ if (*(const uchar*) (key) != 255) \
 | 
						|
    length= (uint) *(const uchar*) ((key)++); \
 | 
						|
  else \
 | 
						|
  { length= mi_uint2korr((key)+1); (key)+=3; } \
 | 
						|
}
 | 
						|
 | 
						|
#define get_key_length_rdonly(length,key) \
 | 
						|
{ if (*(const uchar*) (key) != 255) \
 | 
						|
    length= ((uint) *(const uchar*) ((key))); \
 | 
						|
  else \
 | 
						|
  { length= mi_uint2korr((key)+1); } \
 | 
						|
}
 | 
						|
 | 
						|
#define get_key_pack_length(length,length_pack,key) \
 | 
						|
{ if (*(const uchar*) (key) != 255) \
 | 
						|
  { length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
 | 
						|
  else \
 | 
						|
  { length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
 | 
						|
}
 | 
						|
 | 
						|
#define store_key_length_inc(key,length) \
 | 
						|
{ if ((length) < 255) \
 | 
						|
  { *(key)++= (length); } \
 | 
						|
  else \
 | 
						|
  { *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
 | 
						|
}
 | 
						|
 | 
						|
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
 | 
						|
 | 
						|
#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \
 | 
						|
  (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \
 | 
						|
   ((1 << (bit_len)) - 1))
 | 
						|
 | 
						|
#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \
 | 
						|
{ \
 | 
						|
  (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \
 | 
						|
                ((bits) << (bit_ofs)); \
 | 
						|
  if ((bit_ofs) + (bit_len) > 8) \
 | 
						|
    (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \
 | 
						|
                  ((bits) >> (8 - (bit_ofs))); \
 | 
						|
}
 | 
						|
 | 
						|
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
 | 
						|
  set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
 | 
						|
 | 
						|
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
 | 
						|
                           const uchar *, uint , my_bool, my_bool);
 | 
						|
extern int ha_key_cmp(register HA_KEYSEG *keyseg, register const uchar *a,
 | 
						|
		      register const uchar *b, uint key_length,
 | 
						|
                      uint32 nextflag, uint *diff_pos);
 | 
						|
 | 
						|
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
 | 
						|
extern void my_handler_error_register(void);
 | 
						|
extern void my_handler_error_unregister(void);
 | 
						|
/*
 | 
						|
  Inside an in-memory data record, memory pointers to pieces of the
 | 
						|
  record (like BLOBs) are stored in their native byte order and in
 | 
						|
  this amount of bytes.
 | 
						|
*/
 | 
						|
#define portable_sizeof_char_ptr 8
 | 
						|
#ifdef	__cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /* _my_handler_h */
 |