1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Cleanup of new code pushed into 5.0 since last pull

Merged the different find_xxxx_table_in_list functions to one + some inline functions


mysql-test/r/view.result:
  Fix result (remove not used view from show tables)
sql/item_subselect.cc:
  Remove not used functions
sql/item_subselect.h:
  Remove not used functions
sql/mysql_priv.h:
  Merged the different find_xxxx_table_in_list functions to one + some inline functions
sql/sql_acl.cc:
  More debugging + simple cleanups
sql/sql_base.cc:
  Merged the different find_xxxx_table_in_list functions to one + some inline functions
  Indentation cleanups & more comments
sql/sql_delete.cc:
  Namechange
sql/sql_insert.cc:
  Simple optimizations & Style cleanups
  Merged common code (in mysql_prepare_insert_check_table)
sql/sql_lex.cc:
  function name changes
  More comments
sql/sql_parse.cc:
  Function name changes
  Made check_one_table_access returning bool
  More debugging in 'check_access'
  Added function 'check_some_access', which is used when creating a view
sql/sql_prepare.cc:
  Resetting flag directly after test makes code easier to read
sql/sql_select.cc:
  Code simplifications
sql/sql_show.cc:
  Indentation cleanups.
  Fixed typo in name
sql/sql_update.cc:
  Function name change
sql/sql_view.cc:
  Simple optimizations.
  Style fixes.
  Remove view_field_names[]
  Simplified 'check_key_in_view()'
sql/table.cc:
  Simplified new code in openfrm()
  variable name change i -> item
  Indentation changes
sql/table.h:
  Fixed typo in variable name
  Method name change in field iterator: end() -> end_of_fields()
tests/client_test.c:
  Changed number to macro
This commit is contained in:
unknown
2004-09-03 21:43:04 +03:00
parent 10d0dca6b4
commit d0211cf5be
18 changed files with 491 additions and 458 deletions

View File

@ -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)
*/