~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_create.h

  • Committer: Andy Lester
  • Date: 2008-08-10 02:15:48 UTC
  • mto: (266.1.31 use-replace-funcs)
  • mto: This revision was merged to the branch mainline in revision 295.
  • Revision ID: andy@petdance.com-20080810021548-0zx8nhzva6al10k3
Added a proper const qualifer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 */
 
1
/* Copyright (C) 2000-2006 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 */
19
15
 
20
16
/* Functions to create an item. Used by sql/sql_yacc.yy */
21
17
 
41
37
    Given the function name and list or arguments, this method creates
42
38
    an <code>Item</code> that represents the function call.
43
39
    In case or errors, a NULL item is returned, and an error is reported.
44
 
    Note that the <code>session</code> object may be modified by the builder.
 
40
    Note that the <code>thd</code> object may be modified by the builder.
45
41
    In particular, the following members/methods can be set/called,
46
42
    depending on the function called and the function possible side effects.
47
43
    <ul>
48
 
      <li><code>session->lex->binlog_row_based_if_mixed</code></li>
49
 
      <li><code>session->lex->current_context()</code></li>
50
 
      <li><code>session->lex->safe_to_cache_query</code></li>
51
 
      <li><code>session->lex->uncacheable(UNCACHEABLE_SIDEEFFECT)</code></li>
52
 
      <li><code>session->lex->uncacheable(UNCACHEABLE_RAND)</code></li>
53
 
      <li><code>session->lex->add_time_zone_tables_to_query_tables(session)</code></li>
 
44
      <li><code>thd->lex->binlog_row_based_if_mixed</code></li>
 
45
      <li><code>thd->lex->current_context()</code></li>
 
46
      <li><code>thd->lex->safe_to_cache_query</code></li>
 
47
      <li><code>thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT)</code></li>
 
48
      <li><code>thd->lex->uncacheable(UNCACHEABLE_RAND)</code></li>
 
49
      <li><code>thd->lex->add_time_zone_tables_to_query_tables(thd)</code></li>
54
50
    </ul>
55
 
    @param session The current thread
 
51
    @param thd The current thread
56
52
    @param name The function name
57
53
    @param item_list The list of arguments to the function, can be NULL
58
54
    @return An item representing the parsed function call, or NULL
59
55
  */
60
 
  virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list) = 0;
 
56
  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
61
57
 
62
58
protected:
63
59
  /** Constructor */
78
74
  /**
79
75
    The builder create method, for unqualified functions.
80
76
    This builder will use the current database for the database name.
81
 
    @param session The current thread
 
77
    @param thd The current thread
82
78
    @param name The function name
83
79
    @param item_list The list of arguments to the function, can be NULL
84
80
    @return An item representing the parsed function call
85
81
  */
86
 
  virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list);
 
82
  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
87
83
 
88
84
  /**
89
85
    The builder create method, for qualified functions.
90
 
    @param session The current thread
 
86
    @param thd The current thread
91
87
    @param db The database name
92
88
    @param name The function name
93
89
    @param use_explicit_name Should the function be represented as 'db.name'?
94
90
    @param item_list The list of arguments to the function, can be NULL
95
91
    @return An item representing the parsed function call
96
92
  */
97
 
  virtual Item* create(Session *session, LEX_STRING db, LEX_STRING name,
 
93
  virtual Item* create(THD *thd, LEX_STRING db, LEX_STRING name,
98
94
                       bool use_explicit_name, List<Item> *item_list) = 0;
99
95
 
100
96
protected:
107
103
 
108
104
/**
109
105
  Find the native function builder associated with a given function name.
110
 
  @param session The current thread
 
106
  @param thd The current thread
111
107
  @param name The native function name
112
108
  @return The native function builder associated with the name, or NULL
113
109
*/
114
 
extern Create_func * find_native_function_builder(Session *session, LEX_STRING name);
 
110
extern Create_func * find_native_function_builder(THD *thd, LEX_STRING name);
115
111
 
116
112
 
117
113
/**
118
114
  Find the function builder for qualified functions.
119
 
  @param session The current thread
 
115
  @param thd The current thread
120
116
  @return A function builder for qualified functions
121
117
*/
122
 
extern Create_qfunc * find_qualified_function_builder(Session *session);
 
118
extern Create_qfunc * find_qualified_function_builder(THD *thd);
123
119
 
124
120
 
125
121
/**
129
125
class Create_udf_func : public Create_func
130
126
{
131
127
public:
132
 
  virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list);
 
128
  virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
133
129
 
134
130
  /**
135
131
    The builder create method, for User Defined Functions.
136
 
    @param session The current thread
 
132
    @param thd The current thread
137
133
    @param fct The User Defined Function metadata
138
134
    @param item_list The list of arguments to the function, can be NULL
139
135
    @return An item representing the parsed function call
140
136
  */
141
 
  Item *create(Session *session, udf_func *fct, List<Item> *item_list);
 
137
  Item *create(THD *thd, udf_func *fct, List<Item> *item_list);
142
138
 
143
139
  /** Singleton. */
144
140
  static Create_udf_func s_singleton;
151
147
};
152
148
 
153
149
Item*
154
 
create_func_char_cast(Session *session, Item *a, int len, const CHARSET_INFO * const cs);
 
150
create_func_char_cast(THD *thd, Item *a, int len, const CHARSET_INFO * const cs);
155
151
 
156
152
/**
157
153
  Builder for cast expressions.
158
 
  @param session The current thread
 
154
  @param thd The current thread
159
155
  @param a The item to cast
160
156
  @param cast_type the type casted into
161
157
  @param len TODO
163
159
  @param cs The character set
164
160
*/
165
161
Item *
166
 
create_func_cast(Session *session, Item *a, Cast_target cast_type,
 
162
create_func_cast(THD *thd, Item *a, Cast_target cast_type,
167
163
                 const char *len, const char *dec,
168
164
                 const CHARSET_INFO * const cs);
169
165