~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.h

Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mkel <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLE_SERVER_SQL_PARSE_H
21
 
#define DRIZZLE_SERVER_SQL_PARSE_H
22
 
 
23
 
#include <stdint.h>
24
 
 
25
 
#include <drizzled/definitions.h>
26
 
#include <drizzled/common.h>
27
 
#include <drizzled/lex_string.h>
28
 
#include <drizzled/comp_creator.h>
29
 
 
30
 
#include <mystrings/m_ctype.h>
 
20
#ifndef DRIZZLED_SQL_PARSE_H
 
21
#define DRIZZLED_SQL_PARSE_H
 
22
 
 
23
#include "drizzled/definitions.h"
 
24
#include "drizzled/common.h"
 
25
#include "drizzled/lex_string.h"
 
26
#include "drizzled/comp_creator.h"
 
27
#include "drizzled/identifier.h"
 
28
 
 
29
namespace drizzled
 
30
{
31
31
 
32
32
class Session;
33
33
class TableList;
35
35
class Item;
36
36
class LEX;
37
37
class Table_ident;
38
 
 
39
 
typedef class st_select_lex SELECT_LEX;
40
 
 
41
 
bool begin_trans(Session *session);
42
 
bool end_active_trans(Session *session);
43
 
int end_trans(Session *session, enum enum_mysql_completiontype completion);
 
38
class Select_Lex;
 
39
 
 
40
typedef struct charset_info_st CHARSET_INFO;
 
41
 
 
42
extern const LEX_STRING command_name[];
44
43
 
45
44
bool execute_sqlcom_select(Session *session, TableList *all_tables);
46
 
bool multi_update_precheck(Session *session, TableList *tables);
47
 
bool multi_delete_precheck(Session *session, TableList *tables);
48
 
int mysql_multi_update_prepare(Session *session);
49
 
int mysql_multi_delete_prepare(Session *session);
50
45
bool mysql_insert_select_prepare(Session *session);
51
46
bool update_precheck(Session *session, TableList *tables);
52
47
bool delete_precheck(Session *session, TableList *tables);
53
48
bool insert_precheck(Session *session, TableList *tables);
54
 
bool create_table_precheck(Session *session, TableList *tables,
55
 
                           TableList *create_table);
56
 
bool parse_sql(Session *session, Lex_input_stream *lip);
 
49
bool create_table_precheck(TableIdentifier &identifier);
57
50
 
58
51
Item *negate_expression(Session *session, Item *expr);
59
52
 
60
 
bool test_if_data_home_dir(const char *dir);
61
 
 
62
53
bool check_identifier_name(LEX_STRING *str, uint32_t err_code= 0,
63
54
                           uint32_t max_char_length= NAME_CHAR_LEN,
64
55
                           const char *param_for_err_msg= "");
70
61
                              bool no_error);
71
62
 
72
63
 
73
 
void mysql_parse(Session *session, const char *inBuf, uint32_t length,
74
 
                 const char ** semicolon);
75
 
 
76
64
bool mysql_test_parse_for_slave(Session *session, char *inBuf,
77
65
                                uint32_t length);
78
66
 
79
 
bool is_update_query(enum enum_sql_command command);
80
 
 
81
 
bool alloc_query(Session *session, const char *packet, uint32_t packet_length);
82
 
 
83
67
void mysql_reset_session_for_next_command(Session *session);
84
68
 
85
69
void create_select_for_variable(const char *var_name);
86
70
 
87
 
void mysql_init_multi_delete(LEX *lex);
88
 
 
89
 
bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
90
 
 
91
71
void init_update_queries(void);
92
72
 
93
 
bool do_command(Session *session);
94
 
 
95
73
bool dispatch_command(enum enum_server_command command, Session *session,
96
74
                      char* packet, uint32_t packet_length);
97
75
 
98
 
void log_slow_statement(Session *session);
99
 
 
100
 
bool append_file_to_dir(Session *session, const char **filename_ptr,
101
 
                        const char *table_name);
102
 
 
103
 
bool reload_cache(Session *session, ulong options, TableList *tables,
104
 
                  bool *write_to_binlog);
105
 
 
106
76
bool check_simple_select();
107
77
 
108
78
void mysql_init_select(LEX *lex);
109
79
bool mysql_new_select(LEX *lex, bool move_down);
110
80
 
111
 
int prepare_schema_table(Session *session, LEX *lex, Table_ident *table_ident,
112
 
                         enum enum_schema_tables schema_table_idx);
 
81
int prepare_new_schema_table(Session *session, LEX *lex,
 
82
                             const std::string& schema_table_name);
113
83
 
114
84
Item * all_any_subquery_creator(Item *left_expr,
115
85
                                chooser_compare_func_creator cmp,
116
86
                                bool all,
117
 
                                SELECT_LEX *select_lex);
118
 
 
119
 
#endif /* DRIZZLE_SERVER_SQL_PARSE_H */
 
87
                                Select_Lex *select_lex);
 
88
 
 
89
void sql_kill(Session *session, int64_t id, bool only_kill_query);
 
90
char* query_table_status(Session *session,const char *db,const char *table_name);
 
91
 
 
92
} /* namespace drizzled */
 
93
 
 
94
#endif /* DRIZZLED_SQL_PARSE_H */