127
127
uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
130
typedef struct st_heap_columndef /* column information */
132
int16_t type; /* en_fieldtype */
133
uint32_t length; /* length of field */
134
uint32_t offset; /* Offset to position in row */
135
uint8_t null_bit; /* If column may be 0 */
136
uint16_t null_pos; /* position for null marker */
137
uint8_t length_bytes; /* length of the size, 1 o 2 bytes */
140
typedef struct st_heap_dataspace /* control data for data space */
143
uint chunk_count; /* Total chunks ever allocated in this dataspace */
144
uint del_chunk_count; /* Deleted chunks count */
145
uchar *del_link; /* Link to last deleted chunk */
146
uint chunk_length; /* Total length of one chunk */
147
uint chunk_dataspace_length; /* Length of payload that will be placed into one chunk */
148
uint offset_status; /* Offset of the status flag relative to the chunk start */
149
uint offset_link; /* Offset of the linking pointer relative to the chunk start */
150
uint is_variable_size; /* Test whether records have variable size and so "next" pointer */
151
uint64_t total_data_length; /* Total size allocated within this data space */
130
155
typedef struct st_heap_share
133
157
HP_KEYDEF *keydef;
158
HP_COLUMNDEF *column_defs;
159
HP_DATASPACE recordspace; /* Describes "block", which contains actual records */
134
161
ulong min_records,max_records; /* Params to open */
135
uint64_t data_length,index_length,max_table_size;
162
uint64_t index_length,max_table_size;
136
163
uint key_stat_version; /* version to indicate insert/delete */
137
uint records; /* records */
138
uint blength; /* records rounded up to 2^n */
139
uint deleted; /* Deleted records in database */
140
uint reclength; /* Length of one record */
164
uint records; /* Actual record (row) count */
165
uint blength; /* used_chunk_count rounded up to 2^n */
166
uint fixed_data_length; /* Length of record's fixed part, which contains keys and always fits into the first chunk */
167
uint fixed_column_count; /* Number of columns stored in fixed_data_length */
142
169
uint keys,max_key_length;
143
171
uint currently_disabled_keys; /* saved value from "keys" when disabled */
145
uchar *del_link; /* Link to next block with del. rec */
146
175
char * name; /* Name of "memory-file" */
148
177
pthread_mutex_t intern_lock; /* Locking for use with _locking */
192
223
extern HP_INFO *heap_open_from_share(HP_SHARE *share, int mode);
193
224
extern HP_INFO *heap_open_from_share_and_register(HP_SHARE *share, int mode);
194
225
extern int heap_close(HP_INFO *info);
195
extern int heap_write(HP_INFO *info,const uchar *buff);
196
extern int heap_update(HP_INFO *info,const uchar *old,const uchar *newdata);
226
extern int heap_write(HP_INFO *info,const uchar *record);
227
extern int heap_update(HP_INFO *info,const uchar *old_record,const uchar *new_record);
197
228
extern int heap_rrnd(HP_INFO *info,uchar *buf,uchar *pos);
198
229
extern int heap_scan_init(HP_INFO *info);
199
230
extern int heap_scan(register HP_INFO *info, uchar *record);
200
231
extern int heap_delete(HP_INFO *info,const uchar *buff);
201
232
extern int heap_info(HP_INFO *info,HEAPINFO *x,int flag);
202
233
extern int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
203
uint reclength, ulong max_records, ulong min_records,
204
HP_CREATE_INFO *create_info, HP_SHARE **share);
234
uint columns, HP_COLUMNDEF *columndef,
235
uint max_key_fieldnr, uint key_part_size,
236
uint reclength, uint keys_memory_size,
237
ulong max_records, ulong min_records,
238
HP_CREATE_INFO *create_info, HP_SHARE **share);
205
240
extern int heap_delete_table(const char *name);
206
241
extern void heap_drop_table(HP_INFO *info);
207
242
extern int heap_extra(HP_INFO *info,enum ha_extra_function function);