18
18
#ifndef PLUGIN_MYISAM_MYISAM_PRIV_H
19
19
#define PLUGIN_MYISAM_MYISAM_PRIV_H
21
#include <drizzled/global.h>
22
22
#include "myisam.h" /* Structs & some defines */
23
23
#include "myisampack.h" /* packing of keys */
24
#include <mysys/my_tree.h>
25
#include <mysys/my_pthread.h>
26
#include <mysys/thr_lock.h>
24
#include "drizzled/my_tree.h"
25
#include "drizzled/internal/my_pthread.h"
26
#include <drizzled/thr_lock.h>
27
27
#include <drizzled/common.h>
29
31
#include <string.h>
203
205
ulong state_diff_length;
204
206
uint rec_reflength; /* rec_reflength in use now */
205
207
uint32_t unique_name_length;
206
File kfile; /* Shared keyfile */
207
File data_file; /* Shared data file */
208
int kfile; /* Shared keyfile */
209
int data_file; /* Shared data file */
208
210
int mode; /* mode of file on open */
209
211
uint reopen; /* How many times reopened */
210
212
uint w_locks,r_locks,tot_locks; /* Number of read/write locks */
310
312
typedef struct st_buffpek {
311
my_off_t file_pos; /* Where we are in the sort file */
313
off_t file_pos; /* Where we are in the sort file */
312
314
unsigned char *base,*key; /* Key pointers */
313
315
ha_rows count; /* Number of rows in table */
314
316
ulong mem_count; /* numbers of keys in memory */
340
342
unsigned char **sort_keys;
341
343
unsigned char *rec_buff;
342
344
void *wordlist, *wordptr;
345
drizzled::memory::Root wordroot;
344
346
unsigned char *record;
345
347
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *);
346
348
int (*key_read)(struct st_mi_sort_param *,void *);
668
670
#define fast_mi_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _mi_writeinfo((INFO),0)
669
671
#define fast_mi_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _mi_readinfo((INFO),F_RDLCK,1)
671
extern uint32_t _mi_get_block_info(MI_BLOCK_INFO *,File, my_off_t);
673
extern uint32_t _mi_get_block_info(MI_BLOCK_INFO *,int, my_off_t);
672
674
extern uint32_t _mi_rec_pack(MI_INFO *info,unsigned char *to,const unsigned char *from);
673
675
extern uint32_t _mi_pack_get_block_info(MI_INFO *myisam, MI_BIT_BUFF *bit_buff,
674
676
MI_BLOCK_INFO *info, unsigned char **rec_buff_p,
675
File file, my_off_t filepos);
677
int file, my_off_t filepos);
676
678
extern void _my_store_blob_length(unsigned char *pos,uint32_t pack_length,uint32_t length);
677
679
extern void mi_report_error(int errcode, const char *file_name);
678
680
extern size_t mi_mmap_pread(MI_INFO *info, unsigned char *Buffer,
684
686
extern size_t mi_nommap_pwrite(MI_INFO *info, const unsigned char *Buffer,
685
687
size_t Count, my_off_t offset, myf MyFlags);
687
uint32_t mi_state_info_write(File file, MI_STATE_INFO *state, uint32_t pWrite);
688
uint32_t mi_state_info_read_dsk(File file, MI_STATE_INFO *state, bool pRead);
689
uint32_t mi_base_info_write(File file, MI_BASE_INFO *base);
690
int mi_keyseg_write(File file, const HA_KEYSEG *keyseg);
691
uint32_t mi_keydef_write(File file, MI_KEYDEF *keydef);
692
uint32_t mi_uniquedef_write(File file, MI_UNIQUEDEF *keydef);
693
uint32_t mi_recinfo_write(File file, MI_COLUMNDEF *recinfo);
689
uint32_t mi_state_info_write(int file, MI_STATE_INFO *state, uint32_t pWrite);
690
uint32_t mi_state_info_read_dsk(int file, MI_STATE_INFO *state, bool pRead);
691
uint32_t mi_base_info_write(int file, MI_BASE_INFO *base);
692
int mi_keyseg_write(int file, const HA_KEYSEG *keyseg);
693
uint32_t mi_keydef_write(int file, MI_KEYDEF *keydef);
694
uint32_t mi_uniquedef_write(int file, MI_UNIQUEDEF *keydef);
695
uint32_t mi_recinfo_write(int file, MI_COLUMNDEF *recinfo);
694
696
extern int mi_disable_indexes(MI_INFO *info);
695
697
extern int mi_enable_indexes(MI_INFO *info);
696
698
extern int mi_indexes_are_disabled(MI_INFO *info);
715
717
extern MI_INFO *test_if_reopen(char *filename);
716
718
bool check_table_is_closed(const char *name, const char *where);
717
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup);
719
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, int file_to_dup);
718
720
int mi_open_keyfile(MYISAM_SHARE *share);
719
721
void mi_setup_functions(register MYISAM_SHARE *share);
720
722
bool mi_dynmap_file(MI_INFO *info, my_off_t size);
730
732
int flush_pending_blocks(MI_SORT_PARAM *param);
731
733
int thr_write_keys(MI_SORT_PARAM *sort_param);
732
734
pthread_handler_t thr_find_all_keys(void *arg);
733
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
735
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, int file);
735
737
int sort_write_record(MI_SORT_PARAM *sort_param);
736
738
int _create_index_by_sort(MI_SORT_PARAM *info,bool no_messages, size_t);
738
740
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func,
740
742
/* Just for myisam legacy */
741
extern size_t my_pwrite(File Filedes,const unsigned char *Buffer,size_t Count,
743
extern size_t my_pwrite(int Filedes,const unsigned char *Buffer,size_t Count,
742
744
my_off_t offset,myf MyFlags);
743
extern size_t my_pread(File Filedes,unsigned char *Buffer,size_t Count,my_off_t offset,
745
extern size_t my_pread(int Filedes,unsigned char *Buffer,size_t Count,my_off_t offset,
746
748
/* Needed for handler */