diff options
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index d96e4295a83..244890f200d 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -147,10 +147,10 @@ static TABLE *open_proc_table_for_update(THD *thd) static int db_find_routine_aux(THD *thd, int type, sp_name *name, TABLE *table) { - byte key[MAX_KEY_LENGTH]; // db, name, optional key length type + uchar key[MAX_KEY_LENGTH]; // db, name, optional key length type DBUG_ENTER("db_find_routine_aux"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* Create key to find row. We have to use field->store() to be able to @@ -215,7 +215,7 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) Open_tables_state open_tables_state_backup; DBUG_ENTER("db_find_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + type, (int) name->m_name.length, name->m_name.str)); *sphp= 0; // In case of errors if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup))) @@ -444,7 +444,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) TABLE *table; char definer[USER_HOST_BUFF_SIZE]; DBUG_ENTER("db_create_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s",type,sp->m_name.length, + DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length, sp->m_name.str)); /* @@ -587,8 +587,8 @@ db_drop_routine(THD *thd, int type, sp_name *name) TABLE *table; int ret; DBUG_ENTER("db_drop_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* This statement will be replicated as a statement, even when using @@ -626,8 +626,8 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) TABLE *table; int ret; DBUG_ENTER("db_update_routine"); - DBUG_PRINT("enter", ("type: %d name: %.*s", - type, name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("type: %d name: %.*s", + type, (int) name->m_name.length, name->m_name.str)); /* This statement will be replicated as a statement, even when using @@ -875,7 +875,7 @@ sp_drop_db_routines(THD *thd, char *db) ret= SP_OK; table->file->ha_index_init(0, 1); if (! table->file->index_read(table->record[0], - (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr, + (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr, (key_part_map)1, HA_READ_KEY_EXACT)) { int nxtres; @@ -892,7 +892,7 @@ sp_drop_db_routines(THD *thd, char *db) break; } } while (! (nxtres= table->file->index_next_same(table->record[0], - (byte *)table->field[MYSQL_PROC_FIELD_DB]->ptr, + (uchar *)table->field[MYSQL_PROC_FIELD_DB]->ptr, key_len))); if (nxtres != HA_ERR_END_OF_FILE) ret= SP_KEY_NOT_FOUND; @@ -939,9 +939,9 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, thd->variables.max_sp_recursion_depth : 0); DBUG_ENTER("sp_find_routine"); - DBUG_PRINT("enter", ("name: %.*s.%.*s, type: %d, cache only %d", - name->m_db.length, name->m_db.str, - name->m_name.length, name->m_name.str, + DBUG_PRINT("enter", ("name: %.*s.%.*s type: %d cache only %d", + (int) name->m_db.length, name->m_db.str, + (int) name->m_name.length, name->m_name.str, type, cache_only)); if ((sp= sp_cache_lookup(cp, name))) @@ -1109,7 +1109,7 @@ sp_create_procedure(THD *thd, sp_head *sp) { int ret; DBUG_ENTER("sp_create_procedure"); - DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", (int) sp->m_name.length, sp->m_name.str)); ret= db_create_routine(thd, TYPE_ENUM_PROCEDURE, sp); DBUG_RETURN(ret); @@ -1121,7 +1121,8 @@ sp_drop_procedure(THD *thd, sp_name *name) { int ret; DBUG_ENTER("sp_drop_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_drop_routine(thd, TYPE_ENUM_PROCEDURE, name); if (!ret) @@ -1135,7 +1136,8 @@ sp_update_procedure(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; DBUG_ENTER("sp_update_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_update_routine(thd, TYPE_ENUM_PROCEDURE, name, chistics); if (!ret) @@ -1150,7 +1152,8 @@ sp_show_create_procedure(THD *thd, sp_name *name) int ret= SP_KEY_NOT_FOUND; sp_head *sp; DBUG_ENTER("sp_show_create_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); /* Increase the recursion limit for this statement. SHOW CREATE PROCEDURE @@ -1186,7 +1189,8 @@ sp_create_function(THD *thd, sp_head *sp) { int ret; DBUG_ENTER("sp_create_function"); - DBUG_PRINT("enter", ("name: %.*s", sp->m_name.length, sp->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) sp->m_name.length, sp->m_name.str)); ret= db_create_routine(thd, TYPE_ENUM_FUNCTION, sp); DBUG_RETURN(ret); @@ -1198,7 +1202,8 @@ sp_drop_function(THD *thd, sp_name *name) { int ret; DBUG_ENTER("sp_drop_function"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_drop_routine(thd, TYPE_ENUM_FUNCTION, name); if (!ret) @@ -1212,7 +1217,8 @@ sp_update_function(THD *thd, sp_name *name, st_sp_chistics *chistics) { int ret; DBUG_ENTER("sp_update_procedure"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); ret= db_update_routine(thd, TYPE_ENUM_FUNCTION, name, chistics); if (!ret) @@ -1226,7 +1232,8 @@ sp_show_create_function(THD *thd, sp_name *name) { sp_head *sp; DBUG_ENTER("sp_show_create_function"); - DBUG_PRINT("enter", ("name: %.*s", name->m_name.length, name->m_name.str)); + DBUG_PRINT("enter", ("name: %.*s", + (int) name->m_name.length, name->m_name.str)); if ((sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, name, &thd->sp_func_cache, FALSE))) @@ -1273,11 +1280,12 @@ struct Sroutine_hash_entry }; -extern "C" byte* sp_sroutine_key(const byte *ptr, uint *plen, my_bool first) +extern "C" uchar* sp_sroutine_key(const uchar *ptr, size_t *plen, + my_bool first) { Sroutine_hash_entry *rn= (Sroutine_hash_entry *)ptr; *plen= rn->key.length; - return (byte *)rn->key.str; + return (uchar *)rn->key.str; } @@ -1358,7 +1366,7 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, Query_tables_list::START_SROUTINES_HASH_SIZE, 0, 0, sp_sroutine_key, 0, 0); - if (!hash_search(&lex->sroutines, (byte *)key->str, key->length)) + if (!hash_search(&lex->sroutines, (uchar *)key->str, key->length)) { Sroutine_hash_entry *rn= (Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) + @@ -1368,8 +1376,8 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, rn->key.length= key->length; rn->key.str= (char *)rn + sizeof(Sroutine_hash_entry); memcpy(rn->key.str, key->str, key->length); - my_hash_insert(&lex->sroutines, (byte *)rn); - lex->sroutines_list.link_in_list((byte *)rn, (byte **)&rn->next); + my_hash_insert(&lex->sroutines, (uchar *)rn); + lex->sroutines_list.link_in_list((uchar *)rn, (uchar **)&rn->next); rn->belong_to_view= belong_to_view; return TRUE; } @@ -1427,7 +1435,7 @@ void sp_remove_not_own_routines(LEX *lex) but we want to be more future-proof. */ next_rt= not_own_rt->next; - hash_delete(&lex->sroutines, (byte *)not_own_rt); + hash_delete(&lex->sroutines, (uchar *)not_own_rt); } *(Sroutine_hash_entry **)lex->sroutines_list_own_last= NULL; @@ -1459,8 +1467,8 @@ void sp_update_sp_used_routines(HASH *dst, HASH *src) for (uint i=0 ; i < src->records ; i++) { Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i); - if (!hash_search(dst, (byte *)rt->key.str, rt->key.length)) - my_hash_insert(dst, (byte *)rt); + if (!hash_search(dst, (uchar *)rt->key.str, rt->key.length)) + my_hash_insert(dst, (uchar *)rt); } } |