diff options
author | unknown <heikki@hundin.mysql.fi> | 2003-06-15 23:23:04 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2003-06-15 23:23:04 +0300 |
commit | 525060293cc23840980beb0e6661a6046eda3d51 (patch) | |
tree | f7dffb8ff704d546a088c9d99b91cae950de0cb6 /sql | |
parent | 0783f9001340ff848922d9ad60a9eef2c6b0dbac (diff) | |
download | mariadb-git-525060293cc23840980beb0e6661a6046eda3d51.tar.gz |
handler.h, ha_innodb.h, ha_innodb.cc:
Cleanup; remove compiler warning on Windows
sql/ha_innodb.cc:
Cleanup; remove compiler warning on Windows
sql/ha_innodb.h:
Cleanup; remove compiler warning on Windows
sql/handler.h:
Cleanup; remove compiler warning on Windows
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_innodb.cc | 26 | ||||
-rw-r--r-- | sql/ha_innodb.h | 3 | ||||
-rw-r--r-- | sql/handler.h | 3 |
3 files changed, 19 insertions, 13 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 28e61f44111..081b9a85c5c 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -43,7 +43,9 @@ InnoDB */ pthread_mutex_t innobase_mutex; /* 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; #define INSIDE_HA_INNOBASE_CC @@ -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 -to store a row reference to the 'ref' buffer of this table handle! */ +Stores a key value for a row to a buffer. */ uint 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 */ uint keynr, /* in: key number */ char* buff, /* in/out: buffer for the key value (in MySQL - format); currently this MUST be the 'ref' - buffer! */ + format) */ + uint buff_len,/* in: buffer length */ const mysql_byte* record)/* in: row in MySQL format */ { KEY* key_info = table->key_info + keynr; @@ -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 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 - use a simple memcmp to compare two key values to determine if they - are equal */ + /* We have to zero-fill the buffer so that MySQL is able to use a + simple memcmp to compare two key values to determine if they are + 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++) { is_null = FALSE; @@ -1808,7 +1809,7 @@ ha_innobase::store_key_val_for_row( storage of the number is little-endian */ ut_a(blob_len < 256); - *buff = blob_len; + *((byte*)buff) = (byte)blob_len; buff += 2; memcpy(buff, blob_data, blob_len); @@ -1826,6 +1827,8 @@ ha_innobase::store_key_val_for_row( } } + ut_a(buff <= buff_start + buff_len); + DBUG_RETURN((uint)(buff - buff_start)); } @@ -3122,7 +3125,8 @@ ha_innobase::position( memcpy(ref, prebuilt->row_id, len); } 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 diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h index bfa2687b87a..a3fe56f6bcd 100644 --- a/sql/ha_innodb.h +++ b/sql/ha_innodb.h @@ -76,7 +76,8 @@ class ha_innobase: public handler longlong auto_inc_counter_for_this_stat; 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 change_active_index(uint keynr); int general_fetch(byte* buf, uint direction, uint match_mode); diff --git a/sql/handler.h b/sql/handler.h index 41f6fdc656a..56f63d1d521 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -189,7 +189,8 @@ class handler :public Sql_alloc public: byte *ref; /* Pointer to current 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 */ ha_rows records; /* Records i datafilen */ ha_rows deleted; /* Deleted records */ |