handler.h, ha_innodb.h, ha_innodb.cc:

  Cleanup; remove compiler warning on Windows
parent d2ea62cd
...@@ -43,7 +43,9 @@ InnoDB */ ...@@ -43,7 +43,9 @@ InnoDB */
pthread_mutex_t innobase_mutex; pthread_mutex_t innobase_mutex;
/* Store MySQL definition of 'byte': in Linux it is char while InnoDB /* Store MySQL definition of 'byte': in Linux it is char while InnoDB
uses unsigned char */ uses unsigned char; the header univ.i which we include next defines
'byte' as a macro which expands to 'unsigned char' */
typedef byte mysql_byte; typedef byte mysql_byte;
#define INSIDE_HA_INNOBASE_CC #define INSIDE_HA_INNOBASE_CC
...@@ -1716,8 +1718,7 @@ get_innobase_type_from_mysql_type( ...@@ -1716,8 +1718,7 @@ get_innobase_type_from_mysql_type(
} }
/*********************************************************************** /***********************************************************************
Stores a key value for a row to a buffer. This must currently only be used Stores a key value for a row to a buffer. */
to store a row reference to the 'ref' buffer of this table handle! */
uint uint
ha_innobase::store_key_val_for_row( ha_innobase::store_key_val_for_row(
...@@ -1725,8 +1726,8 @@ ha_innobase::store_key_val_for_row( ...@@ -1725,8 +1726,8 @@ ha_innobase::store_key_val_for_row(
/* out: key value length as stored in buff */ /* out: key value length as stored in buff */
uint keynr, /* in: key number */ uint keynr, /* in: key number */
char* buff, /* in/out: buffer for the key value (in MySQL char* buff, /* in/out: buffer for the key value (in MySQL
format); currently this MUST be the 'ref' format) */
buffer! */ uint buff_len,/* in: buffer length */
const mysql_byte* record)/* in: row in MySQL format */ const mysql_byte* record)/* in: row in MySQL format */
{ {
KEY* key_info = table->key_info + keynr; KEY* key_info = table->key_info + keynr;
...@@ -1757,11 +1758,11 @@ ha_innobase::store_key_val_for_row( ...@@ -1757,11 +1758,11 @@ ha_innobase::store_key_val_for_row(
for data. For a VARCHAR(n) the max field length is n. If the stored for data. For a VARCHAR(n) the max field length is n. If the stored
value is the SQL NULL then these data bytes are set to 0. */ value is the SQL NULL then these data bytes are set to 0. */
/* We have to zero-fill the 'ref' buffer so that MySQL is able to /* We have to zero-fill the buffer so that MySQL is able to use a
use a simple memcmp to compare two key values to determine if they simple memcmp to compare two key values to determine if they are
are equal */ equal. MySQL does this to compare contents of two 'ref' values. */
bzero(buff, ref_length); bzero(buff, buff_len);
for (; key_part != end; key_part++) { for (; key_part != end; key_part++) {
is_null = FALSE; is_null = FALSE;
...@@ -1808,7 +1809,7 @@ ha_innobase::store_key_val_for_row( ...@@ -1808,7 +1809,7 @@ ha_innobase::store_key_val_for_row(
storage of the number is little-endian */ storage of the number is little-endian */
ut_a(blob_len < 256); ut_a(blob_len < 256);
*buff = blob_len; *((byte*)buff) = (byte)blob_len;
buff += 2; buff += 2;
memcpy(buff, blob_data, blob_len); memcpy(buff, blob_data, blob_len);
...@@ -1826,6 +1827,8 @@ ha_innobase::store_key_val_for_row( ...@@ -1826,6 +1827,8 @@ ha_innobase::store_key_val_for_row(
} }
} }
ut_a(buff <= buff_start + buff_len);
DBUG_RETURN((uint)(buff - buff_start)); DBUG_RETURN((uint)(buff - buff_start));
} }
...@@ -3122,7 +3125,8 @@ ha_innobase::position( ...@@ -3122,7 +3125,8 @@ ha_innobase::position(
memcpy(ref, prebuilt->row_id, len); memcpy(ref, prebuilt->row_id, len);
} else { } else {
len = store_key_val_for_row(primary_key, (char*) ref, record); len = store_key_val_for_row(primary_key, (char*)ref,
ref_length, record);
} }
/* Since we do not store len to the buffer 'ref', we must assume /* Since we do not store len to the buffer 'ref', we must assume
......
...@@ -76,7 +76,8 @@ class ha_innobase: public handler ...@@ -76,7 +76,8 @@ class ha_innobase: public handler
longlong auto_inc_counter_for_this_stat; longlong auto_inc_counter_for_this_stat;
ulong max_row_length(const byte *buf); ulong max_row_length(const byte *buf);
uint store_key_val_for_row(uint keynr, char* buff, const byte* record); uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const byte* record);
int update_thd(THD* thd); int update_thd(THD* thd);
int change_active_index(uint keynr); int change_active_index(uint keynr);
int general_fetch(byte* buf, uint direction, uint match_mode); int general_fetch(byte* buf, uint direction, uint match_mode);
......
...@@ -189,7 +189,8 @@ class handler :public Sql_alloc ...@@ -189,7 +189,8 @@ class handler :public Sql_alloc
public: public:
byte *ref; /* Pointer to current row */ byte *ref; /* Pointer to current row */
byte *dupp_ref; /* Pointer to dupp row */ byte *dupp_ref; /* Pointer to dupp row */
uint ref_length; /* Length of ref (1-8) */ uint ref_length; /* Length of ref (1-8 or the clustered
key length) */
uint block_size; /* index block size */ uint block_size; /* index block size */
ha_rows records; /* Records i datafilen */ ha_rows records; /* Records i datafilen */
ha_rows deleted; /* Deleted records */ ha_rows deleted; /* Deleted records */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment