170
Free table share and memory used by it
177
share->mutex must be locked when we come here if it's not a temp table
180
void free_table_share(TableShare *share)
183
assert(share->ref_count == 0);
186
If someone is waiting for this to be deleted, inform it about this.
187
Don't do a delete until we know that no one is refering to this anymore.
189
if (share->tmp_table == NO_TMP_TABLE)
191
/* share->mutex is locked in release_table_share() */
192
while (share->waiting_on_cond)
194
pthread_cond_broadcast(&share->cond);
195
pthread_cond_wait(&share->cond, &share->mutex);
197
/* No thread refers to this anymore */
198
pthread_mutex_unlock(&share->mutex);
199
pthread_mutex_destroy(&share->mutex);
200
pthread_cond_destroy(&share->cond);
202
hash_free(&share->name_hash);
204
share->storage_engine= NULL;
206
/* We must copy mem_root from share because share is allocated through it */
207
memcpy(&mem_root, &share->mem_root, sizeof(mem_root));
208
free_root(&mem_root, MYF(0)); // Free's share
212
169
enum_field_types proto_field_type_to_drizzle_type(uint32_t proto_field_type)
214
171
enum_field_types field_type;
3413
3369
table->keys_in_use_for_query.init();
3415
3371
table->setShare(share);
3416
share->init_tmp_table_share("", 0, tmpname, tmpname);
3372
share->init(tmpname, tmpname);
3417
3373
share->blob_field= blob_field;
3418
3374
share->blob_ptr_size= portable_sizeof_char_ptr;
3419
3375
share->db_low_byte_first=1; // True for HEAP and MyISAM