mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c
This commit is contained in:
101
sql/sql_base.cc
101
sql/sql_base.cc
@ -104,19 +104,19 @@ static bool
|
||||
has_two_write_locked_tables_with_auto_increment(TABLE_LIST *tables);
|
||||
|
||||
|
||||
extern "C" byte *table_cache_key(const byte *record,uint *length,
|
||||
extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
TABLE *entry=(TABLE*) record;
|
||||
*length= entry->s->table_cache_key.length;
|
||||
return (byte*) entry->s->table_cache_key.str;
|
||||
return (uchar*) entry->s->table_cache_key.str;
|
||||
}
|
||||
|
||||
|
||||
bool table_cache_init(void)
|
||||
{
|
||||
return hash_init(&open_cache, &my_charset_bin, table_cache_size+16,
|
||||
0, 0,table_cache_key,
|
||||
0, 0, table_cache_key,
|
||||
(hash_free_key) free_cache_entry, 0) != 0;
|
||||
}
|
||||
|
||||
@ -243,12 +243,12 @@ uint create_table_def_key(THD *thd, char *key, TABLE_LIST *table_list,
|
||||
Functions to handle table definition cach (TABLE_SHARE)
|
||||
*****************************************************************************/
|
||||
|
||||
extern "C" byte *table_def_key(const byte *record, uint *length,
|
||||
extern "C" uchar *table_def_key(const uchar *record, size_t *length,
|
||||
my_bool not_used __attribute__((unused)))
|
||||
{
|
||||
TABLE_SHARE *entry=(TABLE_SHARE*) record;
|
||||
*length= entry->table_cache_key.length;
|
||||
return (byte*) entry->table_cache_key.str;
|
||||
return (uchar*) entry->table_cache_key.str;
|
||||
}
|
||||
|
||||
|
||||
@ -334,7 +334,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
*error= 0;
|
||||
|
||||
/* Read table definition from cache */
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key,
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
goto found;
|
||||
|
||||
@ -351,7 +351,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
/* Check that another thread didn't insert the same table in between */
|
||||
if ((old_share= hash_search(&table_def_cache, (byte*) key, key_length)))
|
||||
if ((old_share= hash_search(&table_def_cache, (uchar*) key, key_length)))
|
||||
{
|
||||
(void) pthread_mutex_lock(&share->mutex);
|
||||
free_table_share(share);
|
||||
@ -381,7 +381,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
*/
|
||||
assign_new_table_id(share);
|
||||
|
||||
if (my_hash_insert(&table_def_cache, (byte*) share))
|
||||
if (my_hash_insert(&table_def_cache, (uchar*) share))
|
||||
{
|
||||
#ifdef WAITING_FOR_TABLE_DEF_CACHE_STAGE_3
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
@ -407,7 +407,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
(void) pthread_mutex_lock(&share->mutex);
|
||||
#endif
|
||||
*error= share->error;
|
||||
(void) hash_delete(&table_def_cache, (byte*) share);
|
||||
(void) hash_delete(&table_def_cache, (uchar*) share);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
share->ref_count++; // Mark in use
|
||||
@ -462,7 +462,7 @@ found:
|
||||
oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share));
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
}
|
||||
|
||||
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
|
||||
@ -585,7 +585,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
if (to_be_deleted)
|
||||
{
|
||||
DBUG_PRINT("info", ("Deleting share"));
|
||||
hash_delete(&table_def_cache, (byte*) share);
|
||||
hash_delete(&table_def_cache, (uchar*) share);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
@ -611,13 +611,13 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
This code is execured when someone does FLUSH TABLES while on has
|
||||
locked tables.
|
||||
*/
|
||||
(void) hash_search(&def_cache,(byte*) key,key_length);
|
||||
hash_replace(&def_cache, def_cache.current_record,(byte*) name_lock);
|
||||
(void) hash_search(&def_cache,(uchar*) key,key_length);
|
||||
hash_replace(&def_cache, def_cache.current_record,(uchar*) name_lock);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove table definition */
|
||||
hash_delete(&def_cache,(byte*) share);
|
||||
hash_delete(&def_cache,(uchar*) share);
|
||||
}
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
free_table_share(share);
|
||||
@ -662,7 +662,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
|
||||
table_list.db= (char*) db;
|
||||
table_list.table_name= (char*) table_name;
|
||||
key_length= create_table_def_key((THD*) 0, key, &table_list, 0);
|
||||
return (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key, key_length);
|
||||
return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length);
|
||||
}
|
||||
|
||||
|
||||
@ -840,7 +840,7 @@ static void free_cache_entry(TABLE *table)
|
||||
}
|
||||
check_unused(); // consisty check
|
||||
}
|
||||
my_free((gptr) table,MYF(0));
|
||||
my_free((uchar*) table,MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -852,7 +852,7 @@ void free_io_cache(TABLE *table)
|
||||
if (table->sort.io_cache)
|
||||
{
|
||||
close_cached_file(table->sort.io_cache);
|
||||
my_free((gptr) table->sort.io_cache,MYF(0));
|
||||
my_free((uchar*) table->sort.io_cache,MYF(0));
|
||||
table->sort.io_cache=0;
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
@ -881,17 +881,17 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
||||
while (unused_tables)
|
||||
{
|
||||
#ifdef EXTRA_DEBUG
|
||||
if (hash_delete(&open_cache,(byte*) unused_tables))
|
||||
if (hash_delete(&open_cache,(uchar*) unused_tables))
|
||||
printf("Warning: Couldn't delete open table from hash\n");
|
||||
#else
|
||||
VOID(hash_delete(&open_cache,(byte*) unused_tables));
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
#endif
|
||||
}
|
||||
/* Free table shares */
|
||||
while (oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (byte*) oldest_unused_share));
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1216,7 +1216,7 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
|
||||
|
||||
/* Free tables to hold down open files */
|
||||
while (open_cache.records > table_cache_size && unused_tables)
|
||||
VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
check_unused();
|
||||
if (found_old_table)
|
||||
{
|
||||
@ -1255,7 +1255,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
|
||||
if (table->s->version != refresh_version ||
|
||||
thd->version != refresh_version || !table->db_stat)
|
||||
{
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
found_old_table=1;
|
||||
}
|
||||
else
|
||||
@ -1799,7 +1799,7 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
|
||||
{
|
||||
if (thd->locked_tables)
|
||||
mysql_lock_remove(thd, thd->locked_tables,list);
|
||||
VOID(hash_delete(&open_cache,(byte*) list)); // Close table
|
||||
VOID(hash_delete(&open_cache,(uchar*) list)); // Close table
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1964,7 +1964,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
*refresh=0;
|
||||
|
||||
/* an open table operation needs a lot of the stack space */
|
||||
if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias))
|
||||
if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (uchar *)&alias))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (thd->killed)
|
||||
@ -2179,10 +2179,10 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
an implicit "pending locks queue" - see
|
||||
wait_for_locked_table_names for details.
|
||||
*/
|
||||
for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
|
||||
for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
table && table->in_use ;
|
||||
table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
|
||||
table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
{
|
||||
/*
|
||||
@ -2271,7 +2271,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
int error;
|
||||
/* Free cache if too big */
|
||||
while (open_cache.records > table_cache_size && unused_tables)
|
||||
VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
|
||||
/* make a new table */
|
||||
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
|
||||
@ -2284,7 +2284,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
mem_root, (flags & OPEN_VIEW_NO_PARSE));
|
||||
if (error > 0)
|
||||
{
|
||||
my_free((gptr)table, MYF(0));
|
||||
my_free((uchar*)table, MYF(0));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_RETURN(NULL);
|
||||
}
|
||||
@ -2297,12 +2297,12 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
if (error < 0)
|
||||
table_list->view= (st_lex*)1;
|
||||
|
||||
my_free((gptr)table, MYF(0));
|
||||
my_free((uchar*)table, MYF(0));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_RETURN(0); // VIEW
|
||||
}
|
||||
DBUG_PRINT("info", ("inserting table 0x%lx into the cache", (long) table));
|
||||
VOID(my_hash_insert(&open_cache,(byte*) table));
|
||||
VOID(my_hash_insert(&open_cache,(uchar*) table));
|
||||
}
|
||||
|
||||
check_unused(); // Debugging call
|
||||
@ -2525,7 +2525,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
|
||||
if (!tables || (!db_stat && reopen_table(table)))
|
||||
{
|
||||
my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias);
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
error=1;
|
||||
}
|
||||
else
|
||||
@ -2556,7 +2556,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
|
||||
}
|
||||
if (get_locks && tables)
|
||||
{
|
||||
my_afree((gptr) tables);
|
||||
my_afree((uchar*) tables);
|
||||
}
|
||||
broadcast_refresh();
|
||||
*prev=0;
|
||||
@ -2623,10 +2623,10 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
|
||||
|
||||
DBUG_PRINT("loop", ("table_name: %s", table->alias));
|
||||
HASH_SEARCH_STATE state;
|
||||
for (TABLE *search= (TABLE*) hash_first(&open_cache, (byte*) key,
|
||||
for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key,
|
||||
key_length, &state);
|
||||
search ;
|
||||
search= (TABLE*) hash_next(&open_cache, (byte*) key,
|
||||
search= (TABLE*) hash_next(&open_cache, (uchar*) key,
|
||||
key_length, &state))
|
||||
{
|
||||
DBUG_PRINT("info", ("share: 0x%lx locked_by_logger: %d "
|
||||
@ -2741,7 +2741,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
else
|
||||
{
|
||||
/* We already have a name lock, remove copy */
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2755,7 +2755,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
broadcast_refresh();
|
||||
if (thd->locked_tables && thd->locked_tables->table_count == 0)
|
||||
{
|
||||
my_free((gptr) thd->locked_tables,MYF(0));
|
||||
my_free((uchar*) thd->locked_tables,MYF(0));
|
||||
thd->locked_tables=0;
|
||||
}
|
||||
DBUG_RETURN(found);
|
||||
@ -4157,7 +4157,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
|
||||
field_ptr= table->field + cached_field_index;
|
||||
else if (table->s->name_hash.records)
|
||||
{
|
||||
field_ptr= (Field**) hash_search(&table->s->name_hash, (byte*) name,
|
||||
field_ptr= (Field**) hash_search(&table->s->name_hash, (uchar*) name,
|
||||
length);
|
||||
if (field_ptr)
|
||||
{
|
||||
@ -4365,7 +4365,7 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
|
||||
else
|
||||
{
|
||||
if (thd->mark_used_columns == MARK_COLUMNS_READ)
|
||||
it->walk(&Item::register_field_in_read_map, 1, (byte *) 0);
|
||||
it->walk(&Item::register_field_in_read_map, 1, (uchar *) 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4404,7 +4404,7 @@ Field *find_field_in_table_sef(TABLE *table, const char *name)
|
||||
Field **field_ptr;
|
||||
if (table->s->name_hash.records)
|
||||
{
|
||||
field_ptr= (Field**)hash_search(&table->s->name_hash,(byte*) name,
|
||||
field_ptr= (Field**)hash_search(&table->s->name_hash,(uchar*) name,
|
||||
strlen(name));
|
||||
if (field_ptr)
|
||||
{
|
||||
@ -6496,14 +6496,15 @@ my_bool mysql_rm_tmp_tables(void)
|
||||
(file->name[1] == '.' && !file->name[2])))
|
||||
continue;
|
||||
|
||||
if (!bcmp(file->name,tmp_file_prefix,tmp_file_prefix_length))
|
||||
if (!bcmp((uchar*) file->name, (uchar*) tmp_file_prefix,
|
||||
tmp_file_prefix_length))
|
||||
{
|
||||
char *ext= fn_ext(file->name);
|
||||
uint ext_len= strlen(ext);
|
||||
uint filePath_len= my_snprintf(filePath, sizeof(filePath),
|
||||
"%s%c%s", tmpdir, FN_LIBCHAR,
|
||||
file->name);
|
||||
if (!bcmp(reg_ext, ext, ext_len))
|
||||
if (!bcmp((uchar*) reg_ext, (uchar*) ext, ext_len))
|
||||
{
|
||||
handler *handler_file= 0;
|
||||
/* We should cut file extention before deleting of table */
|
||||
@ -6566,7 +6567,7 @@ void remove_db_from_cache(const char *db)
|
||||
}
|
||||
}
|
||||
while (unused_tables && !unused_tables->s->version)
|
||||
VOID(hash_delete(&open_cache,(byte*) unused_tables));
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
}
|
||||
|
||||
|
||||
@ -6582,7 +6583,7 @@ void flush_tables()
|
||||
{
|
||||
(void) pthread_mutex_lock(&LOCK_open);
|
||||
while (unused_tables)
|
||||
hash_delete(&open_cache,(byte*) unused_tables);
|
||||
hash_delete(&open_cache,(uchar*) unused_tables);
|
||||
(void) pthread_mutex_unlock(&LOCK_open);
|
||||
}
|
||||
|
||||
@ -6619,10 +6620,10 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
HASH_SEARCH_STATE state;
|
||||
result= signalled= 0;
|
||||
|
||||
for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
|
||||
for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
table;
|
||||
table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
|
||||
table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
{
|
||||
THD *in_use;
|
||||
@ -6677,11 +6678,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
}
|
||||
}
|
||||
while (unused_tables && !unused_tables->s->version)
|
||||
VOID(hash_delete(&open_cache,(byte*) unused_tables));
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
|
||||
DBUG_PRINT("info", ("Removing table from table_def_cache"));
|
||||
/* Remove table from table definition cache if it's not in use */
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(byte*) key,
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
{
|
||||
DBUG_PRINT("info", ("share version: %lu ref_count: %u",
|
||||
@ -6690,7 +6691,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
if (share->ref_count == 0)
|
||||
{
|
||||
pthread_mutex_lock(&share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (byte*) share));
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) share));
|
||||
}
|
||||
}
|
||||
|
||||
@ -6932,10 +6933,10 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table
|
||||
key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
HASH_SEARCH_STATE state;
|
||||
for (table= (TABLE*) hash_first(&open_cache,(byte*) key,key_length,
|
||||
for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length,
|
||||
&state) ;
|
||||
table;
|
||||
table= (TABLE*) hash_next(&open_cache,(byte*) key,key_length,
|
||||
table= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length,
|
||||
&state))
|
||||
{
|
||||
THD *in_use= table->in_use;
|
||||
|
Reference in New Issue
Block a user