Commit 94e41712 authored by unknown's avatar unknown

Doxygenize comments.

parent 4a0ec786
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* /**
@file
It is interface module to fixed precision decimals library. It is interface module to fixed precision decimals library.
Most functions use 'uint mask' as parameter, if during operation error Most functions use 'uint mask' as parameter, if during operation error
...@@ -34,14 +36,14 @@ C_MODE_END ...@@ -34,14 +36,14 @@ C_MODE_END
#define DECIMAL_LONG_DIGITS 10 #define DECIMAL_LONG_DIGITS 10
#define DECIMAL_LONG3_DIGITS 8 #define DECIMAL_LONG3_DIGITS 8
/* maximum length of buffer in our big digits (uint32) */ /** maximum length of buffer in our big digits (uint32). */
#define DECIMAL_BUFF_LENGTH 9 #define DECIMAL_BUFF_LENGTH 9
/* the number of digits that my_decimal can possibly contain */ /* the number of digits that my_decimal can possibly contain */
#define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9) #define DECIMAL_MAX_POSSIBLE_PRECISION (DECIMAL_BUFF_LENGTH * 9)
/* /**
maximum guaranteed precision of number in decimal digits (number of our maximum guaranteed precision of number in decimal digits (number of our
digits * number of decimal digits in one our big digit - number of decimal digits * number of decimal digits in one our big digit - number of decimal
digits in one our big digit decreased by 1 (because we always put decimal digits in one our big digit decreased by 1 (because we always put decimal
...@@ -51,13 +53,14 @@ C_MODE_END ...@@ -51,13 +53,14 @@ C_MODE_END
#define DECIMAL_MAX_SCALE 30 #define DECIMAL_MAX_SCALE 30
#define DECIMAL_NOT_SPECIFIED 31 #define DECIMAL_NOT_SPECIFIED 31
/* /**
maximum length of string representation (number of maximum decimal maximum length of string representation (number of maximum decimal
digits + 1 position for sign + 1 position for decimal point) digits + 1 position for sign + 1 position for decimal point)
*/ */
#define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2) #define DECIMAL_MAX_STR_LENGTH (DECIMAL_MAX_POSSIBLE_PRECISION + 2)
/*
maximum size of packet length /**
maximum size of packet length.
*/ */
#define DECIMAL_MAX_FIELD_SIZE DECIMAL_MAX_PRECISION #define DECIMAL_MAX_FIELD_SIZE DECIMAL_MAX_PRECISION
...@@ -78,11 +81,12 @@ inline int my_decimal_int_part(uint precision, uint decimals) ...@@ -78,11 +81,12 @@ inline int my_decimal_int_part(uint precision, uint decimals)
} }
/* /**
my_decimal class limits 'decimal_t' type to what we need in MySQL my_decimal class limits 'decimal_t' type to what we need in MySQL.
It contains internally all necessary space needed by the instance so It contains internally all necessary space needed by the instance so
no extra memory is needed. One should call fix_buffer_pointer() function no extra memory is needed. One should call fix_buffer_pointer() function
when he moves my_decimal objects in memory when he moves my_decimal objects in memory.
*/ */
class my_decimal :public decimal_t class my_decimal :public decimal_t
...@@ -384,7 +388,10 @@ int my_decimal_mod(uint mask, my_decimal *res, const my_decimal *a, ...@@ -384,7 +388,10 @@ int my_decimal_mod(uint mask, my_decimal *res, const my_decimal *a,
} }
/* Returns -1 if a<b, 1 if a>b and 0 if a==b */ /**
@return
-1 if a<b, 1 if a>b and 0 if a==b
*/
inline inline
int my_decimal_cmp(const my_decimal *a, const my_decimal *b) int my_decimal_cmp(const my_decimal *a, const my_decimal *b)
{ {
......
...@@ -13,10 +13,13 @@ ...@@ -13,10 +13,13 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* /**
@file
@details
Mostly this file is used in the server. But a little part of it is used in Mostly this file is used in the server. But a little part of it is used in
mysqlbinlog too (definition of SELECT_DISTINCT and others). mysqlbinlog too (definition of SELECT_DISTINCT and others).
The consequence is that 90% of the file is wrapped in #ifndef MYSQL_CLIENT, The consequence is that 90% of the file is wrapped in \#ifndef MYSQL_CLIENT,
except the part which must be in the server and in the client. except the part which must be in the server and in the client.
*/ */
...@@ -253,12 +256,12 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -253,12 +256,12 @@ class Default_object_creation_ctx : public Object_creation_ctx
Feel free to raise this by the smallest amount you can to get the Feel free to raise this by the smallest amount you can to get the
"execution_constants" test to pass. "execution_constants" test to pass.
*/ */
#define STACK_MIN_SIZE 12000 // Abort if less stack during eval. #define STACK_MIN_SIZE 12000 ///< Abort if less stack during eval.
#define STACK_MIN_SIZE_FOR_OPEN 1024*80 #define STACK_MIN_SIZE_FOR_OPEN 1024*80
#define STACK_BUFF_ALLOC 352 // For stack overrun checks #define STACK_BUFF_ALLOC 352 ///< For stack overrun checks
#ifndef MYSQLD_NET_RETRY_COUNT #ifndef MYSQLD_NET_RETRY_COUNT
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int. #define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int.
#endif #endif
#define TEMP_POOL_SIZE 128 #define TEMP_POOL_SIZE 128
...@@ -282,14 +285,14 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -282,14 +285,14 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define MIN_ROWS_TO_USE_TABLE_CACHE 100 #define MIN_ROWS_TO_USE_TABLE_CACHE 100
#define MIN_ROWS_TO_USE_BULK_INSERT 100 #define MIN_ROWS_TO_USE_BULK_INSERT 100
/* /**
The following is used to decide if MySQL should use table scanning The following is used to decide if MySQL should use table scanning
instead of reading with keys. The number says how many evaluation of the instead of reading with keys. The number says how many evaluation of the
WHERE clause is comparable to reading one extra row from a table. WHERE clause is comparable to reading one extra row from a table.
*/ */
#define TIME_FOR_COMPARE 5 // 5 compares == one read #define TIME_FOR_COMPARE 5 // 5 compares == one read
/* /**
Number of comparisons of table rowids equivalent to reading one row from a Number of comparisons of table rowids equivalent to reading one row from a
table. table.
*/ */
...@@ -309,17 +312,17 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -309,17 +312,17 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define DISK_SEEK_PROP_COST ((double)0.5/BLOCKS_IN_AVG_SEEK) #define DISK_SEEK_PROP_COST ((double)0.5/BLOCKS_IN_AVG_SEEK)
/* /**
Number of rows in a reference table when refereed through a not unique key. Number of rows in a reference table when refereed through a not unique key.
This value is only used when we don't know anything about the key This value is only used when we don't know anything about the key
distribution. distribution.
*/ */
#define MATCHING_ROWS_IN_OTHER_TABLE 10 #define MATCHING_ROWS_IN_OTHER_TABLE 10
/* Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used) */ /** Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used). */
#define KEY_DEFAULT_PACK_LENGTH 8 #define KEY_DEFAULT_PACK_LENGTH 8
/* Characters shown for the command in 'show processlist' */ /** Characters shown for the command in 'show processlist'. */
#define PROCESS_LIST_WIDTH 100 #define PROCESS_LIST_WIDTH 100
/* Characters shown for the command in 'information_schema.processlist' */ /* Characters shown for the command in 'information_schema.processlist' */
#define PROCESS_LIST_INFO_WIDTH 65535 #define PROCESS_LIST_INFO_WIDTH 65535
...@@ -335,11 +338,11 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -335,11 +338,11 @@ class Default_object_creation_ctx : public Object_creation_ctx
/* The following can also be changed from the command line */ /* The following can also be changed from the command line */
#define DEFAULT_CONCURRENCY 10 #define DEFAULT_CONCURRENCY 10
#define DELAYED_LIMIT 100 /* pause after xxx inserts */ #define DELAYED_LIMIT 100 /**< pause after xxx inserts */
#define DELAYED_QUEUE_SIZE 1000 #define DELAYED_QUEUE_SIZE 1000
#define DELAYED_WAIT_TIMEOUT 5*60 /* Wait for delayed insert */ #define DELAYED_WAIT_TIMEOUT 5*60 /**< Wait for delayed insert */
#define FLUSH_TIME 0 /* Don't flush tables */ #define FLUSH_TIME 0 /**< Don't flush tables */
#define MAX_CONNECT_ERRORS 10 // errors before disabling host #define MAX_CONNECT_ERRORS 10 ///< errors before disabling host
#ifdef __NETWARE__ #ifdef __NETWARE__
#define IF_NETWARE(A,B) A #define IF_NETWARE(A,B) A
...@@ -349,7 +352,7 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -349,7 +352,7 @@ class Default_object_creation_ctx : public Object_creation_ctx
#if defined(__WIN__) #if defined(__WIN__)
#undef FLUSH_TIME #undef FLUSH_TIME
#define FLUSH_TIME 1800 /* Flush every half hour */ #define FLUSH_TIME 1800 /**< Flush every half hour */
#define INTERRUPT_PRIOR -2 #define INTERRUPT_PRIOR -2
#define CONNECT_PRIOR -1 #define CONNECT_PRIOR -1
...@@ -368,12 +371,12 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -368,12 +371,12 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define TEST_MIT_THREAD 4 #define TEST_MIT_THREAD 4
#define TEST_BLOCKING 8 #define TEST_BLOCKING 8
#define TEST_KEEP_TMP_TABLES 16 #define TEST_KEEP_TMP_TABLES 16
#define TEST_READCHECK 64 /* Force use of readcheck */ #define TEST_READCHECK 64 /**< Force use of readcheck */
#define TEST_NO_EXTRA 128 #define TEST_NO_EXTRA 128
#define TEST_CORE_ON_SIGNAL 256 /* Give core if signal */ #define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */
#define TEST_NO_STACKTRACE 512 #define TEST_NO_STACKTRACE 512
#define TEST_SIGINT 1024 /* Allow sigint on threads */ #define TEST_SIGINT 1024 /**< Allow sigint on threads */
#define TEST_SYNCHRONIZATION 2048 /* get server to do sleep in #define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in
some places */ some places */
#endif #endif
...@@ -423,26 +426,26 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -423,26 +426,26 @@ class Default_object_creation_ctx : public Object_creation_ctx
/* The following is used to detect a conflict with DISTINCT */ /* The following is used to detect a conflict with DISTINCT */
#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser #define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
/* The following can be set when importing tables in a 'wrong order' /** The following can be set when importing tables in a 'wrong order'
to suppress foreign key checks */ to suppress foreign key checks */
#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog #define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
/* The following speeds up inserts to InnoDB tables by suppressing unique /** The following speeds up inserts to InnoDB tables by suppressing unique
key checks in some cases */ key checks in some cases */
#define OPTION_RELAXED_UNIQUE_CHECKS (ULL(1) << 27) // THD, user, binlog #define OPTION_RELAXED_UNIQUE_CHECKS (ULL(1) << 27) // THD, user, binlog
#define SELECT_NO_UNLOCK (ULL(1) << 28) // SELECT, intern #define SELECT_NO_UNLOCK (ULL(1) << 28) // SELECT, intern
#define OPTION_SCHEMA_TABLE (ULL(1) << 29) // SELECT, intern #define OPTION_SCHEMA_TABLE (ULL(1) << 29) // SELECT, intern
/* Flag set if setup_tables already done */ /** Flag set if setup_tables already done */
#define OPTION_SETUP_TABLES_DONE (ULL(1) << 30) // intern #define OPTION_SETUP_TABLES_DONE (ULL(1) << 30) // intern
/* If not set then the thread will ignore all warnings with level notes. */ /** If not set then the thread will ignore all warnings with level notes. */
#define OPTION_SQL_NOTES (ULL(1) << 31) // THD, user #define OPTION_SQL_NOTES (ULL(1) << 31) // THD, user
/* /**
Force the used temporary table to be a MyISAM table (because we will use Force the used temporary table to be a MyISAM table (because we will use
fulltext functions when reading from it. fulltext functions when reading from it.
*/ */
#define TMP_TABLE_FORCE_MYISAM (ULL(1) << 32) #define TMP_TABLE_FORCE_MYISAM (ULL(1) << 32)
/* /**
Maximum length of time zone name that we support Maximum length of time zone name that we support
(Time zone name is char(64) in db). mysqlbinlog needs it. (Time zone name is char(64) in db). mysqlbinlog needs it.
*/ */
...@@ -505,9 +508,9 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -505,9 +508,9 @@ class Default_object_creation_ctx : public Object_creation_ctx
#define UNCACHEABLE_DEPENDENT 1 #define UNCACHEABLE_DEPENDENT 1
#define UNCACHEABLE_RAND 2 #define UNCACHEABLE_RAND 2
#define UNCACHEABLE_SIDEEFFECT 4 #define UNCACHEABLE_SIDEEFFECT 4
// forcing to save JOIN for explain /// forcing to save JOIN for explain
#define UNCACHEABLE_EXPLAIN 8 #define UNCACHEABLE_EXPLAIN 8
/* Don't evaluate subqueries in prepare even if they're not correlated */ /** Don't evaluate subqueries in prepare even if they're not correlated */
#define UNCACHEABLE_PREPARE 16 #define UNCACHEABLE_PREPARE 16
/* For uncorrelated SELECT in an UNION with some correlated SELECTs */ /* For uncorrelated SELECT in an UNION with some correlated SELECTs */
#define UNCACHEABLE_UNITED 32 #define UNCACHEABLE_UNITED 32
...@@ -515,7 +518,7 @@ class Default_object_creation_ctx : public Object_creation_ctx ...@@ -515,7 +518,7 @@ class Default_object_creation_ctx : public Object_creation_ctx
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */ /* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
#define UNDEF_POS (-1) #define UNDEF_POS (-1)
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
/* /**
Sync points allow us to force the server to reach a certain line of code Sync points allow us to force the server to reach a certain line of code
and block there until the client tells the server it is ok to go on. and block there until the client tells the server it is ok to go on.
The client tells the server to block with SELECT GET_LOCK() The client tells the server to block with SELECT GET_LOCK()
...@@ -551,7 +554,7 @@ void view_store_options(THD *thd, TABLE_LIST *table, String *buff); ...@@ -551,7 +554,7 @@ void view_store_options(THD *thd, TABLE_LIST *table, String *buff);
#define portable_sizeof_char_ptr 8 #define portable_sizeof_char_ptr 8
#define tmp_file_prefix "#sql" /* Prefix for tmp tables */ #define tmp_file_prefix "#sql" /**< Prefix for tmp tables */
#define tmp_file_prefix_length 4 #define tmp_file_prefix_length 4
/* Flags for calc_week() function. */ /* Flags for calc_week() function. */
...@@ -587,8 +590,8 @@ enum enum_check_fields ...@@ -587,8 +590,8 @@ enum enum_check_fields
CHECK_FIELD_ERROR_FOR_NULL CHECK_FIELD_ERROR_FOR_NULL
}; };
/* Struct to handle simple linked lists */
/** Struct to handle simple linked lists. */
typedef struct st_sql_list { typedef struct st_sql_list {
uint elements; uint elements;
uchar *first; uchar *first;
...@@ -2192,16 +2195,15 @@ Item * all_any_subquery_creator(Item *left_expr, ...@@ -2192,16 +2195,15 @@ Item * all_any_subquery_creator(Item *left_expr,
bool all, bool all,
SELECT_LEX *select_lex); SELECT_LEX *select_lex);
/* /**
clean/setup table fields and map clean/setup table fields and map.
SYNOPSYS @param table TABLE structure pointer (which should be setup)
setup_table_map() @param table_list TABLE_LIST structure pointer (owner of TABLE)
table - TABLE structure pointer (which should be setup) @param tablenr table number
table_list TABLE_LIST structure pointer (owner of TABLE)
tablenr - table number
*/ */
inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
{ {
table->used_fields= 0; table->used_fields= 0;
...@@ -2223,10 +2225,8 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) ...@@ -2223,10 +2225,8 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
} }
/* /**
SYNOPSYS convert a hex digit into number.
hexchar_to_int()
convert a hex digit into number
*/ */
inline int hexchar_to_int(char c) inline int hexchar_to_int(char c)
...@@ -2239,11 +2239,9 @@ inline int hexchar_to_int(char c) ...@@ -2239,11 +2239,9 @@ inline int hexchar_to_int(char c)
return -1; return -1;
} }
/* /**
is_user_table() return true if the table was created explicitly.
return true if the table was created explicitly
*/ */
inline bool is_user_table(TABLE * table) inline bool is_user_table(TABLE * table)
{ {
const char *name= table->s->table_name.str; const char *name= table->s->table_name.str;
......
...@@ -13,8 +13,11 @@ ...@@ -13,8 +13,11 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* /**
Set MYSQL_SERVER_SUFFIX_STR @file
Set MYSQL_SERVER_SUFFIX_STR.
The following code is quite ugly as there is no portable way to easily set a The following code is quite ugly as there is no portable way to easily set a
string to the value of a macro string to the value of a macro
*/ */
......
/* ------------------------------------------------------------------------ /**
@file
@brief
Windows NT Service class library Windows NT Service class library
Copyright Abandoned 1998 Irena Pancirov - Irnet Snc Copyright Abandoned 1998 Irena Pancirov - Irnet Snc
This file is public domain and comes with NO WARRANTY of any kind This file is public domain and comes with NO WARRANTY of any kind
-------------------------------------------------------------------------- */ */
// main application thread // main application thread
typedef void (*THREAD_FC)(void *); typedef void (*THREAD_FC)(void *);
...@@ -13,7 +17,7 @@ class NTService ...@@ -13,7 +17,7 @@ class NTService
NTService(); NTService();
~NTService(); ~NTService();
BOOL bOsNT; // true if OS is NT, false for Win95 BOOL bOsNT; ///< true if OS is NT, false for Win95
//install optinos //install optinos
DWORD dwDesiredAccess; DWORD dwDesiredAccess;
DWORD dwServiceType; DWORD dwServiceType;
......
...@@ -20,27 +20,27 @@ ...@@ -20,27 +20,27 @@
#define PARSE_FILE_TIMESTAMPLENGTH 19 #define PARSE_FILE_TIMESTAMPLENGTH 19
enum file_opt_type { enum file_opt_type {
FILE_OPTIONS_STRING, /* String (LEX_STRING) */ FILE_OPTIONS_STRING, /**< String (LEX_STRING) */
FILE_OPTIONS_ESTRING, /* Escaped string (LEX_STRING) */ FILE_OPTIONS_ESTRING, /**< Escaped string (LEX_STRING) */
FILE_OPTIONS_ULONGLONG, /* ulonglong parameter (ulonglong) */ FILE_OPTIONS_ULONGLONG, /**< ulonglong parameter (ulonglong) */
FILE_OPTIONS_REV, /* Revision version number (ulonglong) */ FILE_OPTIONS_REV, /**< Revision version number (ulonglong) */
FILE_OPTIONS_TIMESTAMP, /* timestamp (LEX_STRING have to be FILE_OPTIONS_TIMESTAMP, /**< timestamp (LEX_STRING have to be
allocated with length 20 (19+1) */ allocated with length 20 (19+1) */
FILE_OPTIONS_STRLIST, /* list of escaped strings FILE_OPTIONS_STRLIST, /**< list of escaped strings
(List<LEX_STRING>) */ (List<LEX_STRING>) */
FILE_OPTIONS_ULLLIST /* list of ulonglong values FILE_OPTIONS_ULLLIST /**< list of ulonglong values
(List<ulonglong>) */ (List<ulonglong>) */
}; };
struct File_option struct File_option
{ {
LEX_STRING name; /* Name of the option */ LEX_STRING name; /**< Name of the option */
int offset; /* offset to base address of value */ int offset; /**< offset to base address of value */
file_opt_type type; /* Option type */ file_opt_type type; /**< Option type */
}; };
/* /**
This hook used to catch no longer supported keys and process them for This hook used to catch no longer supported keys and process them for
backward compatibility. backward compatibility.
*/ */
...@@ -55,7 +55,7 @@ class Unknown_key_hook ...@@ -55,7 +55,7 @@ class Unknown_key_hook
}; };
/* Dummy hook for parsers which do not need hook for unknown keys */ /** Dummy hook for parsers which do not need hook for unknown keys. */
class File_parser_dummy_hook: public Unknown_key_hook class File_parser_dummy_hook: public Unknown_key_hook
{ {
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#define PROC_NO_SORT 1 /* Bits in flags */ #define PROC_NO_SORT 1 /**< Bits in flags */
#define PROC_GROUP 2 /* proc must have group */ #define PROC_GROUP 2 /**< proc must have group */
/* Procedure items used by procedures to store values for send_fields */ /* Procedure items used by procedures to store values for send_fields */
......
...@@ -110,7 +110,7 @@ class Protocol ...@@ -110,7 +110,7 @@ class Protocol
}; };
/* Class used for the old (MySQL 4.0 protocol) */ /** Class used for the old (MySQL 4.0 protocol). */
class Protocol_text :public Protocol class Protocol_text :public Protocol
{ {
......
...@@ -109,7 +109,7 @@ class sp_name : public Sql_alloc ...@@ -109,7 +109,7 @@ class sp_name : public Sql_alloc
LEX_STRING m_db; LEX_STRING m_db;
LEX_STRING m_name; LEX_STRING m_name;
LEX_STRING m_qname; LEX_STRING m_qname;
/* /**
Key representing routine in the set of stored routines used by statement. Key representing routine in the set of stored routines used by statement.
Consists of 1-byte routine type and m_qname (which usually refences to Consists of 1-byte routine type and m_qname (which usually refences to
same buffer). Note that one must complete initialization of the key by same buffer). Note that one must complete initialization of the key by
...@@ -125,7 +125,7 @@ class sp_name : public Sql_alloc ...@@ -125,7 +125,7 @@ class sp_name : public Sql_alloc
m_qname.length= m_sroutines_key.length= 0; m_qname.length= m_sroutines_key.length= 0;
} }
/* /**
Creates temporary sp_name object from key, used mainly Creates temporary sp_name object from key, used mainly
for SP-cache lookups. for SP-cache lookups.
*/ */
...@@ -158,12 +158,12 @@ check_routine_name(LEX_STRING *ident); ...@@ -158,12 +158,12 @@ check_routine_name(LEX_STRING *ident);
class sp_head :private Query_arena class sp_head :private Query_arena
{ {
sp_head(const sp_head &); /* Prevent use of these */ sp_head(const sp_head &); /**< Prevent use of these */
void operator=(sp_head &); void operator=(sp_head &);
MEM_ROOT main_mem_root; MEM_ROOT main_mem_root;
public: public:
/* Possible values of m_flags */ /** Possible values of m_flags */
enum { enum {
HAS_RETURN= 1, // For FUNCTIONs only: is set if has RETURN HAS_RETURN= 1, // For FUNCTIONs only: is set if has RETURN
MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s) MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s)
...@@ -179,16 +179,16 @@ class sp_head :private Query_arena ...@@ -179,16 +179,16 @@ class sp_head :private Query_arena
HAS_SQLCOM_FLUSH= 4096 HAS_SQLCOM_FLUSH= 4096
}; };
/* TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */ /** TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */
int m_type; int m_type;
uint m_flags; // Boolean attributes of a stored routine uint m_flags; // Boolean attributes of a stored routine
Create_field m_return_field_def; /* This is used for FUNCTIONs only. */ Create_field m_return_field_def; /**< This is used for FUNCTIONs only. */
const char *m_tmp_query; // Temporary pointer to sub query string const char *m_tmp_query; ///< Temporary pointer to sub query string
st_sp_chistics *m_chistics; st_sp_chistics *m_chistics;
ulong m_sql_mode; // For SHOW CREATE and execution ulong m_sql_mode; ///< For SHOW CREATE and execution
LEX_STRING m_qname; // db.name LEX_STRING m_qname; ///< db.name
/** /**
Key representing routine in the set of stored routines used by statement. Key representing routine in the set of stored routines used by statement.
[routine_type]db.name [routine_type]db.name
...@@ -220,20 +220,20 @@ class sp_head :private Query_arena ...@@ -220,20 +220,20 @@ class sp_head :private Query_arena
longlong m_created; longlong m_created;
longlong m_modified; longlong m_modified;
/* Recursion level of the current SP instance. The levels are numbered from 0 */ /** Recursion level of the current SP instance. The levels are numbered from 0 */
ulong m_recursion_level; ulong m_recursion_level;
/* /**
A list of diferent recursion level instances for the same procedure. A list of diferent recursion level instances for the same procedure.
For every recursion level we have a sp_head instance. This instances For every recursion level we have a sp_head instance. This instances
connected in the list. The list ordered by increasing recursion level connected in the list. The list ordered by increasing recursion level
(m_recursion_level). (m_recursion_level).
*/ */
sp_head *m_next_cached_sp; sp_head *m_next_cached_sp;
/* /**
Pointer to the first element of the above list Pointer to the first element of the above list
*/ */
sp_head *m_first_instance; sp_head *m_first_instance;
/* /**
Pointer to the first free (non-INVOKED) routine in the list of Pointer to the first free (non-INVOKED) routine in the list of
cached instances for this SP. This pointer is set only for the first cached instances for this SP. This pointer is set only for the first
SP in the list of instences (see above m_first_cached_sp pointer). SP in the list of instences (see above m_first_cached_sp pointer).
...@@ -241,12 +241,12 @@ class sp_head :private Query_arena ...@@ -241,12 +241,12 @@ class sp_head :private Query_arena
For non-first instance value of this pointer meanless (point to itself); For non-first instance value of this pointer meanless (point to itself);
*/ */
sp_head *m_first_free_instance; sp_head *m_first_free_instance;
/* /**
Pointer to the last element in the list of instances of the SP. Pointer to the last element in the list of instances of the SP.
For non-first instance value of this pointer meanless (point to itself); For non-first instance value of this pointer meanless (point to itself);
*/ */
sp_head *m_last_cached_sp; sp_head *m_last_cached_sp;
/* /**
Set containing names of stored routines used by this routine. Set containing names of stored routines used by this routine.
Note that unlike elements of similar set for statement elements of this Note that unlike elements of similar set for statement elements of this
set are not linked in one list. Because of this we are able save memory set are not linked in one list. Because of this we are able save memory
...@@ -276,11 +276,11 @@ class sp_head :private Query_arena ...@@ -276,11 +276,11 @@ class sp_head :private Query_arena
sp_head(); sp_head();
// Initialize after we have reset mem_root /// Initialize after we have reset mem_root
void void
init(LEX *lex); init(LEX *lex);
/* Copy sp name from parser. */ /** Copy sp name from parser. */
void void
init_sp_name(THD *thd, sp_name *spname); init_sp_name(THD *thd, sp_name *spname);
...@@ -297,7 +297,7 @@ class sp_head :private Query_arena ...@@ -297,7 +297,7 @@ class sp_head :private Query_arena
virtual ~sp_head(); virtual ~sp_head();
// Free memory /// Free memory
void void
destroy(); destroy();
...@@ -334,33 +334,41 @@ class sp_head :private Query_arena ...@@ -334,33 +334,41 @@ class sp_head :private Query_arena
return i; return i;
} }
// Resets lex in 'thd' and keeps a copy of the old one. /*
Resets lex in 'thd' and keeps a copy of the old one.
@todo Conflicting comment in sp_head.cc
*/
void void
reset_lex(THD *thd); reset_lex(THD *thd);
// Restores lex in 'thd' from our copy, but keeps some status from the /**
// one in 'thd', like ptr, tables, fields, etc. Restores lex in 'thd' from our copy, but keeps some status from the
one in 'thd', like ptr, tables, fields, etc.
@todo Conflicting comment in sp_head.cc
*/
void void
restore_lex(THD *thd); restore_lex(THD *thd);
// Put the instruction on the backpatch list, associated with the label. /// Put the instruction on the backpatch list, associated with the label.
void void
push_backpatch(sp_instr *, struct sp_label *); push_backpatch(sp_instr *, struct sp_label *);
// Update all instruction with this label in the backpatch list to /// Update all instruction with this label in the backpatch list to
// the current position. /// the current position.
void void
backpatch(struct sp_label *); backpatch(struct sp_label *);
// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr. /// Start a new cont. backpatch level. If 'i' is NULL, the level is just incr.
void void
new_cont_backpatch(sp_instr_opt_meta *i); new_cont_backpatch(sp_instr_opt_meta *i);
// Add an instruction to the current level /// Add an instruction to the current level
void void
add_cont_backpatch(sp_instr_opt_meta *i); add_cont_backpatch(sp_instr_opt_meta *i);
// Backpatch (and pop) the current level to the current position. /// Backpatch (and pop) the current level to the current position.
void void
do_cont_backpatch(); do_cont_backpatch();
...@@ -423,7 +431,7 @@ class sp_head :private Query_arena ...@@ -423,7 +431,7 @@ class sp_head :private Query_arena
TABLE_LIST ***query_tables_last_ptr, TABLE_LIST ***query_tables_last_ptr,
TABLE_LIST *belong_to_view); TABLE_LIST *belong_to_view);
/* /**
Check if this stored routine contains statements disallowed Check if this stored routine contains statements disallowed
in a stored function or trigger, and set an appropriate error message in a stored function or trigger, and set an appropriate error message
if this is the case. if this is the case.
...@@ -472,19 +480,19 @@ class sp_head :private Query_arena ...@@ -472,19 +480,19 @@ class sp_head :private Query_arena
private: private:
MEM_ROOT *m_thd_root; // Temp. store for thd's mem_root MEM_ROOT *m_thd_root; ///< Temp. store for thd's mem_root
THD *m_thd; // Set if we have reset mem_root THD *m_thd; ///< Set if we have reset mem_root
sp_pcontext *m_pcont; // Parse context sp_pcontext *m_pcont; ///< Parse context
List<LEX> m_lex; // Temp. store for the other lex List<LEX> m_lex; ///< Temp. store for the other lex
DYNAMIC_ARRAY m_instr; // The "instructions" DYNAMIC_ARRAY m_instr; ///< The "instructions"
typedef struct typedef struct
{ {
struct sp_label *lab; struct sp_label *lab;
sp_instr *instr; sp_instr *instr;
} bp_t; } bp_t;
List<bp_t> m_backpatch; // Instructions needing backpatching List<bp_t> m_backpatch; ///< Instructions needing backpatching
/* /**
We need a special list for backpatching of instructions with a continue We need a special list for backpatching of instructions with a continue
destination (in the case of a continue handler catching an error in destination (in the case of a continue handler catching an error in
the test), since it would otherwise interfere with the normal backpatch the test), since it would otherwise interfere with the normal backpatch
...@@ -496,11 +504,12 @@ class sp_head :private Query_arena ...@@ -496,11 +504,12 @@ class sp_head :private Query_arena
List<sp_instr_opt_meta> m_cont_backpatch; List<sp_instr_opt_meta> m_cont_backpatch;
uint m_cont_level; // The current cont. backpatch level uint m_cont_level; // The current cont. backpatch level
/* /**
Multi-set representing optimized list of tables to be locked by this Multi-set representing optimized list of tables to be locked by this
routine. Does not include tables which are used by invoked routines. routine. Does not include tables which are used by invoked routines.
Note: for prelocking-free SPs this multiset is constructed too. @note
For prelocking-free SPs this multiset is constructed too.
We do so because the same instance of sp_head may be called both We do so because the same instance of sp_head may be called both
in prelocked mode and in non-prelocked mode. in prelocked mode and in non-prelocked mode.
*/ */
...@@ -515,7 +524,7 @@ class sp_head :private Query_arena ...@@ -515,7 +524,7 @@ class sp_head :private Query_arena
*/ */
void opt_mark(); void opt_mark();
/* /**
Merge the list of tables used by query into the multi-set of tables used Merge the list of tables used by query into the multi-set of tables used
by routine. by routine.
*/ */
...@@ -529,16 +538,16 @@ class sp_head :private Query_arena ...@@ -529,16 +538,16 @@ class sp_head :private Query_arena
class sp_instr :public Query_arena, public Sql_alloc class sp_instr :public Query_arena, public Sql_alloc
{ {
sp_instr(const sp_instr &); /* Prevent use of these */ sp_instr(const sp_instr &); /**< Prevent use of these */
void operator=(sp_instr &); void operator=(sp_instr &);
public: public:
uint marked; uint marked;
uint m_ip; // My index uint m_ip; ///< My index
sp_pcontext *m_ctx; // My parse context sp_pcontext *m_ctx; ///< My parse context
// Should give each a name or type code for debugging purposes? /// Should give each a name or type code for debugging purposes?
sp_instr(uint ip, sp_pcontext *ctx) sp_instr(uint ip, sp_pcontext *ctx)
:Query_arena(0, INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx) :Query_arena(0, INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx)
{} {}
...@@ -547,21 +556,19 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -547,21 +556,19 @@ class sp_instr :public Query_arena, public Sql_alloc
{ free_items(); } { free_items(); }
/* /**
Execute this instruction Execute this instruction
SYNOPSIS
execute() @param thd Thread handle
thd Thread handle @param[out] nextp index of the next instruction to execute. (For most
nextp OUT index of the next instruction to execute. (For most
instructions this will be the instruction following this instructions this will be the instruction following this
one). Note that this parameter is undefined in case of one). Note that this parameter is undefined in case of
errors, use get_cont_dest() to find the continuation errors, use get_cont_dest() to find the continuation
instruction for CONTINUE error handlers. instruction for CONTINUE error handlers.
RETURN @retval 0 on success,
0 on success, @retval other if some error occured
other if some error occurred
*/ */
virtual int execute(THD *thd, uint *nextp) = 0; virtual int execute(THD *thd, uint *nextp) = 0;
...@@ -599,7 +606,7 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -599,7 +606,7 @@ class sp_instr :public Query_arena, public Sql_alloc
virtual void backpatch(uint dest, sp_pcontext *dst_ctx) virtual void backpatch(uint dest, sp_pcontext *dst_ctx)
{} {}
/* /**
Mark this instruction as reachable during optimization and return the Mark this instruction as reachable during optimization and return the
index to the next instruction. Jump instruction will add their index to the next instruction. Jump instruction will add their
destination to the leads list. destination to the leads list.
...@@ -610,7 +617,7 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -610,7 +617,7 @@ class sp_instr :public Query_arena, public Sql_alloc
return m_ip+1; return m_ip+1;
} }
/* /**
Short-cut jumps to jumps during optimization. This is used by the Short-cut jumps to jumps during optimization. This is used by the
jump instructions' opt_mark() methods. 'start' is the starting point, jump instructions' opt_mark() methods. 'start' is the starting point,
used to prevent the mark sweep from looping for ever. Return the used to prevent the mark sweep from looping for ever. Return the
...@@ -621,7 +628,7 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -621,7 +628,7 @@ class sp_instr :public Query_arena, public Sql_alloc
return m_ip; return m_ip;
} }
/* /**
Inform the instruction that it has been moved during optimization. Inform the instruction that it has been moved during optimization.
Most instructions will simply update its index, but jump instructions Most instructions will simply update its index, but jump instructions
must also take care of their destination pointers. Forward jumps get must also take care of their destination pointers. Forward jumps get
...@@ -635,7 +642,7 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -635,7 +642,7 @@ class sp_instr :public Query_arena, public Sql_alloc
}; // class sp_instr : public Sql_alloc }; // class sp_instr : public Sql_alloc
/* /**
Auxilary class to which instructions delegate responsibility Auxilary class to which instructions delegate responsibility
for handling LEX and preparations before executing statement for handling LEX and preparations before executing statement
or calculating complex expression. or calculating complex expression.
...@@ -643,13 +650,14 @@ class sp_instr :public Query_arena, public Sql_alloc ...@@ -643,13 +650,14 @@ class sp_instr :public Query_arena, public Sql_alloc
Exist mainly to avoid having double hierarchy between instruction Exist mainly to avoid having double hierarchy between instruction
classes. classes.
TODO: Add ability to not store LEX and do any preparations if @todo
Add ability to not store LEX and do any preparations if
expression used is simple. expression used is simple.
*/ */
class sp_lex_keeper class sp_lex_keeper
{ {
/* Prevent use of these */ /** Prevent use of these */
sp_lex_keeper(const sp_lex_keeper &); sp_lex_keeper(const sp_lex_keeper &);
void operator=(sp_lex_keeper &); void operator=(sp_lex_keeper &);
public: public:
...@@ -669,10 +677,12 @@ class sp_lex_keeper ...@@ -669,10 +677,12 @@ class sp_lex_keeper
} }
} }
/* /**
Prepare execution of instruction using LEX, if requested check whenever Prepare execution of instruction using LEX, if requested check whenever
we have read access to tables used and open/lock them, call instruction's we have read access to tables used and open/lock them, call instruction's
exec_core() method, perform cleanup afterwards. exec_core() method, perform cleanup afterwards.
@todo Conflicting comment in sp_head.cc
*/ */
int reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables, int reset_lex_and_exec_core(THD *thd, uint *nextp, bool open_tables,
sp_instr* instr); sp_instr* instr);
...@@ -689,7 +699,7 @@ class sp_lex_keeper ...@@ -689,7 +699,7 @@ class sp_lex_keeper
private: private:
LEX *m_lex; LEX *m_lex;
/* /**
Indicates whenever this sp_lex_keeper instance responsible Indicates whenever this sp_lex_keeper instance responsible
for LEX deletion. for LEX deletion.
*/ */
...@@ -702,13 +712,13 @@ class sp_lex_keeper ...@@ -702,13 +712,13 @@ class sp_lex_keeper
prelocked mode itself. prelocked mode itself.
*/ */
/* /**
List of additional tables this statement needs to lock when it List of additional tables this statement needs to lock when it
enters/leaves prelocked mode on its own. enters/leaves prelocked mode on its own.
*/ */
TABLE_LIST *prelocking_tables; TABLE_LIST *prelocking_tables;
/* /**
The value m_lex->query_tables_own_last should be set to this when the The value m_lex->query_tables_own_last should be set to this when the
statement enters/leaves prelocked mode on its own. statement enters/leaves prelocked mode on its own.
*/ */
...@@ -716,17 +726,17 @@ class sp_lex_keeper ...@@ -716,17 +726,17 @@ class sp_lex_keeper
}; };
// /**
// Call out to some prepared SQL statement. Call out to some prepared SQL statement.
// */
class sp_instr_stmt : public sp_instr class sp_instr_stmt : public sp_instr
{ {
sp_instr_stmt(const sp_instr_stmt &); /* Prevent use of these */ sp_instr_stmt(const sp_instr_stmt &); /**< Prevent use of these */
void operator=(sp_instr_stmt &); void operator=(sp_instr_stmt &);
public: public:
LEX_STRING m_query; // For thd->query LEX_STRING m_query; ///< For thd->query
sp_instr_stmt(uint ip, sp_pcontext *ctx, LEX *lex) sp_instr_stmt(uint ip, sp_pcontext *ctx, LEX *lex)
: sp_instr(ip, ctx), m_lex_keeper(lex, TRUE) : sp_instr(ip, ctx), m_lex_keeper(lex, TRUE)
...@@ -753,7 +763,7 @@ class sp_instr_stmt : public sp_instr ...@@ -753,7 +763,7 @@ class sp_instr_stmt : public sp_instr
class sp_instr_set : public sp_instr class sp_instr_set : public sp_instr
{ {
sp_instr_set(const sp_instr_set &); /* Prevent use of these */ sp_instr_set(const sp_instr_set &); /**< Prevent use of these */
void operator=(sp_instr_set &); void operator=(sp_instr_set &);
public: public:
...@@ -776,15 +786,15 @@ class sp_instr_set : public sp_instr ...@@ -776,15 +786,15 @@ class sp_instr_set : public sp_instr
private: private:
uint m_offset; // Frame offset uint m_offset; ///< Frame offset
Item *m_value; Item *m_value;
enum enum_field_types m_type; // The declared type enum enum_field_types m_type; ///< The declared type
sp_lex_keeper m_lex_keeper; sp_lex_keeper m_lex_keeper;
}; // class sp_instr_set : public sp_instr }; // class sp_instr_set : public sp_instr
/* /**
Set NEW/OLD row field value instruction. Used in triggers. Set NEW/OLD row field value instruction. Used in triggers.
*/ */
class sp_instr_set_trigger_field : public sp_instr class sp_instr_set_trigger_field : public sp_instr
...@@ -818,18 +828,19 @@ class sp_instr_set_trigger_field : public sp_instr ...@@ -818,18 +828,19 @@ class sp_instr_set_trigger_field : public sp_instr
}; // class sp_instr_trigger_field : public sp_instr }; // class sp_instr_trigger_field : public sp_instr
/* /**
An abstract class for all instructions with destinations that An abstract class for all instructions with destinations that
needs to be updated by the optimizer. needs to be updated by the optimizer.
Even if not all subclasses will use both the normal destination and Even if not all subclasses will use both the normal destination and
the continuation destination, we put them both here for simplicity. the continuation destination, we put them both here for simplicity.
*/ */
class sp_instr_opt_meta : public sp_instr class sp_instr_opt_meta : public sp_instr
{ {
public: public:
uint m_dest; // Where we will go uint m_dest; ///< Where we will go
uint m_cont_dest; // Where continue handlers will go uint m_cont_dest; ///< Where continue handlers will go
sp_instr_opt_meta(uint ip, sp_pcontext *ctx) sp_instr_opt_meta(uint ip, sp_pcontext *ctx)
: sp_instr(ip, ctx), : sp_instr(ip, ctx),
...@@ -851,14 +862,14 @@ class sp_instr_opt_meta : public sp_instr ...@@ -851,14 +862,14 @@ class sp_instr_opt_meta : public sp_instr
protected: protected:
sp_instr *m_optdest; // Used during optimization sp_instr *m_optdest; ///< Used during optimization
sp_instr *m_cont_optdest; // Used during optimization sp_instr *m_cont_optdest; ///< Used during optimization
}; // class sp_instr_opt_meta : public sp_instr }; // class sp_instr_opt_meta : public sp_instr
class sp_instr_jump : public sp_instr_opt_meta class sp_instr_jump : public sp_instr_opt_meta
{ {
sp_instr_jump(const sp_instr_jump &); /* Prevent use of these */ sp_instr_jump(const sp_instr_jump &); /**< Prevent use of these */
void operator=(sp_instr_jump &); void operator=(sp_instr_jump &);
public: public:
...@@ -890,7 +901,7 @@ class sp_instr_jump : public sp_instr_opt_meta ...@@ -890,7 +901,7 @@ class sp_instr_jump : public sp_instr_opt_meta
m_dest= dest; m_dest= dest;
} }
/* /**
Update the destination; used by the optimizer. Update the destination; used by the optimizer.
*/ */
virtual void set_destination(uint old_dest, uint new_dest) virtual void set_destination(uint old_dest, uint new_dest)
...@@ -904,7 +915,7 @@ class sp_instr_jump : public sp_instr_opt_meta ...@@ -904,7 +915,7 @@ class sp_instr_jump : public sp_instr_opt_meta
class sp_instr_jump_if_not : public sp_instr_jump class sp_instr_jump_if_not : public sp_instr_jump
{ {
sp_instr_jump_if_not(const sp_instr_jump_if_not &); /* Prevent use of these */ sp_instr_jump_if_not(const sp_instr_jump_if_not &); /**< Prevent use of these */
void operator=(sp_instr_jump_if_not &); void operator=(sp_instr_jump_if_not &);
public: public:
...@@ -930,7 +941,7 @@ class sp_instr_jump_if_not : public sp_instr_jump ...@@ -930,7 +941,7 @@ class sp_instr_jump_if_not : public sp_instr_jump
virtual uint opt_mark(sp_head *sp, List<sp_instr> *leads); virtual uint opt_mark(sp_head *sp, List<sp_instr> *leads);
/* Override sp_instr_jump's shortcut; we stop here */ /** Override sp_instr_jump's shortcut; we stop here */
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{ {
return m_ip; return m_ip;
...@@ -947,7 +958,7 @@ class sp_instr_jump_if_not : public sp_instr_jump ...@@ -947,7 +958,7 @@ class sp_instr_jump_if_not : public sp_instr_jump
private: private:
Item *m_expr; // The condition Item *m_expr; ///< The condition
sp_lex_keeper m_lex_keeper; sp_lex_keeper m_lex_keeper;
}; // class sp_instr_jump_if_not : public sp_instr_jump }; // class sp_instr_jump_if_not : public sp_instr_jump
...@@ -955,7 +966,7 @@ class sp_instr_jump_if_not : public sp_instr_jump ...@@ -955,7 +966,7 @@ class sp_instr_jump_if_not : public sp_instr_jump
class sp_instr_freturn : public sp_instr class sp_instr_freturn : public sp_instr
{ {
sp_instr_freturn(const sp_instr_freturn &); /* Prevent use of these */ sp_instr_freturn(const sp_instr_freturn &); /**< Prevent use of these */
void operator=(sp_instr_freturn &); void operator=(sp_instr_freturn &);
public: public:
...@@ -992,7 +1003,7 @@ class sp_instr_freturn : public sp_instr ...@@ -992,7 +1003,7 @@ class sp_instr_freturn : public sp_instr
class sp_instr_hpush_jump : public sp_instr_jump class sp_instr_hpush_jump : public sp_instr_jump
{ {
sp_instr_hpush_jump(const sp_instr_hpush_jump &); /* Prevent use of these */ sp_instr_hpush_jump(const sp_instr_hpush_jump &); /**< Prevent use of these */
void operator=(sp_instr_hpush_jump &); void operator=(sp_instr_hpush_jump &);
public: public:
...@@ -1014,7 +1025,7 @@ class sp_instr_hpush_jump : public sp_instr_jump ...@@ -1014,7 +1025,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
virtual uint opt_mark(sp_head *sp, List<sp_instr> *leads); virtual uint opt_mark(sp_head *sp, List<sp_instr> *leads);
/* Override sp_instr_jump's shortcut; we stop here. */ /** Override sp_instr_jump's shortcut; we stop here. */
virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start) virtual uint opt_shortcut_jump(sp_head *sp, sp_instr *start)
{ {
return m_ip; return m_ip;
...@@ -1027,7 +1038,7 @@ class sp_instr_hpush_jump : public sp_instr_jump ...@@ -1027,7 +1038,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
private: private:
int m_type; // Handler type int m_type; ///< Handler type
uint m_frame; uint m_frame;
List<struct sp_cond_type> m_cond; List<struct sp_cond_type> m_cond;
...@@ -1036,7 +1047,7 @@ class sp_instr_hpush_jump : public sp_instr_jump ...@@ -1036,7 +1047,7 @@ class sp_instr_hpush_jump : public sp_instr_jump
class sp_instr_hpop : public sp_instr class sp_instr_hpop : public sp_instr
{ {
sp_instr_hpop(const sp_instr_hpop &); /* Prevent use of these */ sp_instr_hpop(const sp_instr_hpop &); /**< Prevent use of these */
void operator=(sp_instr_hpop &); void operator=(sp_instr_hpop &);
public: public:
...@@ -1061,7 +1072,7 @@ class sp_instr_hpop : public sp_instr ...@@ -1061,7 +1072,7 @@ class sp_instr_hpop : public sp_instr
class sp_instr_hreturn : public sp_instr_jump class sp_instr_hreturn : public sp_instr_jump
{ {
sp_instr_hreturn(const sp_instr_hreturn &); /* Prevent use of these */ sp_instr_hreturn(const sp_instr_hreturn &); /**< Prevent use of these */
void operator=(sp_instr_hreturn &); void operator=(sp_instr_hreturn &);
public: public:
...@@ -1092,10 +1103,10 @@ class sp_instr_hreturn : public sp_instr_jump ...@@ -1092,10 +1103,10 @@ class sp_instr_hreturn : public sp_instr_jump
}; // class sp_instr_hreturn : public sp_instr_jump }; // class sp_instr_hreturn : public sp_instr_jump
/* This is DECLARE CURSOR */ /** This is DECLARE CURSOR */
class sp_instr_cpush : public sp_instr class sp_instr_cpush : public sp_instr
{ {
sp_instr_cpush(const sp_instr_cpush &); /* Prevent use of these */ sp_instr_cpush(const sp_instr_cpush &); /**< Prevent use of these */
void operator=(sp_instr_cpush &); void operator=(sp_instr_cpush &);
public: public:
...@@ -1111,7 +1122,7 @@ class sp_instr_cpush : public sp_instr ...@@ -1111,7 +1122,7 @@ class sp_instr_cpush : public sp_instr
virtual void print(String *str); virtual void print(String *str);
/* /**
This call is used to cleanup the instruction when a sensitive This call is used to cleanup the instruction when a sensitive
cursor is closed. For now stored procedures always use materialized cursor is closed. For now stored procedures always use materialized
cursors and the call is not used. cursors and the call is not used.
...@@ -1120,14 +1131,14 @@ class sp_instr_cpush : public sp_instr ...@@ -1120,14 +1131,14 @@ class sp_instr_cpush : public sp_instr
private: private:
sp_lex_keeper m_lex_keeper; sp_lex_keeper m_lex_keeper;
uint m_cursor; /* Frame offset (for debugging) */ uint m_cursor; /**< Frame offset (for debugging) */
}; // class sp_instr_cpush : public sp_instr }; // class sp_instr_cpush : public sp_instr
class sp_instr_cpop : public sp_instr class sp_instr_cpop : public sp_instr
{ {
sp_instr_cpop(const sp_instr_cpop &); /* Prevent use of these */ sp_instr_cpop(const sp_instr_cpop &); /**< Prevent use of these */
void operator=(sp_instr_cpop &); void operator=(sp_instr_cpop &);
public: public:
...@@ -1152,7 +1163,7 @@ class sp_instr_cpop : public sp_instr ...@@ -1152,7 +1163,7 @@ class sp_instr_cpop : public sp_instr
class sp_instr_copen : public sp_instr class sp_instr_copen : public sp_instr
{ {
sp_instr_copen(const sp_instr_copen &); /* Prevent use of these */ sp_instr_copen(const sp_instr_copen &); /**< Prevent use of these */
void operator=(sp_instr_copen &); void operator=(sp_instr_copen &);
public: public:
...@@ -1172,14 +1183,14 @@ class sp_instr_copen : public sp_instr ...@@ -1172,14 +1183,14 @@ class sp_instr_copen : public sp_instr
private: private:
uint m_cursor; // Stack index uint m_cursor; ///< Stack index
}; // class sp_instr_copen : public sp_instr_stmt }; // class sp_instr_copen : public sp_instr_stmt
class sp_instr_cclose : public sp_instr class sp_instr_cclose : public sp_instr
{ {
sp_instr_cclose(const sp_instr_cclose &); /* Prevent use of these */ sp_instr_cclose(const sp_instr_cclose &); /**< Prevent use of these */
void operator=(sp_instr_cclose &); void operator=(sp_instr_cclose &);
public: public:
...@@ -1204,7 +1215,7 @@ class sp_instr_cclose : public sp_instr ...@@ -1204,7 +1215,7 @@ class sp_instr_cclose : public sp_instr
class sp_instr_cfetch : public sp_instr class sp_instr_cfetch : public sp_instr
{ {
sp_instr_cfetch(const sp_instr_cfetch &); /* Prevent use of these */ sp_instr_cfetch(const sp_instr_cfetch &); /**< Prevent use of these */
void operator=(sp_instr_cfetch &); void operator=(sp_instr_cfetch &);
public: public:
...@@ -1237,7 +1248,7 @@ class sp_instr_cfetch : public sp_instr ...@@ -1237,7 +1248,7 @@ class sp_instr_cfetch : public sp_instr
class sp_instr_error : public sp_instr class sp_instr_error : public sp_instr
{ {
sp_instr_error(const sp_instr_error &); /* Prevent use of these */ sp_instr_error(const sp_instr_error &); /**< Prevent use of these */
void operator=(sp_instr_error &); void operator=(sp_instr_error &);
public: public:
......
...@@ -66,7 +66,7 @@ struct Query_cache_result; ...@@ -66,7 +66,7 @@ struct Query_cache_result;
class Query_cache; class Query_cache;
/** /**
@brief This class represents a node in the linked chain of queries This class represents a node in the linked chain of queries
belonging to one table. belonging to one table.
@note The root of this linked list is not a query-type block, but the table- @note The root of this linked list is not a query-type block, but the table-
......
...@@ -77,10 +77,10 @@ typedef struct st_user_var_events ...@@ -77,10 +77,10 @@ typedef struct st_user_var_events
was actually changed or not. was actually changed or not.
*/ */
typedef struct st_copy_info { typedef struct st_copy_info {
ha_rows records; /* Number of processed records */ ha_rows records; /**< Number of processed records */
ha_rows deleted; /* Number of deleted records */ ha_rows deleted; /**< Number of deleted records */
ha_rows updated; /* Number of updated records */ ha_rows updated; /**< Number of updated records */
ha_rows copied; /* Number of copied records */ ha_rows copied; /**< Number of copied records */
ha_rows error_count; ha_rows error_count;
ha_rows touched; /* Number of touched records */ ha_rows touched; /* Number of touched records */
enum enum_duplicates handle_duplicates; enum enum_duplicates handle_duplicates;
...@@ -1045,14 +1045,17 @@ class THD :public Statement, ...@@ -1045,14 +1045,17 @@ class THD :public Statement,
*/ */
char *catalog; char *catalog;
/* /**
WARNING: some members of THD (currently 'Statement::db', @note
Some members of THD (currently 'Statement::db',
'catalog' and 'query') are set and alloced by the slave SQL thread 'catalog' and 'query') are set and alloced by the slave SQL thread
(for the THD of that thread); that thread is (and must remain, for now) (for the THD of that thread); that thread is (and must remain, for now)
the only responsible for freeing these 3 members. If you add members the only responsible for freeing these 3 members. If you add members
here, and you add code to set them in replication, don't forget to here, and you add code to set them in replication, don't forget to
free_them_and_set_them_to_0 in replication properly. For details see free_them_and_set_them_to_0 in replication properly. For details see
the 'err:' label of the handle_slave_sql() in sql/slave.cc. the 'err:' label of the handle_slave_sql() in sql/slave.cc.
@see handle_slave_sql
*/ */
Security_context main_security_ctx; Security_context main_security_ctx;
......
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
#pragma interface /* gcc class interface */ #pragma interface /* gcc class interface */
#endif #endif
/* /**
@file
Declarations for implementation of server side cursors. Only Declarations for implementation of server side cursors. Only
read-only non-scrollable cursors are currently implemented. read-only non-scrollable cursors are currently implemented.
*/ */
/* /**
Server_side_cursor -- an interface for materialized and Server_side_cursor -- an interface for materialized and
sensitive (non-materialized) implementation of cursors. All sensitive (non-materialized) implementation of cursors. All
cursors are self-contained (created in their own memory root). cursors are self-contained (created in their own memory root).
...@@ -36,7 +38,7 @@ ...@@ -36,7 +38,7 @@
class Server_side_cursor: protected Query_arena, public Sql_alloc class Server_side_cursor: protected Query_arena, public Sql_alloc
{ {
protected: protected:
/* Row destination used for fetch */ /** Row destination used for fetch */
select_result *result; select_result *result;
public: public:
Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg) Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg)
...@@ -58,8 +60,7 @@ int mysql_open_cursor(THD *thd, uint flags, ...@@ -58,8 +60,7 @@ int mysql_open_cursor(THD *thd, uint flags,
select_result *result, select_result *result,
Server_side_cursor **res); Server_side_cursor **res);
/* Possible values for flags */ /** Possible values for flags */
enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 }; enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 };
#endif /* _sql_cusor_h_ */ #endif /* _sql_cusor_h_ */
...@@ -14,7 +14,12 @@ ...@@ -14,7 +14,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* classes to use when handling where clause */ /**
@file
@brief
classes to use when handling where clause
*/
#ifdef USE_PRAGMA_INTERFACE #ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
...@@ -25,12 +30,12 @@ ...@@ -25,12 +30,12 @@
typedef struct keyuse_t { typedef struct keyuse_t {
TABLE *table; TABLE *table;
Item *val; /* or value if no field */ Item *val; /**< or value if no field */
table_map used_tables; table_map used_tables;
uint key, keypart, optimize; uint key, keypart, optimize;
key_part_map keypart_map; key_part_map keypart_map;
ha_rows ref_table_rows; ha_rows ref_table_rows;
/* /**
If true, the comparison this value was created from will not be If true, the comparison this value was created from will not be
satisfied if val has NULL 'value'. satisfied if val has NULL 'value'.
*/ */
...@@ -53,13 +58,13 @@ class store_key; ...@@ -53,13 +58,13 @@ class store_key;
typedef struct st_table_ref typedef struct st_table_ref
{ {
bool key_err; bool key_err;
uint key_parts; // num of ... uint key_parts; ///< num of ...
uint key_length; // length of key_buff uint key_length; ///< length of key_buff
int key; // key no int key; ///< key no
uchar *key_buff; // value to look for with key uchar *key_buff; ///< value to look for with key
uchar *key_buff2; // key_buff+key_length uchar *key_buff2; ///< key_buff+key_length
store_key **key_copy; // store_key **key_copy; //
Item **items; // val()'s for each keypart Item **items; ///< val()'s for each keypart
/* /*
Array of pointers to trigger variables. Some/all of the pointers may be Array of pointers to trigger variables. Some/all of the pointers may be
NULL. The ref access can be used iff NULL. The ref access can be used iff
...@@ -72,18 +77,18 @@ typedef struct st_table_ref ...@@ -72,18 +77,18 @@ typedef struct st_table_ref
underlying conditions is switched off (see subquery code for more details) underlying conditions is switched off (see subquery code for more details)
*/ */
bool **cond_guards; bool **cond_guards;
/* /**
(null_rejecting & (1<<i)) means the condition is '=' and no matching (null_rejecting & (1<<i)) means the condition is '=' and no matching
rows will be produced if items[i] IS NULL (see add_not_null_conds()) rows will be produced if items[i] IS NULL (see add_not_null_conds())
*/ */
key_part_map null_rejecting; key_part_map null_rejecting;
table_map depend_map; // Table depends on these tables. table_map depend_map; ///< Table depends on these tables.
/* null byte position in the key_buf. Used for REF_OR_NULL optimization */ /* null byte position in the key_buf. Used for REF_OR_NULL optimization */
uchar *null_ref_key; uchar *null_ref_key;
} TABLE_REF; } TABLE_REF;
/* /**
CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer CACHE_FIELD and JOIN_CACHE is used on full join to cache records in outer
table table
*/ */
...@@ -136,18 +141,18 @@ Next_select_func setup_end_select_func(JOIN *join); ...@@ -136,18 +141,18 @@ Next_select_func setup_end_select_func(JOIN *join);
typedef struct st_join_table { typedef struct st_join_table {
st_join_table() {} /* Remove gcc warning */ st_join_table() {} /* Remove gcc warning */
TABLE *table; TABLE *table;
KEYUSE *keyuse; /* pointer to first used key */ KEYUSE *keyuse; /**< pointer to first used key */
SQL_SELECT *select; SQL_SELECT *select;
COND *select_cond; COND *select_cond;
QUICK_SELECT_I *quick; QUICK_SELECT_I *quick;
Item **on_expr_ref; /* pointer to the associated on expression */ Item **on_expr_ref; /**< pointer to the associated on expression */
COND_EQUAL *cond_equal; /* multiple equalities for the on expression */ COND_EQUAL *cond_equal; /**< multiple equalities for the on expression */
st_join_table *first_inner; /* first inner table for including outerjoin */ st_join_table *first_inner; /**< first inner table for including outerjoin */
bool found; /* true after all matches or null complement */ bool found; /**< true after all matches or null complement */
bool not_null_compl;/* true before null complement is added */ bool not_null_compl;/**< true before null complement is added */
st_join_table *last_inner; /* last table table for embedding outer join */ st_join_table *last_inner; /**< last table table for embedding outer join */
st_join_table *first_upper; /* first inner table for embedding outer join */ st_join_table *first_upper; /**< first inner table for embedding outer join */
st_join_table *first_unmatched; /* used for optimization purposes only */ st_join_table *first_unmatched; /**< used for optimization purposes only */
/* Special content for EXPLAIN 'Extra' column or NULL if none */ /* Special content for EXPLAIN 'Extra' column or NULL if none */
const char *info; const char *info;
...@@ -168,10 +173,10 @@ typedef struct st_join_table { ...@@ -168,10 +173,10 @@ typedef struct st_join_table {
Read_record_func save_read_first_record;/* to save read_first_record */ Read_record_func save_read_first_record;/* to save read_first_record */
int (*save_read_record) (READ_RECORD *);/* to save read_record.read_record */ int (*save_read_record) (READ_RECORD *);/* to save read_record.read_record */
double worst_seeks; double worst_seeks;
key_map const_keys; /* Keys with constant part */ key_map const_keys; /**< Keys with constant part */
key_map checked_keys; /* Keys checked in find_best */ key_map checked_keys; /**< Keys checked in find_best */
key_map needed_reg; key_map needed_reg;
key_map keys; /* all keys with can be used */ key_map keys; /**< all keys with can be used */
/* Either #rows in the table or 1 for const table. */ /* Either #rows in the table or 1 for const table. */
ha_rows records; ha_rows records;
...@@ -189,7 +194,7 @@ typedef struct st_join_table { ...@@ -189,7 +194,7 @@ typedef struct st_join_table {
table_map dependent,key_dependent; table_map dependent,key_dependent;
uint use_quick,index; uint use_quick,index;
uint status; // Save status for cache uint status; ///< Save status for cache
uint used_fields,used_fieldlength,used_blobs; uint used_fields,used_fieldlength,used_blobs;
enum join_type type; enum join_type type;
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct; bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
...@@ -203,7 +208,7 @@ typedef struct st_join_table { ...@@ -203,7 +208,7 @@ typedef struct st_join_table {
TABLE_REF ref; TABLE_REF ref;
JOIN_CACHE cache; JOIN_CACHE cache;
JOIN *join; JOIN *join;
/* Bitmap of nested joins this table is part of */ /** Bitmap of nested joins this table is part of */
nested_join_map embedding_map; nested_join_map embedding_map;
void cleanup(); void cleanup();
...@@ -220,7 +225,7 @@ enum_nested_loop_state sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool ...@@ -220,7 +225,7 @@ enum_nested_loop_state sub_select_cache(JOIN *join, JOIN_TAB *join_tab, bool
enum_nested_loop_state sub_select(JOIN *join,JOIN_TAB *join_tab, bool enum_nested_loop_state sub_select(JOIN *join,JOIN_TAB *join_tab, bool
end_of_records); end_of_records);
/* /**
Information about a position of table within a join order. Used in join Information about a position of table within a join order. Used in join
optimization. optimization.
*/ */
...@@ -264,25 +269,25 @@ typedef struct st_rollup ...@@ -264,25 +269,25 @@ typedef struct st_rollup
class JOIN :public Sql_alloc class JOIN :public Sql_alloc
{ {
JOIN(const JOIN &rhs); /* not implemented */ JOIN(const JOIN &rhs); /**< not implemented */
JOIN& operator=(const JOIN &rhs); /* not implemented */ JOIN& operator=(const JOIN &rhs); /**< not implemented */
public: public:
JOIN_TAB *join_tab,**best_ref; JOIN_TAB *join_tab,**best_ref;
JOIN_TAB **map2table; // mapping between table indexes and JOIN_TABs JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs
JOIN_TAB *join_tab_save; // saved join_tab for subquery reexecution JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution
TABLE **table,**all_tables,*sort_by_table; TABLE **table,**all_tables,*sort_by_table;
uint tables,const_tables; uint tables,const_tables;
uint send_group_parts; uint send_group_parts;
bool sort_and_group,first_record,full_join,group, no_field_update; bool sort_and_group,first_record,full_join,group, no_field_update;
bool do_send_rows; bool do_send_rows;
/* /**
TRUE when we want to resume nested loop iterations when TRUE when we want to resume nested loop iterations when
fetching data from a cursor fetching data from a cursor
*/ */
bool resume_nested_loop; bool resume_nested_loop;
table_map const_table_map,found_const_table_map,outer_join; table_map const_table_map,found_const_table_map,outer_join;
ha_rows send_records,found_records,examined_rows,row_limit, select_limit; ha_rows send_records,found_records,examined_rows,row_limit, select_limit;
/* /**
Used to fetch no more than given amount of rows per one Used to fetch no more than given amount of rows per one
fetch operation of server side cursor. fetch operation of server side cursor.
The value is checked in end_send and end_send_group in fashion, similar The value is checked in end_send and end_send_group in fashion, similar
...@@ -294,7 +299,7 @@ class JOIN :public Sql_alloc ...@@ -294,7 +299,7 @@ class JOIN :public Sql_alloc
ha_rows fetch_limit; ha_rows fetch_limit;
POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1]; POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1];
/* /* *
Bitmap of nested joins embedding the position at the end of the current Bitmap of nested joins embedding the position at the end of the current
partial join (valid only during join optimizer run). partial join (valid only during join optimizer run).
*/ */
...@@ -304,25 +309,25 @@ class JOIN :public Sql_alloc ...@@ -304,25 +309,25 @@ class JOIN :public Sql_alloc
List<Item> *fields; List<Item> *fields;
List<Cached_item> group_fields, group_fields_cache; List<Cached_item> group_fields, group_fields_cache;
TABLE *tmp_table; TABLE *tmp_table;
// used to store 2 possible tmp table of SELECT /// used to store 2 possible tmp table of SELECT
TABLE *exec_tmp_table1, *exec_tmp_table2; TABLE *exec_tmp_table1, *exec_tmp_table2;
THD *thd; THD *thd;
Item_sum **sum_funcs, ***sum_funcs_end; Item_sum **sum_funcs, ***sum_funcs_end;
/* second copy of sumfuncs (for queries with 2 temporary tables */ /** second copy of sumfuncs (for queries with 2 temporary tables */
Item_sum **sum_funcs2, ***sum_funcs_end2; Item_sum **sum_funcs2, ***sum_funcs_end2;
Procedure *procedure; Procedure *procedure;
Item *having; Item *having;
Item *tmp_having; // To store having when processed temporary table Item *tmp_having; ///< To store having when processed temporary table
Item *having_history; // Store having for explain Item *having_history; ///< Store having for explain
ulonglong select_options; ulonglong select_options;
select_result *result; select_result *result;
TMP_TABLE_PARAM tmp_table_param; TMP_TABLE_PARAM tmp_table_param;
MYSQL_LOCK *lock; MYSQL_LOCK *lock;
// unit structure (with global parameters) for this select /// unit structure (with global parameters) for this select
SELECT_LEX_UNIT *unit; SELECT_LEX_UNIT *unit;
// select that processed /// select that processed
SELECT_LEX *select_lex; SELECT_LEX *select_lex;
/* /**
TRUE <=> optimizer must not mark any table as a constant table. TRUE <=> optimizer must not mark any table as a constant table.
This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..): This is needed for subqueries in form "a IN (SELECT .. UNION SELECT ..):
when we optimize the select that reads the results of the union from a when we optimize the select that reads the results of the union from a
...@@ -331,11 +336,11 @@ class JOIN :public Sql_alloc ...@@ -331,11 +336,11 @@ class JOIN :public Sql_alloc
*/ */
bool no_const_tables; bool no_const_tables;
JOIN *tmp_join; // copy of this JOIN to be used with temporary tables JOIN *tmp_join; ///< copy of this JOIN to be used with temporary tables
ROLLUP rollup; // Used with rollup ROLLUP rollup; ///< Used with rollup
bool select_distinct; // Set if SELECT DISTINCT bool select_distinct; ///< Set if SELECT DISTINCT
/* /**
If we have the GROUP BY statement in the query, If we have the GROUP BY statement in the query,
but the group_list was emptied by optimizer, this but the group_list was emptied by optimizer, this
flag is TRUE. flag is TRUE.
...@@ -350,42 +355,42 @@ class JOIN :public Sql_alloc ...@@ -350,42 +355,42 @@ class JOIN :public Sql_alloc
It's also set if ORDER/GROUP BY is empty. It's also set if ORDER/GROUP BY is empty.
*/ */
bool simple_order, simple_group; bool simple_order, simple_group;
/* /**
Is set only in case if we have a GROUP BY clause Is set only in case if we have a GROUP BY clause
and no ORDER BY after constant elimination of 'order'. and no ORDER BY after constant elimination of 'order'.
*/ */
bool no_order; bool no_order;
/* Is set if we have a GROUP BY and we have ORDER BY on a constant. */ /** Is set if we have a GROUP BY and we have ORDER BY on a constant. */
bool skip_sort_order; bool skip_sort_order;
bool need_tmp, hidden_group_fields; bool need_tmp, hidden_group_fields;
DYNAMIC_ARRAY keyuse; DYNAMIC_ARRAY keyuse;
Item::cond_result cond_value, having_value; Item::cond_result cond_value, having_value;
List<Item> all_fields; // to store all fields that used in query List<Item> all_fields; ///< to store all fields that used in query
//Above list changed to use temporary table ///Above list changed to use temporary table
List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3; List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3;
//Part, shared with list above, emulate following list ///Part, shared with list above, emulate following list
List<Item> tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; List<Item> tmp_fields_list1, tmp_fields_list2, tmp_fields_list3;
List<Item> &fields_list; // hold field list passed to mysql_select List<Item> &fields_list; ///< hold field list passed to mysql_select
List<Item> procedure_fields_list; List<Item> procedure_fields_list;
int error; int error;
ORDER *order, *group_list, *proc_param; //hold parameters of mysql_select ORDER *order, *group_list, *proc_param; //hold parameters of mysql_select
COND *conds; // ---"--- COND *conds; // ---"---
Item *conds_history; // store WHERE for explain Item *conds_history; // store WHERE for explain
TABLE_LIST *tables_list; //hold 'tables' parameter of mysql_select TABLE_LIST *tables_list; ///<hold 'tables' parameter of mysql_select
List<TABLE_LIST> *join_list; // list of joined tables in reverse order List<TABLE_LIST> *join_list; ///< list of joined tables in reverse order
COND_EQUAL *cond_equal; COND_EQUAL *cond_equal;
SQL_SELECT *select; //created in optimisation phase SQL_SELECT *select; ///<created in optimisation phase
JOIN_TAB *return_tab; //used only for outer joins JOIN_TAB *return_tab; ///<used only for outer joins
Item **ref_pointer_array; //used pointer reference for this select Item **ref_pointer_array; ///<used pointer reference for this select
// Copy of above to be used with different lists // Copy of above to be used with different lists
Item **items0, **items1, **items2, **items3, **current_ref_pointer_array; Item **items0, **items1, **items2, **items3, **current_ref_pointer_array;
uint ref_pointer_array_size; // size of above in bytes uint ref_pointer_array_size; ///< size of above in bytes
const char *zero_result_cause; // not 0 if exec must return zero result const char *zero_result_cause; ///< not 0 if exec must return zero result
bool union_part; // this subselect is part of union bool union_part; ///< this subselect is part of union
bool optimized; // flag to avoid double optimization in EXPLAIN bool optimized; ///< flag to avoid double optimization in EXPLAIN
/* /*
storage for caching buffers allocated during query execution. storage for caching buffers allocated during query execution.
...@@ -494,14 +499,14 @@ class JOIN :public Sql_alloc ...@@ -494,14 +499,14 @@ class JOIN :public Sql_alloc
int rollup_send_data(uint idx); int rollup_send_data(uint idx);
int rollup_write_data(uint idx, TABLE *table); int rollup_write_data(uint idx, TABLE *table);
void remove_subq_pushed_predicates(Item **where); void remove_subq_pushed_predicates(Item **where);
/* /**
Release memory and, if possible, the open tables held by this execution Release memory and, if possible, the open tables held by this execution
plan (and nested plans). It's used to release some tables before plan (and nested plans). It's used to release some tables before
the end of execution in order to increase concurrency and reduce the end of execution in order to increase concurrency and reduce
memory consumption. memory consumption.
*/ */
void join_free(); void join_free();
/* Cleanup this JOIN, possibly for reuse */ /** Cleanup this JOIN, possibly for reuse */
void cleanup(bool full); void cleanup(bool full);
void clear(); void clear();
bool save_join_tab(); bool save_join_tab();
...@@ -556,7 +561,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds); ...@@ -556,7 +561,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds);
/* from sql_delete.cc, used by opt_range.cc */ /* from sql_delete.cc, used by opt_range.cc */
extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b); extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b);
/* class to copying an field/item to a key struct */ /** class to copying an field/item to a key struct */
class store_key :public Sql_alloc class store_key :public Sql_alloc
{ {
...@@ -578,7 +583,7 @@ class store_key :public Sql_alloc ...@@ -578,7 +583,7 @@ class store_key :public Sql_alloc
to_field=field_arg->new_key_field(thd->mem_root, field_arg->table, to_field=field_arg->new_key_field(thd->mem_root, field_arg->table,
ptr, null, 1); ptr, null, 1);
} }
virtual ~store_key() {} /* Not actually needed */ virtual ~store_key() {} /** Not actually needed */
virtual const char *name() const=0; virtual const char *name() const=0;
/** /**
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* /**
This class holds all information about triggers of table. This class holds all information about triggers of table.
QQ: Will it be merged into TABLE in the future ? QQ: Will it be merged into TABLE in the future ?
...@@ -22,20 +22,20 @@ ...@@ -22,20 +22,20 @@
class Table_triggers_list: public Sql_alloc class Table_triggers_list: public Sql_alloc
{ {
/* Triggers as SPs grouped by event, action_time */ /** Triggers as SPs grouped by event, action_time */
sp_head *bodies[TRG_EVENT_MAX][TRG_ACTION_MAX]; sp_head *bodies[TRG_EVENT_MAX][TRG_ACTION_MAX];
/* /**
Heads of the lists linking items for all fields used in triggers Heads of the lists linking items for all fields used in triggers
grouped by event and action_time. grouped by event and action_time.
*/ */
Item_trigger_field *trigger_fields[TRG_EVENT_MAX][TRG_ACTION_MAX]; Item_trigger_field *trigger_fields[TRG_EVENT_MAX][TRG_ACTION_MAX];
/* /**
Copy of TABLE::Field array with field pointers set to TABLE::record[1] Copy of TABLE::Field array with field pointers set to TABLE::record[1]
buffer instead of TABLE::record[0] (used for OLD values in on UPDATE buffer instead of TABLE::record[0] (used for OLD values in on UPDATE
trigger and DELETE trigger when it is called for REPLACE). trigger and DELETE trigger when it is called for REPLACE).
*/ */
Field **record1_field; Field **record1_field;
/* /**
During execution of trigger new_field and old_field should point to the During execution of trigger new_field and old_field should point to the
array of fields representing new or old version of row correspondingly array of fields representing new or old version of row correspondingly
(so it can point to TABLE::field or to Tale_triggers_list::record1_field) (so it can point to TABLE::field or to Tale_triggers_list::record1_field)
...@@ -45,30 +45,30 @@ class Table_triggers_list: public Sql_alloc ...@@ -45,30 +45,30 @@ class Table_triggers_list: public Sql_alloc
/* TABLE instance for which this triggers list object was created */ /* TABLE instance for which this triggers list object was created */
TABLE *trigger_table; TABLE *trigger_table;
/* /**
Names of triggers. Names of triggers.
Should correspond to order of triggers on definitions_list, Should correspond to order of triggers on definitions_list,
used in CREATE/DROP TRIGGER for looking up trigger by name. used in CREATE/DROP TRIGGER for looking up trigger by name.
*/ */
List<LEX_STRING> names_list; List<LEX_STRING> names_list;
/* /**
List of "ON table_name" parts in trigger definitions, used for List of "ON table_name" parts in trigger definitions, used for
updating trigger definitions during RENAME TABLE. updating trigger definitions during RENAME TABLE.
*/ */
List<LEX_STRING> on_table_names_list; List<LEX_STRING> on_table_names_list;
/* /**
Grant information for each trigger (pair: subject table, trigger definer). Grant information for each trigger (pair: subject table, trigger definer).
*/ */
GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX]; GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX];
public: public:
/* /**
Field responsible for storing triggers definitions in file. Field responsible for storing triggers definitions in file.
It have to be public because we are using it directly from parser. It have to be public because we are using it directly from parser.
*/ */
List<LEX_STRING> definitions_list; List<LEX_STRING> definitions_list;
/* /**
List of sql modes for triggers List of sql modes for triggers
*/ */
List<ulonglong> definition_modes_list; List<ulonglong> definition_modes_list;
......
...@@ -209,7 +209,7 @@ typedef struct user_conn { ...@@ -209,7 +209,7 @@ typedef struct user_conn {
char *user; char *user;
/* Pointer to host part of the key. */ /* Pointer to host part of the key. */
char *host; char *host;
/* /**
The moment of time when per hour counters were reset last time The moment of time when per hour counters were reset last time
(i.e. start of "hour" for conn_per_hour, updates, questions counters). (i.e. start of "hour" for conn_per_hour, updates, questions counters).
*/ */
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#if !defined(TESTTIME) && !defined(TZINFO2SQL) #if !defined(TESTTIME) && !defined(TZINFO2SQL)
/* /**
This class represents abstract time zone and provides This class represents abstract time zone and provides
basic interface for MYSQL_TIME <-> my_time_t conversion. basic interface for MYSQL_TIME <-> my_time_t conversion.
Actual time zones which are specified by DB, or via offset Actual time zones which are specified by DB, or via offset
...@@ -30,7 +30,7 @@ class Time_zone: public Sql_alloc ...@@ -30,7 +30,7 @@ class Time_zone: public Sql_alloc
{ {
public: public:
Time_zone() {} /* Remove gcc warning */ Time_zone() {} /* Remove gcc warning */
/* /**
Converts local time in broken down MYSQL_TIME representation to Converts local time in broken down MYSQL_TIME representation to
my_time_t (UTC seconds since Epoch) represenation. my_time_t (UTC seconds since Epoch) represenation.
Returns 0 in case of error. Sets in_dst_time_gap to true if date provided Returns 0 in case of error. Sets in_dst_time_gap to true if date provided
...@@ -38,19 +38,19 @@ class Time_zone: public Sql_alloc ...@@ -38,19 +38,19 @@ class Time_zone: public Sql_alloc
*/ */
virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t, virtual my_time_t TIME_to_gmt_sec(const MYSQL_TIME *t,
my_bool *in_dst_time_gap) const = 0; my_bool *in_dst_time_gap) const = 0;
/* /**
Converts time in my_time_t representation to local time in Converts time in my_time_t representation to local time in
broken down MYSQL_TIME representation. broken down MYSQL_TIME representation.
*/ */
virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0; virtual void gmt_sec_to_TIME(MYSQL_TIME *tmp, my_time_t t) const = 0;
/* /**
Because of constness of String returned by get_name() time zone name Because of constness of String returned by get_name() time zone name
have to be already zeroended to be able to use String::ptr() instead have to be already zeroended to be able to use String::ptr() instead
of c_ptr(). of c_ptr().
*/ */
virtual const String * get_name() const = 0; virtual const String * get_name() const = 0;
/* /**
We need this only for surpressing warnings, objects of this type are We need this only for surpressing warnings, objects of this type are
allocated on MEM_ROOT and should not require destruction. allocated on MEM_ROOT and should not require destruction.
*/ */
...@@ -65,7 +65,7 @@ extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool ...@@ -65,7 +65,7 @@ extern my_bool my_tz_init(THD *org_thd, const char *default_tzname, my_bool
extern void my_tz_free(); extern void my_tz_free();
extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t); extern my_time_t sec_since_epoch_TIME(MYSQL_TIME *t);
/* /**
Number of elements in table list produced by my_tz_get_table_list() Number of elements in table list produced by my_tz_get_table_list()
(this table list contains tables which are needed for dynamical loading (this table list contains tables which are needed for dynamical loading
of time zone descriptions). Actually it is imlementation detail that of time zone descriptions). Actually it is imlementation detail that
......
...@@ -155,34 +155,34 @@ ...@@ -155,34 +155,34 @@
#define OPEN_VIEW 8192 /* Allow open on view */ #define OPEN_VIEW 8192 /* Allow open on view */
#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view, #define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
but do not parse view itself */ but do not parse view itself */
/* /**
This flag is used in function get_all_tables() which fills This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to open FRM file only to get necessary data. The flag means that we need to open FRM file only to get necessary data.
*/ */
#define OPEN_FRM_FILE_ONLY 32768 #define OPEN_FRM_FILE_ONLY 32768
/* /**
This flag is used in function get_all_tables() which fills This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process tables only to get necessary data. The flag means that we need to process tables only to get necessary data.
Views are not processed. Views are not processed.
*/ */
#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2 #define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2
/* /**
This flag is used in function get_all_tables() which fills This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine I_S tables with data which are retrieved from frm files and storage engine
The flag means that we need to process views only to get necessary data. The flag means that we need to process views only to get necessary data.
Tables are not processed. Tables are not processed.
*/ */
#define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2 #define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2
/* /**
This flag is used in function get_all_tables() which fills This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine. I_S tables with data which are retrieved from frm files and storage engine.
The flag means that we need to open a view using The flag means that we need to open a view using
open_normal_and_derived_tables() function. open_normal_and_derived_tables() function.
*/ */
#define OPEN_VIEW_FULL OPEN_VIEW_ONLY*2 #define OPEN_VIEW_FULL OPEN_VIEW_ONLY*2
/* /**
This flag is used in function get_all_tables() which fills This flag is used in function get_all_tables() which fills
I_S tables with data which are retrieved from frm files and storage engine. I_S tables with data which are retrieved from frm files and storage engine.
The flag means that I_S table uses optimization algorithm. The flag means that I_S table uses optimization algorithm.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment