209
209
if (my_hash_insert(&table_def_cache, (unsigned char*) share))
211
211
share->free_table_share();
212
return 0; // return error
212
return NULL; // return error
214
214
if (open_table_def(session, share))
216
216
*error= share->error;
217
217
(void) hash_delete(&table_def_cache, (unsigned char*) share);
220
220
share->ref_count++; // Mark in use
221
221
(void) pthread_mutex_unlock(&share->mutex);
235
235
share->open_table_error(share->error, share->open_errno, share->errarg);
236
236
(void) pthread_mutex_unlock(&share->mutex);
241
241
share->ref_count++;
242
242
(void) pthread_mutex_unlock(&share->mutex);
249
Get a table share. If it didn't exist, try creating it from engine
251
For arguments and return values, see get_table_from_share()
255
*get_table_share_with_create(Session *session, TableList *table_list,
256
char *key, uint32_t key_length,
257
uint32_t db_flags, int *error)
261
share= get_table_share(session, table_list, key, key_length, db_flags, error);
263
If share is not NULL, we found an existing share.
265
If share is NULL, and there is no error, we're inside
266
pre-locking, which silences 'ER_NO_SUCH_TABLE' errors
267
with the intention to silently drop non-existing tables
268
from the pre-locking list. In this case we still need to try
269
auto-discover before returning a NULL share.
271
If share is NULL and the error is ER_NO_SUCH_TABLE, this is
272
the same as above, only that the error was not silenced by
273
pre-locking. Once again, we need to try to auto-discover
276
Finally, if share is still NULL, it's a real error and we need
279
@todo Rework alternative ways to deal with ER_NO_SUCH Table.
281
if (share || (session->is_error() && (session->main_da.sql_errno() != ER_NO_SUCH_TABLE)))
2321
2280
safe_mutex_assert_owner(&LOCK_open);
2323
if (!(share= get_table_share_with_create(session, table_list, cache_key,
2282
if (!(share= get_table_share(session, table_list, cache_key,
2324
2283
cache_key_length,
2325
2284
table_list->i_s_requested_object,