~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.h

Merge of Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000-2003 MySQL AB
2
 
 
3
 
   This program is free software; you can redistribute it and/or modify
4
 
   it under the terms of the GNU General Public License as published by
5
 
   the Free Software Foundation; version 2 of the License.
6
 
 
7
 
   This program is distributed in the hope that it will be useful,
8
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
   GNU General Public License for more details.
11
 
 
12
 
   You should have received a copy of the GNU General Public License
13
 
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
15
19
 
16
20
#ifndef DRIZZLE_SERVER_SQL_PARSE_H
17
21
#define DRIZZLE_SERVER_SQL_PARSE_H
18
22
 
19
 
bool begin_trans(THD *thd);
20
 
bool end_active_trans(THD *thd);
21
 
int end_trans(THD *thd, enum enum_mysql_completiontype completion);
22
 
 
23
 
bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
24
 
bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
25
 
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
26
 
int mysql_multi_update_prepare(THD *thd);
27
 
int mysql_multi_delete_prepare(THD *thd);
28
 
bool mysql_insert_select_prepare(THD *thd);
29
 
bool update_precheck(THD *thd, TABLE_LIST *tables);
30
 
bool delete_precheck(THD *thd, TABLE_LIST *tables);
31
 
bool insert_precheck(THD *thd, TABLE_LIST *tables);
32
 
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
33
 
                           TABLE_LIST *create_table);
34
 
bool parse_sql(THD *thd, class Lex_input_stream *lip);
35
 
 
36
 
Item *negate_expression(THD *thd, Item *expr);
 
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>
 
31
 
 
32
class Session;
 
33
class TableList;
 
34
class Lex_input_stream;
 
35
class Item;
 
36
class LEX;
 
37
class Table_ident;
 
38
 
 
39
bool execute_sqlcom_select(Session *session, TableList *all_tables);
 
40
bool mysql_insert_select_prepare(Session *session);
 
41
bool update_precheck(Session *session, TableList *tables);
 
42
bool delete_precheck(Session *session, TableList *tables);
 
43
bool insert_precheck(Session *session, TableList *tables);
 
44
bool create_table_precheck(Session *session, TableList *tables,
 
45
                           TableList *create_table);
 
46
bool parse_sql(Session *session, Lex_input_stream *lip);
 
47
 
 
48
Item *negate_expression(Session *session, Item *expr);
37
49
 
38
50
bool test_if_data_home_dir(const char *dir);
39
51
 
40
 
bool check_identifier_name(LEX_STRING *str, uint max_char_length,
41
 
                           uint err_code, const char *param_for_err_msg);
42
 
inline bool check_identifier_name(LEX_STRING *str, uint err_code)
43
 
{
44
 
  return check_identifier_name(str, NAME_CHAR_LEN, err_code, "");
45
 
}
46
 
inline bool check_identifier_name(LEX_STRING *str)
47
 
{
48
 
  return check_identifier_name(str, NAME_CHAR_LEN, 0, "");
49
 
}
 
52
bool check_identifier_name(LEX_STRING *str, uint32_t err_code= 0,
 
53
                           uint32_t max_char_length= NAME_CHAR_LEN,
 
54
                           const char *param_for_err_msg= "");
50
55
 
51
56
bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
52
 
                              uint max_byte_length);
 
57
                              uint32_t max_byte_length);
53
58
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
54
 
                              uint max_char_length, const CHARSET_INFO * const cs,
 
59
                              uint32_t max_char_length, const CHARSET_INFO * const cs,
55
60
                              bool no_error);
56
61
 
 
62
 
 
63
void mysql_parse(Session *session, const char *inBuf, uint32_t length,
 
64
                 const char ** semicolon);
 
65
 
 
66
bool mysql_test_parse_for_slave(Session *session, char *inBuf,
 
67
                                uint32_t length);
 
68
 
 
69
bool is_update_query(enum enum_sql_command command);
 
70
 
 
71
void mysql_reset_session_for_next_command(Session *session);
 
72
 
 
73
void create_select_for_variable(const char *var_name);
 
74
 
 
75
void init_update_queries(void);
 
76
 
 
77
bool dispatch_command(enum enum_server_command command, Session *session,
 
78
                      char* packet, uint32_t packet_length);
 
79
 
 
80
bool check_simple_select();
 
81
 
 
82
void mysql_init_select(LEX *lex);
 
83
bool mysql_new_select(LEX *lex, bool move_down);
 
84
 
 
85
int prepare_schema_table(Session *session, LEX *lex, Table_ident *table_ident,
 
86
                         const std::string& schema_table_name);
 
87
 
 
88
Item * all_any_subquery_creator(Item *left_expr,
 
89
                                chooser_compare_func_creator cmp,
 
90
                                bool all,
 
91
                                Select_Lex *select_lex);
 
92
 
57
93
#endif /* DRIZZLE_SERVER_SQL_PARSE_H */