Skip to content

Commit 10df921

Browse files
author
serg@serg.mylan
committed
documenting HA_STATUS_xxx flags
1 parent e6708aa commit 10df921

3 files changed

Lines changed: 45 additions & 10 deletions

File tree

include/my_base.h

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,48 @@ enum ha_base_keytype {
260260
#define HA_CREATE_CHECKSUM 8
261261
#define HA_CREATE_DELAY_KEY_WRITE 64
262262

263-
/* Bits in flag to _status */
264-
265-
#define HA_STATUS_POS 1 /* Return position */
266-
#define HA_STATUS_NO_LOCK 2 /* Don't use external lock */
267-
#define HA_STATUS_TIME 4 /* Return update time */
268-
#define HA_STATUS_CONST 8 /* Return constants values */
269-
#define HA_STATUS_VARIABLE 16
270-
#define HA_STATUS_ERRKEY 32
271-
#define HA_STATUS_AUTO 64
263+
/*
264+
The following flags (OR-ed) are passed to handler::info() method.
265+
The method copies misc handler information out of the storage engine
266+
to data structures accessible from MySQL
267+
268+
Same flags are also passed down to mi_status, myrg_status, etc.
269+
*/
270+
271+
/* this one is not used */
272+
#define HA_STATUS_POS 1
273+
/*
274+
assuming the table keeps shared actual copy of the 'info' and
275+
local, possibly outdated copy, the following flag means that
276+
it should not try to get the actual data (locking the shared structure)
277+
slightly outdated version will suffice
278+
*/
279+
#define HA_STATUS_NO_LOCK 2
280+
/* update the time of the last modification (in handler::update_time) */
281+
#define HA_STATUS_TIME 4
282+
/*
283+
update the 'constant' part of the info:
284+
handler::max_data_file_length, max_index_file_length, create_time
285+
sortkey, ref_length, block_size, data_file_name, index_file_name.
286+
handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
287+
*/
288+
#define HA_STATUS_CONST 8
289+
/*
290+
update the 'variable' part of the info:
291+
handler::records, deleted, data_file_length, index_file_length,
292+
delete_length, check_time, mean_rec_length
293+
*/
294+
#define HA_STATUS_VARIABLE 16
295+
/*
296+
get the information about the key that caused last duplicate value error
297+
update handler::errkey and handler::dupp_ref
298+
see handler::get_dup_key()
299+
*/
300+
#define HA_STATUS_ERRKEY 32
301+
/*
302+
update handler::auto_increment_value
303+
*/
304+
#define HA_STATUS_AUTO 64
272305

273306
/* Errorcodes given by functions */
274307

sql/examples/ha_example.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ int ha_example::rnd_pos(byte * buf, byte *pos)
480480

481481
/*
482482
::info() is used to return information to the optimizer.
483+
see my_base.h for the complete description
484+
483485
Currently this table handler doesn't implement most of the fields
484486
really needed. SHOW also makes use of this data
485487
Another note, you will probably want to have the following in your

sql/handler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ class handler :public Sql_alloc
672672
key_range *max_key)
673673
{ return (ha_rows) 10; }
674674
virtual void position(const byte *record)=0;
675-
virtual void info(uint)=0;
675+
virtual void info(uint)=0; // see my_base.h for full description
676676
virtual int extra(enum ha_extra_function operation)
677677
{ return 0; }
678678
virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)

0 commit comments

Comments
 (0)