Skip to content

Commit 68fd66e

Browse files
wl#3700 - post-review fixes:
s/ulonglong/key_part_map/, comments
1 parent 55a548c commit 68fd66e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+187
-183
lines changed

include/heap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ extern void heap_update_auto_increment(HP_INFO *info, const byte *record);
225225
ha_rows hp_rb_records_in_range(HP_INFO *info, int inx, key_range *min_key,
226226
key_range *max_key);
227227
int hp_panic(enum ha_panic_function flag);
228-
int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
229-
ulonglong keypart_map, enum ha_rkey_function find_flag);
228+
int heap_rkey(HP_INFO *info, byte *record, int inx, const byte *key,
229+
key_part_map keypart_map, enum ha_rkey_function find_flag);
230230
extern gptr heap_find(HP_INFO *info,int inx,const byte *key);
231231
extern int heap_check_heap(HP_INFO *info, my_bool print_status);
232232
extern byte *heap_position(HP_INFO *info);

include/my_base.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ enum ha_base_keytype {
395395
/* Other constants */
396396

397397
#define HA_NAMELEN 64 /* Max length of saved filename */
398-
#define NO_SUCH_KEY ((uint)~0) /* used as a key no. */
398+
#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */
399+
400+
typedef ulong key_part_map;
401+
#define HA_WHOLE_KEY (~(key_part_map)0)
399402

400403
/* Intern constants in databases */
401404

@@ -469,7 +472,7 @@ typedef struct st_key_range
469472
{
470473
const byte *key;
471474
uint length;
472-
ulonglong keypart_map;
475+
key_part_map keypart_map;
473476
enum ha_rkey_function flag;
474477
} key_range;
475478

include/myisam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ extern struct st_myisam_info *mi_open(const char *name,int mode,
275275
extern int mi_panic(enum ha_panic_function function);
276276
extern int mi_rfirst(struct st_myisam_info *file,byte *buf,int inx);
277277
extern int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key,
278-
ulonglong keypart_map, enum ha_rkey_function search_flag);
278+
key_part_map keypart_map, enum ha_rkey_function search_flag);
279279
extern int mi_rlast(struct st_myisam_info *file,byte *buf,int inx);
280280
extern int mi_rnext(struct st_myisam_info *file,byte *buf,int inx);
281281
extern int mi_rnext_same(struct st_myisam_info *info, byte *buf);

include/myisammrg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx);
8787
extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx);
8888
extern int myrg_rnext_same(MYRG_INFO *file,byte *buf);
8989
extern int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
90-
ulonglong keypart_map, enum ha_rkey_function search_flag);
90+
key_part_map keypart_map, enum ha_rkey_function search_flag);
9191
extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos);
9292
extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx);
9393
extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec);

sql/event_db_repository.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
288288
{
289289
key_copy(key_buf, event_table->record[0], key_info, key_len);
290290
if (!(ret= event_table->file->index_read(event_table->record[0], key_buf,
291-
(ulonglong)1, HA_READ_PREFIX)))
291+
(key_part_map)1, HA_READ_PREFIX)))
292292
{
293293
DBUG_PRINT("info",("Found rows. Let's retrieve them. ret=%d", ret));
294294
do
@@ -843,7 +843,7 @@ Event_db_repository::find_named_event(THD *thd, LEX_STRING db, LEX_STRING name,
843843

844844
key_copy(key, table->record[0], table->key_info, table->key_info->key_length);
845845

846-
if (table->file->index_read_idx(table->record[0], 0, key, ~ULL(0),
846+
if (table->file->index_read_idx(table->record[0], 0, key, HA_WHOLE_KEY,
847847
HA_READ_KEY_EXACT))
848848
{
849849
DBUG_PRINT("info", ("Row not found"));

sql/ha_partition.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,7 +3336,7 @@ int ha_partition::index_end()
33363336
*/
33373337

33383338
int ha_partition::index_read(byte * buf, const byte * key,
3339-
ulonglong keypart_map,
3339+
key_part_map keypart_map,
33403340
enum ha_rkey_function find_flag)
33413341
{
33423342
DBUG_ENTER("ha_partition::index_read");
@@ -3357,7 +3357,7 @@ int ha_partition::index_read(byte * buf, const byte * key,
33573357
*/
33583358

33593359
int ha_partition::common_index_read(byte *buf, const byte *key,
3360-
ulonglong keypart_map,
3360+
key_part_map keypart_map,
33613361
enum ha_rkey_function find_flag)
33623362
{
33633363
int error;
@@ -3513,7 +3513,7 @@ int ha_partition::common_first_last(byte *buf)
35133513
*/
35143514

35153515
int ha_partition::index_read_last(byte *buf, const byte *key,
3516-
ulonglong keypart_map)
3516+
key_part_map keypart_map)
35173517
{
35183518
DBUG_ENTER("ha_partition::index_read_last");
35193519

sql/ha_partition.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ class ha_partition :public handler
384384
any end processing needed.
385385
*/
386386
virtual int index_read(byte * buf, const byte * key,
387-
ulonglong keypart_map,
388-
enum ha_rkey_function find_flag);
387+
key_part_map keypart_map,
388+
enum ha_rkey_function find_flag);
389389
virtual int index_init(uint idx, bool sorted);
390390
virtual int index_end();
391391

@@ -399,7 +399,7 @@ class ha_partition :public handler
399399
virtual int index_last(byte * buf);
400400
virtual int index_next_same(byte * buf, const byte * key, uint keylen);
401401
virtual int index_read_last(byte * buf, const byte * key,
402-
ulonglong keypart_map);
402+
key_part_map keypart_map);
403403

404404
/*
405405
read_first_row is virtual method but is only implemented by
@@ -425,7 +425,8 @@ class ha_partition :public handler
425425

426426
private:
427427
int common_index_read(byte * buf, const byte * key,
428-
ulonglong keypart_map, enum ha_rkey_function find_flag);
428+
key_part_map keypart_map,
429+
enum ha_rkey_function find_flag);
429430
int common_first_last(byte * buf);
430431
int partition_scan_set_up(byte * buf, bool idx_read_flag);
431432
int handle_unordered_next(byte * buf, bool next_same);

sql/handler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,8 +3282,8 @@ int handler::compare_key(key_range *range)
32823282

32833283

32843284
int handler::index_read_idx(byte * buf, uint index, const byte * key,
3285-
ulonglong keypart_map,
3286-
enum ha_rkey_function find_flag)
3285+
key_part_map keypart_map,
3286+
enum ha_rkey_function find_flag)
32873287
{
32883288
int error, error1;
32893289
error= index_init(index, 0);

sql/handler.h

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,17 +867,17 @@ class ha_statistics
867867
{}
868868
};
869869

870-
uint calculate_key_len(TABLE *, uint, const byte *, ulonglong);
870+
uint calculate_key_len(TABLE *, uint, const byte *, key_part_map);
871871
/*
872872
bitmap with first N+1 bits set
873873
(keypart_map for a key prefix of [0..N] keyparts)
874874
*/
875-
#define make_keypart_map(N) (((ulonglong)2 << (N)) - 1)
875+
#define make_keypart_map(N) (((key_part_map)2 << (N)) - 1)
876876
/*
877877
bitmap with first N bits set
878878
(keypart_map for a key prefix of [0..N-1] keyparts)
879879
*/
880-
#define make_prev_keypart_map(N) (((ulonglong)1 << (N)) - 1)
880+
#define make_prev_keypart_map(N) (((key_part_map)1 << (N)) - 1)
881881

882882
/*
883883
The handler class is the interface for dynamically loadable
@@ -1219,14 +1219,26 @@ class handler :public Sql_alloc
12191219
enum ha_rkey_function find_flag)
12201220
{ return HA_ERR_WRONG_COMMAND; }
12211221
public:
1222-
virtual int index_read(byte * buf, const byte * key, ulonglong keypart_map,
1222+
/**
1223+
@brief
1224+
Positions an index cursor to the index specified in the handle. Fetches the
1225+
row if available. If the key value is null, begin at the first key of the
1226+
index.
1227+
*/
1228+
virtual int index_read(byte * buf, const byte * key, key_part_map keypart_map,
12231229
enum ha_rkey_function find_flag)
12241230
{
12251231
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
12261232
return index_read(buf, key, key_len, find_flag);
12271233
}
1234+
/**
1235+
@brief
1236+
Positions an index cursor to the index specified in the handle. Fetches the
1237+
row if available. If the key value is null, begin at the first key of the
1238+
index.
1239+
*/
12281240
virtual int index_read_idx(byte * buf, uint index, const byte * key,
1229-
ulonglong keypart_map,
1241+
key_part_map keypart_map,
12301242
enum ha_rkey_function find_flag);
12311243
virtual int index_next(byte * buf)
12321244
{ return HA_ERR_WRONG_COMMAND; }
@@ -1241,8 +1253,13 @@ class handler :public Sql_alloc
12411253
virtual int index_read_last(byte * buf, const byte * key, uint key_len)
12421254
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
12431255
public:
1256+
/**
1257+
@brief
1258+
The following functions works like index_read, but it find the last
1259+
row with the current key value or prefix.
1260+
*/
12441261
virtual int index_read_last(byte * buf, const byte * key,
1245-
ulonglong keypart_map)
1262+
key_part_map keypart_map)
12461263
{
12471264
uint key_len= calculate_key_len(table, active_index, key, keypart_map);
12481265
return index_read_last(buf, key, key_len);

sql/item_subselect.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,7 @@ int subselect_uniquesubquery_engine::exec()
20452045
table->file->ha_index_init(tab->ref.key, 0);
20462046
error= table->file->index_read(table->record[0],
20472047
tab->ref.key_buff,
2048-
tab_to_keypart_map(tab),
2048+
make_prev_keypart_map(tab->ref.key_parts),
20492049
HA_READ_KEY_EXACT);
20502050
if (error &&
20512051
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@@ -2155,7 +2155,7 @@ int subselect_indexsubquery_engine::exec()
21552155
table->file->ha_index_init(tab->ref.key, 1);
21562156
error= table->file->index_read(table->record[0],
21572157
tab->ref.key_buff,
2158-
tab_to_keypart_map(tab),
2158+
make_prev_keypart_map(tab->ref.key_parts),
21592159
HA_READ_KEY_EXACT);
21602160
if (error &&
21612161
error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)

0 commit comments

Comments
 (0)