diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/sql/table.cc b/sql/table.cc index 43b39ffb37e..8ac0f409e2f 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -88,6 +88,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, DBUG_PRINT("enter",("name: '%s' form: %lx",name,outparam)); error=1; + disk_buff=NULL; + old_root= my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); if ((file=my_open(fn_format(index_file, name, "", reg_ext, MY_UNPACK_FILENAME), @@ -118,11 +120,8 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, bzero((char*) outparam,sizeof(*outparam)); outparam->blob_ptr_size=sizeof(char*); - disk_buff=NULL; record= NULL; keynames=NullS; outparam->db_stat = db_stat; - init_sql_alloc(&outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); - old_root= my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); my_pthread_setspecific_ptr(THR_MALLOC,&outparam->mem_root); outparam->real_name=strdup_root(&outparam->mem_root, @@ -742,11 +741,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, DBUG_RETURN (0); err_w_init: - //awoid problem with uninitialized data + /* Avoid problem with uninitialized data */ bzero((char*) outparam,sizeof(*outparam)); outparam->real_name= (char*)name+dirname_length(name); - old_root= my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); - disk_buff= 0; err_not_open: x_free((gptr) disk_buff); @@ -1447,13 +1444,14 @@ db_type get_table_type(const char *name) st_table_list::calc_md5() buffer buffer for md5 writing */ + void st_table_list::calc_md5(char *buffer) { my_MD5_CTX context; - unsigned char digest[16]; - my_MD5Init (&context); - my_MD5Update (&context,(unsigned char *) query.str, query.length); - my_MD5Final (digest, &context); + uchar digest[16]; + my_MD5Init(&context); + my_MD5Update(&context,(uchar *) query.str, query.length); + my_MD5Final(digest, &context); sprintf((char *) buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[0], digest[1], digest[2], digest[3], @@ -1469,6 +1467,7 @@ void st_table_list::calc_md5(char *buffer) SYNOPSIS st_table_list::set_ancestor() */ + void st_table_list::set_ancestor() { if (ancestor->ancestor) @@ -1496,6 +1495,7 @@ void st_table_list::set_ancestor() (without fields) for name resolving, but substituted expressions will return correct used tables mask. */ + bool st_table_list::setup_ancestor(THD *thd, Item **conds) { Item **transl; @@ -1515,13 +1515,13 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds) thd->set_query_id= 1; /* this view was prepared already on previous PS/SP execution */ Item **end= field_translation + select->item_list.elements; - for (Item **i= field_translation; i < end; i++) + for (Item **item= field_translation; item < end; item++) { - //TODO: fix for several tables in VIEW + /* TODO: fix for several tables in VIEW */ uint want_privilege= ancestor->table->grant.want_privilege; /* real rights will be checked in VIEW field */ ancestor->table->grant.want_privilege= 0; - if (!(*i)->fixed && (*i)->fix_fields(thd, ancestor, i)) + if (!(*item)->fixed && (*item)->fix_fields(thd, ancestor, item)) goto err; ancestor->table->grant.want_privilege= want_privilege; } @@ -1545,19 +1545,17 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds) thd->set_query_id= 1; while ((item= it++)) { - //TODO: fix for several tables in VIEW + /* TODO: fix for several tables in VIEW */ uint want_privilege= ancestor->table->grant.want_privilege; /* real rights will be checked in VIEW field */ ancestor->table->grant.want_privilege= 0; if (!item->fixed && item->fix_fields(thd, ancestor, &item)) - { goto err; - } ancestor->table->grant.want_privilege= want_privilege; transl[i++]= item; } field_translation= transl; - //TODO: sort this list? Use hash for big number of fields + /* TODO: sort this list? Use hash for big number of fields */ if (where) { @@ -1566,12 +1564,12 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds) goto err; if (arena) - thd->set_n_backup_item_arena(arena, &backup); + thd->set_n_backup_item_arena(arena, &backup); if (outer_join) { /* Store WHERE condition to ON expression for outer join, because we - can't use WHERE to correctly execute jeft joins on VIEWs and this + can't use WHERE to correctly execute jeft joins on VIEWs and this expression will not be moved to WHERE condition (i.e. will be clean correctly for PS/SP) */ |