Backport of:

----------------------------------------------------------
revno: 2630.22.8
committer: Konstantin Osipov <konstantin@mysql.com>
branch nick: mysql-6.0-runtime
timestamp: Sun 2008-08-10 18:49:52 +0400
message:
  Get rid of typedef struct for the most commonly used types:
  TABLE, TABLE_SHARE, LEX. This simplifies use of tags
  and forward declarations.
This commit is contained in:
Konstantin Osipov 2009-10-14 15:14:58 +04:00
parent 2f01aa9727
commit 4db335dcee
20 changed files with 120 additions and 131 deletions

View File

@ -1799,7 +1799,7 @@ bool Field::optimize_range(uint idx, uint part)
} }
Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field::new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type __attribute__((unused))) bool keep_type __attribute__((unused)))
{ {
Field *tmp; Field *tmp;
@ -1820,7 +1820,7 @@ Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table,
} }
Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table, Field *Field::new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit) uint new_null_bit)
{ {
@ -1837,7 +1837,7 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table,
/* This is used to generate a field in TABLE from TABLE_SHARE */ /* This is used to generate a field in TABLE from TABLE_SHARE */
Field *Field::clone(MEM_ROOT *root, struct st_table *new_table) Field *Field::clone(MEM_ROOT *root, TABLE *new_table)
{ {
Field *tmp; Field *tmp;
if ((tmp= (Field*) memdup_root(root,(char*) this,size_of()))) if ((tmp= (Field*) memdup_root(root,(char*) this,size_of())))
@ -7003,7 +7003,7 @@ uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
} }
Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field_string::new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type) bool keep_type)
{ {
Field *field; Field *field;
@ -7581,7 +7581,7 @@ int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
} }
Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field_varstring::new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type) bool keep_type)
{ {
Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table, Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table,
@ -7593,7 +7593,7 @@ Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table,
Field *Field_varstring::new_key_field(MEM_ROOT *root, Field *Field_varstring::new_key_field(MEM_ROOT *root,
struct st_table *new_table, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit) uint new_null_bit)
{ {
@ -8723,7 +8723,7 @@ void Field_enum::sql_type(String &res) const
} }
Field *Field_enum::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field_enum::new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type) bool keep_type)
{ {
Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type); Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type);
@ -9021,7 +9021,7 @@ Field_bit::do_last_null_byte() const
Field *Field_bit::new_key_field(MEM_ROOT *root, Field *Field_bit::new_key_field(MEM_ROOT *root,
struct st_table *new_table, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit) uint new_null_bit)
{ {

View File

@ -60,8 +60,8 @@ public:
Note that you can use table->in_use as replacement for current_thd member Note that you can use table->in_use as replacement for current_thd member
only inside of val_*() and store() members (e.g. you can't use it in cons) only inside of val_*() and store() members (e.g. you can't use it in cons)
*/ */
struct st_table *table; // Pointer for table TABLE *table; // Pointer for table
struct st_table *orig_table; // Pointer to original table TABLE *orig_table; // Pointer to original table
const char **table_name, *field_name; const char **table_name, *field_name;
LEX_STRING comment; LEX_STRING comment;
/* Field is part of the following keys */ /* Field is part of the following keys */
@ -301,12 +301,12 @@ public:
*/ */
virtual bool can_be_compared_as_longlong() const { return FALSE; } virtual bool can_be_compared_as_longlong() const { return FALSE; }
virtual void free() {} virtual void free() {}
virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table, virtual Field *new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type); bool keep_type);
virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, virtual Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit); uint new_null_bit);
Field *clone(MEM_ROOT *mem_root, struct st_table *new_table); Field *clone(MEM_ROOT *mem_root, TABLE *new_table);
inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg)
{ {
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
@ -1506,7 +1506,7 @@ public:
enum_field_types real_type() const { return MYSQL_TYPE_STRING; } enum_field_types real_type() const { return MYSQL_TYPE_STRING; }
bool has_charset(void) const bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; } { return charset() == &my_charset_bin ? FALSE : TRUE; }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
virtual uint get_key_image(uchar *buff,uint length, imagetype type); virtual uint get_key_image(uchar *buff,uint length, imagetype type);
private: private:
int do_save_field_metadata(uchar *first_byte); int do_save_field_metadata(uchar *first_byte);
@ -1593,8 +1593,8 @@ public:
enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; } enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; }
bool has_charset(void) const bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; } { return charset() == &my_charset_bin ? FALSE : TRUE; }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit); uint new_null_bit);
uint is_equal(Create_field *new_field); uint is_equal(Create_field *new_field);
@ -1833,7 +1833,7 @@ public:
{ {
flags|=ENUM_FLAG; flags|=ENUM_FLAG;
} }
Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type);
enum_field_types type() const { return MYSQL_TYPE_STRING; } enum_field_types type() const { return MYSQL_TYPE_STRING; }
enum Item_result cmp_type () const { return INT_RESULT; } enum Item_result cmp_type () const { return INT_RESULT; }
enum Item_result cast_to_int_type () const { return INT_RESULT; } enum Item_result cast_to_int_type () const { return INT_RESULT; }
@ -1971,7 +1971,7 @@ public:
uint param_data, bool low_byte_first); uint param_data, bool low_byte_first);
virtual void set_default(); virtual void set_default();
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, Field *new_key_field(MEM_ROOT *root, TABLE *new_table,
uchar *new_ptr, uchar *new_null_ptr, uchar *new_ptr, uchar *new_null_ptr,
uint new_null_bit); uint new_null_bit);
void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg)

View File

@ -505,9 +505,8 @@ class st_alter_tablespace : public Sql_alloc
/* The handler for a table type. Will be included in the TABLE structure */ /* The handler for a table type. Will be included in the TABLE structure */
struct st_table; struct TABLE;
typedef struct st_table TABLE; struct TABLE_SHARE;
typedef struct st_table_share TABLE_SHARE;
struct st_foreign_key_info; struct st_foreign_key_info;
typedef struct st_foreign_key_info FOREIGN_KEY_INFO; typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len, typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len,
@ -1076,8 +1075,8 @@ class handler :public Sql_alloc
public: public:
typedef ulonglong Table_flags; typedef ulonglong Table_flags;
protected: protected:
struct st_table_share *table_share; /* The table definition */ TABLE_SHARE *table_share; /* The table definition */
struct st_table *table; /* The current open table */ TABLE *table; /* The current open table */
Table_flags cached_table_flags; /* Set on init() and open() */ Table_flags cached_table_flags; /* Set on init() and open() */
ha_rows estimation_rows_to_insert; ha_rows estimation_rows_to_insert;

View File

@ -641,7 +641,6 @@ enum enum_parsing_place
IN_ON IN_ON
}; };
struct st_table;
#define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__) #define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
class THD; class THD;

View File

@ -25,9 +25,8 @@
/* Forward declarations */ /* Forward declarations */
class handler; class handler;
class MYSQL_BIN_LOG; class MYSQL_BIN_LOG;
struct st_table; struct TABLE;
typedef st_table TABLE;
/* /*
Injector to inject rows into the MySQL server. Injector to inject rows into the MySQL server.

View File

@ -18,8 +18,7 @@
/* Forward declarations */ /* Forward declarations */
#ifndef MYSQL_CLIENT #ifndef MYSQL_CLIENT
struct st_table; struct TABLE;
typedef st_table TABLE;
#else #else
class Table_map_log_event; class Table_map_log_event;
typedef Table_map_log_event TABLE; typedef Table_map_log_event TABLE;

View File

@ -2927,7 +2927,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
Set 1 as a flag here Set 1 as a flag here
*/ */
if (error < 0) if (error < 0)
table_list->view= (st_lex*)1; table_list->view= (LEX*)1;
my_free((uchar*)table, MYF(0)); my_free((uchar*)table, MYF(0));
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));

View File

@ -65,7 +65,7 @@ struct Query_cache_query;
struct Query_cache_result; struct Query_cache_result;
class Query_cache; class Query_cache;
struct Query_cache_tls; struct Query_cache_tls;
struct st_lex; struct LEX;
/** /**
This class represents a node in the linked chain of queries This class represents a node in the linked chain of queries

View File

@ -2097,7 +2097,7 @@ void st_select_lex::print_limit(THD *thd,
to implement the clean up. to implement the clean up.
*/ */
void st_lex::cleanup_lex_after_parse_error(THD *thd) void LEX::cleanup_lex_after_parse_error(THD *thd)
{ {
/* /*
Delete sphead for the side effect of restoring of the original Delete sphead for the side effect of restoring of the original
@ -2187,7 +2187,7 @@ void Query_tables_list::destroy_query_tables_list()
Initialize LEX object. Initialize LEX object.
SYNOPSIS SYNOPSIS
st_lex::st_lex() LEX::LEX()
NOTE NOTE
LEX object initialized with this constructor can be used as part of LEX object initialized with this constructor can be used as part of
@ -2197,7 +2197,7 @@ void Query_tables_list::destroy_query_tables_list()
for this. for this.
*/ */
st_lex::st_lex() LEX::LEX()
:result(0), :result(0),
sql_command(SQLCOM_END), option_type(OPT_DEFAULT), is_lex_started(0) sql_command(SQLCOM_END), option_type(OPT_DEFAULT), is_lex_started(0)
{ {
@ -2214,7 +2214,7 @@ st_lex::st_lex()
Check whether the merging algorithm can be used on this VIEW Check whether the merging algorithm can be used on this VIEW
SYNOPSIS SYNOPSIS
st_lex::can_be_merged() LEX::can_be_merged()
DESCRIPTION DESCRIPTION
We can apply merge algorithm if it is single SELECT view with We can apply merge algorithm if it is single SELECT view with
@ -2228,7 +2228,7 @@ st_lex::st_lex()
TRUE - merge algorithm can be used TRUE - merge algorithm can be used
*/ */
bool st_lex::can_be_merged() bool LEX::can_be_merged()
{ {
// TODO: do not forget implement case when select_lex.table_list.elements==0 // TODO: do not forget implement case when select_lex.table_list.elements==0
@ -2265,19 +2265,19 @@ bool st_lex::can_be_merged()
check if command can use VIEW with MERGE algorithm (for top VIEWs) check if command can use VIEW with MERGE algorithm (for top VIEWs)
SYNOPSIS SYNOPSIS
st_lex::can_use_merged() LEX::can_use_merged()
DESCRIPTION DESCRIPTION
Only listed here commands can use merge algorithm in top level Only listed here commands can use merge algorithm in top level
SELECT_LEX (for subqueries will be used merge algorithm if SELECT_LEX (for subqueries will be used merge algorithm if
st_lex::can_not_use_merged() is not TRUE). LEX::can_not_use_merged() is not TRUE).
RETURN RETURN
FALSE - command can't use merged VIEWs FALSE - command can't use merged VIEWs
TRUE - VIEWs with MERGE algorithms can be used TRUE - VIEWs with MERGE algorithms can be used
*/ */
bool st_lex::can_use_merged() bool LEX::can_use_merged()
{ {
switch (sql_command) switch (sql_command)
{ {
@ -2302,18 +2302,18 @@ bool st_lex::can_use_merged()
Check if command can't use merged views in any part of command Check if command can't use merged views in any part of command
SYNOPSIS SYNOPSIS
st_lex::can_not_use_merged() LEX::can_not_use_merged()
DESCRIPTION DESCRIPTION
Temporary table algorithm will be used on all SELECT levels for queries Temporary table algorithm will be used on all SELECT levels for queries
listed here (see also st_lex::can_use_merged()). listed here (see also LEX::can_use_merged()).
RETURN RETURN
FALSE - command can't use merged VIEWs FALSE - command can't use merged VIEWs
TRUE - VIEWs with MERGE algorithms can be used TRUE - VIEWs with MERGE algorithms can be used
*/ */
bool st_lex::can_not_use_merged() bool LEX::can_not_use_merged()
{ {
switch (sql_command) switch (sql_command)
{ {
@ -2342,7 +2342,7 @@ bool st_lex::can_not_use_merged()
FALSE no, we need data FALSE no, we need data
*/ */
bool st_lex::only_view_structure() bool LEX::only_view_structure()
{ {
switch (sql_command) { switch (sql_command) {
case SQLCOM_SHOW_CREATE: case SQLCOM_SHOW_CREATE:
@ -2371,7 +2371,7 @@ bool st_lex::only_view_structure()
*/ */
bool st_lex::need_correct_ident() bool LEX::need_correct_ident()
{ {
switch(sql_command) switch(sql_command)
{ {
@ -2401,7 +2401,7 @@ bool st_lex::need_correct_ident()
VIEW_CHECK_CASCADED CHECK OPTION CASCADED VIEW_CHECK_CASCADED CHECK OPTION CASCADED
*/ */
uint8 st_lex::get_effective_with_check(TABLE_LIST *view) uint8 LEX::get_effective_with_check(TABLE_LIST *view)
{ {
if (view->select_lex->master_unit() == &unit && if (view->select_lex->master_unit() == &unit &&
which_check_option_applicable()) which_check_option_applicable())
@ -2430,7 +2430,7 @@ uint8 st_lex::get_effective_with_check(TABLE_LIST *view)
*/ */
bool bool
st_lex::copy_db_to(char **p_db, size_t *p_db_length) const LEX::copy_db_to(char **p_db, size_t *p_db_length) const
{ {
if (sphead) if (sphead)
{ {
@ -2507,7 +2507,7 @@ void st_select_lex_unit::set_limit(st_select_lex *sl)
clause. clause.
*/ */
void st_lex::set_trg_event_type_for_tables() void LEX::set_trg_event_type_for_tables()
{ {
uint8 new_trg_event_map= 0; uint8 new_trg_event_map= 0;
@ -2650,7 +2650,7 @@ void st_lex::set_trg_event_type_for_tables()
In this case link_to_local is set. In this case link_to_local is set.
*/ */
TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) TABLE_LIST *LEX::unlink_first_table(bool *link_to_local)
{ {
TABLE_LIST *first; TABLE_LIST *first;
if ((first= query_tables)) if ((first= query_tables))
@ -2690,7 +2690,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
table list table list
SYNOPSYS SYNOPSYS
st_lex::first_lists_tables_same() LEX::first_lists_tables_same()
NOTES NOTES
In many cases (for example, usual INSERT/DELETE/...) the first table of In many cases (for example, usual INSERT/DELETE/...) the first table of
@ -2701,7 +2701,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
the global list first. the global list first.
*/ */
void st_lex::first_lists_tables_same() void LEX::first_lists_tables_same()
{ {
TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first; TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first;
if (query_tables != first_table && first_table != 0) if (query_tables != first_table && first_table != 0)
@ -2737,7 +2737,7 @@ void st_lex::first_lists_tables_same()
global list global list
*/ */
void st_lex::link_first_table_back(TABLE_LIST *first, void LEX::link_first_table_back(TABLE_LIST *first,
bool link_to_local) bool link_to_local)
{ {
if (first) if (first)
@ -2764,7 +2764,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
cleanup lex for case when we open table by table for processing cleanup lex for case when we open table by table for processing
SYNOPSIS SYNOPSIS
st_lex::cleanup_after_one_table_open() LEX::cleanup_after_one_table_open()
NOTE NOTE
This method is mostly responsible for cleaning up of selects lists and This method is mostly responsible for cleaning up of selects lists and
@ -2772,7 +2772,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
to call Query_tables_list::reset_query_tables_list(FALSE). to call Query_tables_list::reset_query_tables_list(FALSE).
*/ */
void st_lex::cleanup_after_one_table_open() void LEX::cleanup_after_one_table_open()
{ {
/* /*
thd->lex->derived_tables & additional units may be set if we open thd->lex->derived_tables & additional units may be set if we open
@ -2807,7 +2807,7 @@ void st_lex::cleanup_after_one_table_open()
backup Pointer to Query_tables_list instance to be used for backup backup Pointer to Query_tables_list instance to be used for backup
*/ */
void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup) void LEX::reset_n_backup_query_tables_list(Query_tables_list *backup)
{ {
backup->set_query_tables_list(this); backup->set_query_tables_list(this);
/* /*
@ -2826,7 +2826,7 @@ void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup)
backup Pointer to Query_tables_list instance used for backup backup Pointer to Query_tables_list instance used for backup
*/ */
void st_lex::restore_backup_query_tables_list(Query_tables_list *backup) void LEX::restore_backup_query_tables_list(Query_tables_list *backup)
{ {
this->destroy_query_tables_list(); this->destroy_query_tables_list();
this->set_query_tables_list(backup); this->set_query_tables_list(backup);
@ -2837,14 +2837,14 @@ void st_lex::restore_backup_query_tables_list(Query_tables_list *backup)
Checks for usage of routines and/or tables in a parsed statement Checks for usage of routines and/or tables in a parsed statement
SYNOPSIS SYNOPSIS
st_lex:table_or_sp_used() LEX:table_or_sp_used()
RETURN RETURN
FALSE No routines and tables used FALSE No routines and tables used
TRUE Either or both routines and tables are used. TRUE Either or both routines and tables are used.
*/ */
bool st_lex::table_or_sp_used() bool LEX::table_or_sp_used()
{ {
DBUG_ENTER("table_or_sp_used"); DBUG_ENTER("table_or_sp_used");
@ -3005,7 +3005,7 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length)
@retval FALSE No, not a management partition command @retval FALSE No, not a management partition command
*/ */
bool st_lex::is_partition_management() const bool LEX::is_partition_management() const
{ {
return (sql_command == SQLCOM_ALTER_TABLE && return (sql_command == SQLCOM_ALTER_TABLE &&
(alter_info.flags == ALTER_ADD_PARTITION || (alter_info.flags == ALTER_ADD_PARTITION ||

View File

@ -395,7 +395,7 @@ public:
Base class for st_select_lex (SELECT_LEX) & Base class for st_select_lex (SELECT_LEX) &
st_select_lex_unit (SELECT_LEX_UNIT) st_select_lex_unit (SELECT_LEX_UNIT)
*/ */
struct st_lex; struct LEX;
class st_select_lex; class st_select_lex;
class st_select_lex_unit; class st_select_lex_unit;
class st_select_lex_node { class st_select_lex_node {
@ -465,7 +465,7 @@ public:
virtual void set_lock_for_tables(thr_lock_type lock_type) {} virtual void set_lock_for_tables(thr_lock_type lock_type) {}
friend class st_select_lex_unit; friend class st_select_lex_unit;
friend bool mysql_new_select(struct st_lex *lex, bool move_down); friend bool mysql_new_select(LEX *lex, bool move_down);
friend bool mysql_make_view(THD *thd, File_parser *parser, friend bool mysql_make_view(THD *thd, File_parser *parser,
TABLE_LIST *table, uint flags); TABLE_LIST *table, uint flags);
private: private:
@ -585,7 +585,7 @@ public:
/* Saved values of the WHERE and HAVING clauses*/ /* Saved values of the WHERE and HAVING clauses*/
Item::cond_result cond_value, having_value; Item::cond_result cond_value, having_value;
/* point on lex in which it was created, used in view subquery detection */ /* point on lex in which it was created, used in view subquery detection */
st_lex *parent_lex; LEX *parent_lex;
enum olap_type olap; enum olap_type olap;
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */ /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
SQL_LIST table_list; SQL_LIST table_list;
@ -961,7 +961,7 @@ extern const LEX_STRING null_lex_str;
stored functions/triggers to this list in order to pre-open and lock stored functions/triggers to this list in order to pre-open and lock
them. them.
Also used by st_lex::reset_n_backup/restore_backup_query_tables_list() Also used by LEX::reset_n_backup/restore_backup_query_tables_list()
methods to save and restore this information. methods to save and restore this information.
*/ */
@ -1550,7 +1550,7 @@ protected:
Constructor. Constructor.
@param lex the LEX structure that represents parts of this statement. @param lex the LEX structure that represents parts of this statement.
*/ */
Sql_statement(struct st_lex *lex) Sql_statement(LEX *lex)
: m_lex(lex) : m_lex(lex)
{} {}
@ -1575,12 +1575,12 @@ protected:
with the minimum set of attributes, instead of a LEX structure that with the minimum set of attributes, instead of a LEX structure that
contains the collection of every possible attribute. contains the collection of every possible attribute.
*/ */
struct st_lex *m_lex; LEX *m_lex;
}; };
/* The state of the lex parsing. This is saved in the THD struct */ /* The state of the lex parsing. This is saved in the THD struct */
typedef struct st_lex : public Query_tables_list struct LEX: public Query_tables_list
{ {
SELECT_LEX_UNIT unit; /* most upper unit */ SELECT_LEX_UNIT unit; /* most upper unit */
SELECT_LEX select_lex; /* first SELECT_LEX */ SELECT_LEX select_lex; /* first SELECT_LEX */
@ -1837,9 +1837,9 @@ typedef struct st_lex : public Query_tables_list
*/ */
bool protect_against_global_read_lock; bool protect_against_global_read_lock;
st_lex(); LEX();
virtual ~st_lex() virtual ~LEX()
{ {
destroy_query_tables_list(); destroy_query_tables_list();
plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements); plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements);
@ -1881,7 +1881,7 @@ typedef struct st_lex : public Query_tables_list
Is this update command where 'WHITH CHECK OPTION' clause is important Is this update command where 'WHITH CHECK OPTION' clause is important
SYNOPSIS SYNOPSIS
st_lex::which_check_option_applicable() LEX::which_check_option_applicable()
RETURN RETURN
TRUE have to take 'WHITH CHECK OPTION' clause into account TRUE have to take 'WHITH CHECK OPTION' clause into account
@ -1953,7 +1953,7 @@ typedef struct st_lex : public Query_tables_list
} }
return FALSE; return FALSE;
} }
} LEX; };
/** /**
@ -2044,7 +2044,7 @@ public:
}; };
struct st_lex_local: public st_lex struct st_lex_local: public LEX
{ {
static void *operator new(size_t size) throw() static void *operator new(size_t size) throw()
{ {

View File

@ -3141,7 +3141,7 @@ static int fill_schema_table_from_frm(THD *thd,TABLE *table,
{ {
tbl.s= share; tbl.s= share;
table_list.table= &tbl; table_list.table= &tbl;
table_list.view= (st_lex*) share->is_view; table_list.view= (LEX*) share->is_view;
res= schema_table->process_table(thd, &table_list, table, res= schema_table->process_table(thd, &table_list, table,
res, db_name, table_name); res, db_name, table_name);
closefrm(&tbl, true); closefrm(&tbl, true);

View File

@ -502,7 +502,7 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
struct sp_cond_type *spcondtype; struct sp_cond_type *spcondtype;
struct { int vars, conds, hndlrs, curs; } spblock; struct { int vars, conds, hndlrs, curs; } spblock;
sp_name *spname; sp_name *spname;
struct st_lex *lex; LEX *lex;
sp_head *sphead; sp_head *sphead;
struct p_elem_val *p_elem_value; struct p_elem_val *p_elem_value;
enum index_hint_type index_hint; enum index_hint_type index_hint;

View File

@ -16,7 +16,7 @@
/* The old structures from unireg */ /* The old structures from unireg */
struct st_table; struct TABLE;
class Field; class Field;
typedef struct st_date_time_format { typedef struct st_date_time_format {
@ -97,7 +97,7 @@ typedef struct st_key {
union { union {
int bdb_return_if_eq; int bdb_return_if_eq;
} handler; } handler;
struct st_table *table; TABLE *table;
} KEY; } KEY;
@ -121,9 +121,9 @@ class THD;
class handler; class handler;
typedef struct st_read_record { /* Parameter to read_record */ typedef struct st_read_record { /* Parameter to read_record */
struct st_table *table; /* Head-form */ TABLE *table; /* Head-form */
handler *file; handler *file;
struct st_table **forms; /* head and ref forms */ TABLE **forms; /* head and ref forms */
int (*read_record)(struct st_read_record *); int (*read_record)(struct st_read_record *);
THD *thd; THD *thd;
SQL_SELECT *select; SQL_SELECT *select;

View File

@ -2931,7 +2931,7 @@ table_check_intact(TABLE *table, const uint table_f_count,
Create Item_field for each column in the table. Create Item_field for each column in the table.
SYNPOSIS SYNPOSIS
st_table::fill_item_list() TABLE::fill_item_list()
item_list a pointer to an empty list used to store items item_list a pointer to an empty list used to store items
DESCRIPTION DESCRIPTION
@ -2944,7 +2944,7 @@ table_check_intact(TABLE *table, const uint table_f_count,
1 out of memory 1 out of memory
*/ */
bool st_table::fill_item_list(List<Item> *item_list) const bool TABLE::fill_item_list(List<Item> *item_list) const
{ {
/* /*
All Item_field's created using a direct pointer to a field All Item_field's created using a direct pointer to a field
@ -2964,7 +2964,7 @@ bool st_table::fill_item_list(List<Item> *item_list) const
Fields of this table. Fields of this table.
SYNPOSIS SYNPOSIS
st_table::fill_item_list() TABLE::fill_item_list()
item_list a non-empty list with Item_fields item_list a non-empty list with Item_fields
DESCRIPTION DESCRIPTION
@ -2974,7 +2974,7 @@ bool st_table::fill_item_list(List<Item> *item_list) const
is the same as the number of columns in the table. is the same as the number of columns in the table.
*/ */
void st_table::reset_item_list(List<Item> *item_list) const void TABLE::reset_item_list(List<Item> *item_list) const
{ {
List_iterator_fast<Item> it(*item_list); List_iterator_fast<Item> it(*item_list);
for (Field **ptr= field; *ptr; ptr++) for (Field **ptr= field; *ptr; ptr++)
@ -3909,7 +3909,7 @@ const char *Natural_join_column::db_name()
return table_ref->view_db.str; return table_ref->view_db.str;
/* /*
Test that TABLE_LIST::db is the same as st_table_share::db to Test that TABLE_LIST::db is the same as TABLE_SHARE::db to
ensure consistency. An exception are I_S schema tables, which ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect. are inconsistent in this respect.
*/ */
@ -4128,7 +4128,7 @@ const char *Field_iterator_table_ref::get_db_name()
return natural_join_it.column_ref()->db_name(); return natural_join_it.column_ref()->db_name();
/* /*
Test that TABLE_LIST::db is the same as st_table_share::db to Test that TABLE_LIST::db is the same as TABLE_SHARE::db to
ensure consistency. An exception are I_S schema tables, which ensure consistency. An exception are I_S schema tables, which
are inconsistent in this respect. are inconsistent in this respect.
*/ */
@ -4304,7 +4304,7 @@ Field_iterator_table_ref::get_natural_column_ref()
/* Reset all columns bitmaps */ /* Reset all columns bitmaps */
void st_table::clear_column_bitmaps() void TABLE::clear_column_bitmaps()
{ {
/* /*
Reset column read/write usage. It's identical to: Reset column read/write usage. It's identical to:
@ -4325,9 +4325,9 @@ void st_table::clear_column_bitmaps()
key fields. key fields.
*/ */
void st_table::prepare_for_position() void TABLE::prepare_for_position()
{ {
DBUG_ENTER("st_table::prepare_for_position"); DBUG_ENTER("TABLE::prepare_for_position");
if ((file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && if ((file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) &&
s->primary_key < MAX_KEY) s->primary_key < MAX_KEY)
@ -4346,14 +4346,14 @@ void st_table::prepare_for_position()
NOTE: NOTE:
This changes the bitmap to use the tmp bitmap This changes the bitmap to use the tmp bitmap
After this, you can't access any other columns in the table until After this, you can't access any other columns in the table until
bitmaps are reset, for example with st_table::clear_column_bitmaps() bitmaps are reset, for example with TABLE::clear_column_bitmaps()
or st_table::restore_column_maps_after_mark_index() or TABLE::restore_column_maps_after_mark_index()
*/ */
void st_table::mark_columns_used_by_index(uint index) void TABLE::mark_columns_used_by_index(uint index)
{ {
MY_BITMAP *bitmap= &tmp_set; MY_BITMAP *bitmap= &tmp_set;
DBUG_ENTER("st_table::mark_columns_used_by_index"); DBUG_ENTER("TABLE::mark_columns_used_by_index");
(void) file->extra(HA_EXTRA_KEYREAD); (void) file->extra(HA_EXTRA_KEYREAD);
bitmap_clear_all(bitmap); bitmap_clear_all(bitmap);
@ -4374,9 +4374,9 @@ void st_table::mark_columns_used_by_index(uint index)
when calling mark_columns_used_by_index when calling mark_columns_used_by_index
*/ */
void st_table::restore_column_maps_after_mark_index() void TABLE::restore_column_maps_after_mark_index()
{ {
DBUG_ENTER("st_table::restore_column_maps_after_mark_index"); DBUG_ENTER("TABLE::restore_column_maps_after_mark_index");
key_read= 0; key_read= 0;
(void) file->extra(HA_EXTRA_NO_KEYREAD); (void) file->extra(HA_EXTRA_NO_KEYREAD);
@ -4390,7 +4390,7 @@ void st_table::restore_column_maps_after_mark_index()
mark columns used by key, but don't reset other fields mark columns used by key, but don't reset other fields
*/ */
void st_table::mark_columns_used_by_index_no_reset(uint index, void TABLE::mark_columns_used_by_index_no_reset(uint index,
MY_BITMAP *bitmap) MY_BITMAP *bitmap)
{ {
KEY_PART_INFO *key_part= key_info[index].key_part; KEY_PART_INFO *key_part= key_info[index].key_part;
@ -4409,7 +4409,7 @@ void st_table::mark_columns_used_by_index_no_reset(uint index,
always set and sometimes read. always set and sometimes read.
*/ */
void st_table::mark_auto_increment_column() void TABLE::mark_auto_increment_column()
{ {
DBUG_ASSERT(found_next_number_field); DBUG_ASSERT(found_next_number_field);
/* /*
@ -4442,7 +4442,7 @@ void st_table::mark_auto_increment_column()
retrieve the row again. retrieve the row again.
*/ */
void st_table::mark_columns_needed_for_delete() void TABLE::mark_columns_needed_for_delete()
{ {
if (triggers) if (triggers)
triggers->mark_fields_used(TRG_EVENT_DELETE); triggers->mark_fields_used(TRG_EVENT_DELETE);
@ -4492,7 +4492,7 @@ void st_table::mark_columns_needed_for_delete()
retrieve the row again. retrieve the row again.
*/ */
void st_table::mark_columns_needed_for_update() void TABLE::mark_columns_needed_for_update()
{ {
DBUG_ENTER("mark_columns_needed_for_update"); DBUG_ENTER("mark_columns_needed_for_update");
if (triggers) if (triggers)
@ -4535,7 +4535,7 @@ void st_table::mark_columns_needed_for_update()
as changed. as changed.
*/ */
void st_table::mark_columns_needed_for_insert() void TABLE::mark_columns_needed_for_insert()
{ {
if (triggers) if (triggers)
{ {
@ -4565,7 +4565,7 @@ void st_table::mark_columns_needed_for_insert()
TABLEs. Each of these TABLEs is called a part of a MERGE table. TABLEs. Each of these TABLEs is called a part of a MERGE table.
*/ */
bool st_table::is_children_attached(void) bool TABLE::is_children_attached(void)
{ {
return((child_l && children_attached) || return((child_l && children_attached) ||
(parent && parent->children_attached)); (parent && parent->children_attached));
@ -4629,9 +4629,9 @@ Item_subselect *TABLE_LIST::containing_subselect()
DESCRIPTION DESCRIPTION
The parser collects the index hints for each table in a "tagged list" The parser collects the index hints for each table in a "tagged list"
(TABLE_LIST::index_hints). Using the information in this tagged list (TABLE_LIST::index_hints). Using the information in this tagged list
this function sets the members st_table::keys_in_use_for_query, this function sets the members TABLE::keys_in_use_for_query,
st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, TABLE::keys_in_use_for_group_by, TABLE::keys_in_use_for_order_by,
st_table::force_index and st_table::covering_keys. TABLE::force_index and TABLE::covering_keys.
Current implementation of the runtime does not allow mixing FORCE INDEX Current implementation of the runtime does not allow mixing FORCE INDEX
and USE INDEX, so this is checked here. Then the FORCE INDEX list and USE INDEX, so this is checked here. Then the FORCE INDEX list

View File

@ -290,9 +290,9 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db,
instance of table share per one table in the database. instance of table share per one table in the database.
*/ */
typedef struct st_table_share struct TABLE_SHARE
{ {
st_table_share() {} /* Remove gcc warning */ TABLE_SHARE() {} /* Remove gcc warning */
/** Category of this table. */ /** Category of this table. */
TABLE_CATEGORY table_category; TABLE_CATEGORY table_category;
@ -305,11 +305,7 @@ typedef struct st_table_share
TYPELIB *intervals; /* pointer to interval info */ TYPELIB *intervals; /* pointer to interval info */
pthread_mutex_t mutex; /* For locking the share */ pthread_mutex_t mutex; /* For locking the share */
pthread_cond_t cond; /* To signal that share is ready */ pthread_cond_t cond; /* To signal that share is ready */
struct st_table_share *next, /* Link to unused shares */ TABLE_SHARE *next, **prev; /* Link to unused shares */
**prev;
#ifdef NOT_YET
struct st_table *open_tables; /* link to open tables */
#endif
/* The following is copied to each TABLE on OPEN */ /* The following is copied to each TABLE on OPEN */
Field **field; Field **field;
@ -592,7 +588,7 @@ typedef struct st_table_share
return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id; return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id;
} }
} TABLE_SHARE; };
extern ulong refresh_version; extern ulong refresh_version;
@ -605,19 +601,16 @@ enum index_hint_type
INDEX_HINT_FORCE INDEX_HINT_FORCE
}; };
struct st_table { struct TABLE
st_table() {} /* Remove gcc warning */ {
TABLE() {} /* Remove gcc warning */
TABLE_SHARE *s; TABLE_SHARE *s;
handler *file; handler *file;
#ifdef NOT_YET TABLE *next, *prev;
struct st_table *used_next, **used_prev; /* Link to used tables */
struct st_table *open_next, **open_prev; /* Link to open tables */
#endif
struct st_table *next, *prev;
/* For the below MERGE related members see top comment in ha_myisammrg.cc */ /* For the below MERGE related members see top comment in ha_myisammrg.cc */
struct st_table *parent; /* Set in MERGE child. Ptr to parent */ TABLE *parent; /* Set in MERGE child. Ptr to parent */
TABLE_LIST *child_l; /* Set in MERGE parent. List of children */ TABLE_LIST *child_l; /* Set in MERGE parent. List of children */
TABLE_LIST **child_last_l; /* Set in MERGE parent. End of list */ TABLE_LIST **child_last_l; /* Set in MERGE parent. End of list */
@ -999,7 +992,6 @@ typedef struct st_schema_table
/** The threshold size a blob field buffer before it is freed */ /** The threshold size a blob field buffer before it is freed */
#define MAX_TDC_BLOB_SIZE 65536 #define MAX_TDC_BLOB_SIZE 65536
struct st_lex;
class select_union; class select_union;
class TMP_TABLE_PARAM; class TMP_TABLE_PARAM;
@ -1077,6 +1069,7 @@ public:
(TABLE_LIST::join_using_fields != NULL) (TABLE_LIST::join_using_fields != NULL)
*/ */
struct LEX;
class Index_hint; class Index_hint;
struct TABLE_LIST struct TABLE_LIST
{ {
@ -1197,7 +1190,7 @@ struct TABLE_LIST
TMP_TABLE_PARAM *schema_table_param; TMP_TABLE_PARAM *schema_table_param;
/* link to select_lex where this table was used */ /* link to select_lex where this table was used */
st_select_lex *select_lex; st_select_lex *select_lex;
st_lex *view; /* link on VIEW lex for merging */ LEX *view; /* link on VIEW lex for merging */
Field_translator *field_translation; /* array of VIEW fields */ Field_translator *field_translation; /* array of VIEW fields */
/* pointer to element after last one in translation table above */ /* pointer to element after last one in translation table above */
Field_translator *field_translation_end; Field_translator *field_translation_end;
@ -1412,9 +1405,9 @@ struct TABLE_LIST
Item_subselect *containing_subselect(); Item_subselect *containing_subselect();
/* /*
Compiles the tagged hints list and fills up st_table::keys_in_use_for_query, Compiles the tagged hints list and fills up TABLE::keys_in_use_for_query,
st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, TABLE::keys_in_use_for_group_by, TABLE::keys_in_use_for_order_by,
st_table::force_index and st_table::covering_keys. TABLE::force_index and TABLE::covering_keys.
*/ */
bool process_index_hints(TABLE *table); bool process_index_hints(TABLE *table);

View File

@ -4497,7 +4497,7 @@ calc_row_difference(
upd_t* uvect, /*!< in/out: update vector */ upd_t* uvect, /*!< in/out: update vector */
uchar* old_row, /*!< in: old row in MySQL format */ uchar* old_row, /*!< in: old row in MySQL format */
uchar* new_row, /*!< in: new row in MySQL format */ uchar* new_row, /*!< in: new row in MySQL format */
struct st_table* table, /*!< in: table in MySQL data TABLE* table, /*!< in: table in MySQL data
dictionary */ dictionary */
uchar* upd_buff, /*!< in: buffer to use */ uchar* upd_buff, /*!< in: buffer to use */
ulint buff_len, /*!< in: buffer length */ ulint buff_len, /*!< in: buffer length */

View File

@ -27,7 +27,7 @@ UNIV_INTERN
void void
innobase_rec_to_mysql( innobase_rec_to_mysql(
/*==================*/ /*==================*/
TABLE* table, /*!< in/out: MySQL table */ struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */ const dict_index_t* index, /*!< in: index */
const ulint* offsets); /*!< in: rec_get_offsets( const ulint* offsets); /*!< in: rec_get_offsets(
@ -39,4 +39,4 @@ UNIV_INTERN
void void
innobase_rec_reset( innobase_rec_reset(
/*===============*/ /*===============*/
TABLE* table); /*!< in/out: MySQL table */ struct TABLE* table); /*!< in/out: MySQL table */

View File

@ -191,7 +191,7 @@ row_merge_build_indexes(
unless creating a PRIMARY KEY */ unless creating a PRIMARY KEY */
dict_index_t** indexes, /*!< in: indexes to be created */ dict_index_t** indexes, /*!< in: indexes to be created */
ulint n_indexes, /*!< in: size of indexes[] */ ulint n_indexes, /*!< in: size of indexes[] */
TABLE* table); /*!< in/out: MySQL table, for struct TABLE* table); /*!< in/out: MySQL table, for
reporting erroneous key value reporting erroneous key value
if applicable */ if applicable */
#endif /* row0merge.h */ #endif /* row0merge.h */

View File

@ -54,6 +54,6 @@ typedef struct purge_node_struct purge_node_t;
typedef struct row_ext_struct row_ext_t; typedef struct row_ext_struct row_ext_t;
/* MySQL data types */ /* MySQL data types */
typedef struct st_table TABLE; struct TABLE;
#endif #endif

View File

@ -397,7 +397,7 @@ row_merge_buf_add(
/** Structure for reporting duplicate records. */ /** Structure for reporting duplicate records. */
struct row_merge_dup_struct { struct row_merge_dup_struct {
const dict_index_t* index; /*!< index being sorted */ const dict_index_t* index; /*!< index being sorted */
TABLE* table; /*!< MySQL table object */ struct TABLE* table; /*!< MySQL table object */
ulint n_dup; /*!< number of duplicates */ ulint n_dup; /*!< number of duplicates */
}; };
@ -1075,7 +1075,7 @@ ulint
row_merge_read_clustered_index( row_merge_read_clustered_index(
/*===========================*/ /*===========================*/
trx_t* trx, /*!< in: transaction */ trx_t* trx, /*!< in: transaction */
TABLE* table, /*!< in/out: MySQL table object, struct TABLE* table, /*!< in/out: MySQL table object,
for reporting erroneous records */ for reporting erroneous records */
const dict_table_t* old_table,/*!< in: table where rows are const dict_table_t* old_table,/*!< in: table where rows are
read from */ read from */
@ -1351,7 +1351,7 @@ row_merge_blocks(
ulint* foffs1, /*!< in/out: offset of second ulint* foffs1, /*!< in/out: offset of second
source list in the file */ source list in the file */
merge_file_t* of, /*!< in/out: output file */ merge_file_t* of, /*!< in/out: output file */
TABLE* table) /*!< in/out: MySQL table, for struct TABLE* table) /*!< in/out: MySQL table, for
reporting erroneous key value reporting erroneous key value
if applicable */ if applicable */
{ {
@ -1450,7 +1450,7 @@ row_merge(
ulint half, /*!< in: half the file */ ulint half, /*!< in: half the file */
row_merge_block_t* block, /*!< in/out: 3 buffers */ row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */ int* tmpfd, /*!< in/out: temporary file handle */
TABLE* table) /*!< in/out: MySQL table, for struct TABLE* table) /*!< in/out: MySQL table, for
reporting erroneous key value reporting erroneous key value
if applicable */ if applicable */
{ {
@ -1513,7 +1513,7 @@ row_merge_sort(
index entries */ index entries */
row_merge_block_t* block, /*!< in/out: 3 buffers */ row_merge_block_t* block, /*!< in/out: 3 buffers */
int* tmpfd, /*!< in/out: temporary file handle */ int* tmpfd, /*!< in/out: temporary file handle */
TABLE* table) /*!< in/out: MySQL table, for struct TABLE* table) /*!< in/out: MySQL table, for
reporting erroneous key value reporting erroneous key value
if applicable */ if applicable */
{ {
@ -2278,7 +2278,7 @@ row_merge_build_indexes(
unless creating a PRIMARY KEY */ unless creating a PRIMARY KEY */
dict_index_t** indexes, /*!< in: indexes to be created */ dict_index_t** indexes, /*!< in: indexes to be created */
ulint n_indexes, /*!< in: size of indexes[] */ ulint n_indexes, /*!< in: size of indexes[] */
TABLE* table) /*!< in/out: MySQL table, for struct TABLE* table) /*!< in/out: MySQL table, for
reporting erroneous key value reporting erroneous key value
if applicable */ if applicable */
{ {