1
by brian
clean slate |
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 */
|
|
15 |
||
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
16 |
#define DRIZZLE_LEX 1
|
1241.9.36
by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h. |
17 |
#include "config.h" |
1241.9.57
by Monty Taylor
Oy. Bigger change than I normally like - but this stuff is all intertwined. |
18 |
#include <drizzled/my_hash.h> |
549
by Monty Taylor
Took gettext.h out of header files. |
19 |
#include <drizzled/error.h> |
553.1.3
by Monty Taylor
Split out nested_join.h. |
20 |
#include <drizzled/nested_join.h> |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
21 |
#include <drizzled/query_id.h> |
520.8.2
by Monty Taylor
Moved sql_parse.h and sql_error.h out of common_includes. |
22 |
#include <drizzled/sql_parse.h> |
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
23 |
#include <drizzled/data_home.h> |
575.4.7
by Monty Taylor
More header cleanup. |
24 |
#include <drizzled/sql_base.h> |
25 |
#include <drizzled/show.h> |
|
1235.4.23
by Stewart Smith
fix includes for drizzled/db.h. Now only in .cc files, no header files. should make modifying db.h much less painful. |
26 |
#include <drizzled/db.h> |
1130.1.7
by Monty Taylor
Renamed plugin::InfoSchema to plugin::InfoSchemaTable as per Jay. |
27 |
#include <drizzled/plugin/info_schema_table.h> |
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
28 |
#include <drizzled/function/time/unix_timestamp.h> |
29 |
#include <drizzled/function/get_system_var.h> |
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
30 |
#include <drizzled/item/cmpfunc.h> |
642.1.20
by Lee
header file clean up |
31 |
#include <drizzled/item/null.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
32 |
#include <drizzled/session.h> |
33 |
#include <drizzled/sql_load.h> |
|
670.2.4
by Monty Taylor
Removed more stuff from the headers. |
34 |
#include <drizzled/lock.h> |
837
by Brian Aker
Reworked some classes out of session.h |
35 |
#include <drizzled/select_send.h> |
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
36 |
#include <drizzled/plugin/client.h> |
1100.3.30
by Padraig O'Sullivan
Renamed the Command class to be Statement. Renamed the command directory to |
37 |
#include <drizzled/statement.h> |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
38 |
#include <drizzled/statement/alter_table.h> |
1126.10.18
by Padraig O'Sullivan
Various small build fixes for when dtrace is enabled. |
39 |
#include "drizzled/probes.h" |
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
40 |
#include "drizzled/session_list.h" |
1241.9.28
by Monty Taylor
Removed global_charset_info.h from server_includes.h |
41 |
#include "drizzled/global_charset_info.h" |
1273.1.2
by Jay Pipes
This patch does not change any algorithms or code paths, |
42 |
#include "drizzled/transaction_services.h" |
1100.3.1
by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method. |
43 |
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
44 |
#include "drizzled/plugin/logging.h" |
45 |
#include "drizzled/plugin/info_schema_table.h" |
|
1240.7.1
by Padraig O'Sullivan
Created an ExplainPlan class in the optimizer namespace. All printing of an explain in drizzle goes |
46 |
#include "drizzled/optimizer/explain_plan.h" |
1241.9.31
by Monty Taylor
Moved global pthread variables into their own header. |
47 |
#include "drizzled/pthread_globals.h" |
1130.1.1
by Monty Taylor
Merged in plugin-slot-reorg patches. |
48 |
|
1241.9.59
by Monty Taylor
Removed the first mystrings header. |
49 |
#include <limits.h> |
50 |
||
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
51 |
#include <bitset> |
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
52 |
#include <algorithm> |
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
53 |
|
1241.9.64
by Monty Taylor
Moved remaining non-public portions of mysys and mystrings to drizzled/internal. |
54 |
#include "drizzled/internal/my_sys.h" |
1241.9.62
by Monty Taylor
Removed plugin/myisam/myisam.h from session.h |
55 |
|
1130.1.1
by Monty Taylor
Merged in plugin-slot-reorg patches. |
56 |
using namespace drizzled; |
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
57 |
using namespace std; |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
58 |
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
59 |
/* Prototypes */
|
1085.1.2
by Monty Taylor
Fixed -Wmissing-declarations |
60 |
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); |
1165.1.48
by Stewart Smith
make parse_sql static to sql_parse.cc |
61 |
static bool parse_sql(Session *session, Lex_input_stream *lip); |
1165.1.49
by Stewart Smith
make mysql_parse static to sql_parse.cc |
62 |
static void mysql_parse(Session *session, const char *inBuf, uint32_t length, |
63 |
const char ** found_semicolon); |
|
1085.1.2
by Monty Taylor
Fixed -Wmissing-declarations |
64 |
|
1
by brian
clean slate |
65 |
/**
|
66 |
@defgroup Runtime_Environment Runtime Environment
|
|
67 |
@{
|
|
68 |
*/
|
|
69 |
||
629.2.7
by Monty Taylor
Fixed a couple of memory buffer size issues. |
70 |
extern size_t my_thread_stack_size; |
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
71 |
extern const CHARSET_INFO *character_set_filesystem; |
1
by brian
clean slate |
72 |
|
230.1.8
by Monty Taylor
Set length to catch errors in adding or removing COM_* constants. |
73 |
const LEX_STRING command_name[COM_END+1]={ |
1
by brian
clean slate |
74 |
{ C_STRING_WITH_LEN("Sleep") }, |
75 |
{ C_STRING_WITH_LEN("Quit") }, |
|
76 |
{ C_STRING_WITH_LEN("Init DB") }, |
|
77 |
{ C_STRING_WITH_LEN("Query") }, |
|
78 |
{ C_STRING_WITH_LEN("Shutdown") }, |
|
79 |
{ C_STRING_WITH_LEN("Connect") }, |
|
80 |
{ C_STRING_WITH_LEN("Ping") }, |
|
81 |
{ C_STRING_WITH_LEN("Error") } // Last command number |
|
82 |
};
|
|
83 |
||
84 |
const char *xa_state_names[]={ |
|
85 |
"NON-EXISTING", "ACTIVE", "IDLE", "PREPARED" |
|
86 |
};
|
|
87 |
||
88 |
/**
|
|
89 |
Mark all commands that somehow changes a table.
|
|
90 |
||
91 |
This is used to check number of updates / hour.
|
|
92 |
||
93 |
sql_command is actually set to SQLCOM_END sometimes
|
|
94 |
so we need the +1 to include it in the array.
|
|
95 |
||
96 |
See COMMAND_FLAG_xxx for different type of commands
|
|
97 |
2 - query that returns meaningful ROW_COUNT() -
|
|
98 |
a number of modified rows
|
|
99 |
*/
|
|
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
100 |
bitset<CF_BIT_SIZE> sql_command_flags[SQLCOM_END+1]; |
1
by brian
clean slate |
101 |
|
102 |
void init_update_queries(void) |
|
103 |
{
|
|
610
by Brian Aker
Merge of Monty's (plus fix for increment style/useless +1) |
104 |
uint32_t x; |
105 |
||
106 |
for (x= 0; x <= SQLCOM_END; x++) |
|
107 |
sql_command_flags[x].reset(); |
|
1
by brian
clean slate |
108 |
|
109 |
sql_command_flags[SQLCOM_CREATE_TABLE]= CF_CHANGES_DATA; |
|
110 |
sql_command_flags[SQLCOM_CREATE_INDEX]= CF_CHANGES_DATA; |
|
111 |
sql_command_flags[SQLCOM_ALTER_TABLE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND; |
|
112 |
sql_command_flags[SQLCOM_TRUNCATE]= CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND; |
|
113 |
sql_command_flags[SQLCOM_DROP_TABLE]= CF_CHANGES_DATA; |
|
114 |
sql_command_flags[SQLCOM_LOAD]= CF_CHANGES_DATA; |
|
115 |
sql_command_flags[SQLCOM_CREATE_DB]= CF_CHANGES_DATA; |
|
116 |
sql_command_flags[SQLCOM_DROP_DB]= CF_CHANGES_DATA; |
|
117 |
sql_command_flags[SQLCOM_RENAME_TABLE]= CF_CHANGES_DATA; |
|
118 |
sql_command_flags[SQLCOM_DROP_INDEX]= CF_CHANGES_DATA; |
|
119 |
||
120 |
sql_command_flags[SQLCOM_UPDATE]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
121 |
sql_command_flags[SQLCOM_INSERT]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
122 |
sql_command_flags[SQLCOM_INSERT_SELECT]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
123 |
sql_command_flags[SQLCOM_DELETE]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
124 |
sql_command_flags[SQLCOM_REPLACE]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
125 |
sql_command_flags[SQLCOM_REPLACE_SELECT]= CF_CHANGES_DATA | CF_HAS_ROW_COUNT; |
|
126 |
||
127 |
sql_command_flags[SQLCOM_SHOW_STATUS]= CF_STATUS_COMMAND; |
|
128 |
sql_command_flags[SQLCOM_SHOW_DATABASES]= CF_STATUS_COMMAND; |
|
129 |
sql_command_flags[SQLCOM_SHOW_FIELDS]= CF_STATUS_COMMAND; |
|
130 |
sql_command_flags[SQLCOM_SHOW_KEYS]= CF_STATUS_COMMAND; |
|
131 |
sql_command_flags[SQLCOM_SHOW_VARIABLES]= CF_STATUS_COMMAND; |
|
132 |
sql_command_flags[SQLCOM_SHOW_WARNS]= CF_STATUS_COMMAND; |
|
133 |
sql_command_flags[SQLCOM_SHOW_ERRORS]= CF_STATUS_COMMAND; |
|
134 |
sql_command_flags[SQLCOM_SHOW_PROCESSLIST]= CF_STATUS_COMMAND; |
|
135 |
sql_command_flags[SQLCOM_SHOW_CREATE_DB]= CF_STATUS_COMMAND; |
|
136 |
sql_command_flags[SQLCOM_SHOW_CREATE]= CF_STATUS_COMMAND; |
|
137 |
||
138 |
sql_command_flags[SQLCOM_SHOW_TABLES]= (CF_STATUS_COMMAND | |
|
139 |
CF_SHOW_TABLE_COMMAND); |
|
140 |
sql_command_flags[SQLCOM_SHOW_TABLE_STATUS]= (CF_STATUS_COMMAND | |
|
141 |
CF_SHOW_TABLE_COMMAND); |
|
142 |
/*
|
|
143 |
The following admin table operations are allowed
|
|
144 |
on log tables.
|
|
145 |
*/
|
|
146 |
sql_command_flags[SQLCOM_ANALYZE]= CF_WRITE_LOGS_COMMAND; |
|
147 |
}
|
|
148 |
||
149 |
/**
|
|
150 |
Perform one connection-level (COM_XXXX) command.
|
|
151 |
||
152 |
@param command type of command to perform
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
153 |
@param session connection handle
|
1
by brian
clean slate |
154 |
@param packet data for the command, packet is always null-terminated
|
155 |
@param packet_length length of packet + 1 (to show that data is
|
|
156 |
null-terminated) except for COM_SLEEP, where it
|
|
157 |
can be zero.
|
|
158 |
||
159 |
@todo
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
160 |
set session->lex->sql_command to SQLCOM_END here.
|
1
by brian
clean slate |
161 |
@todo
|
162 |
The following has to be changed to an 8 byte integer
|
|
163 |
||
164 |
@retval
|
|
165 |
0 ok
|
|
166 |
@retval
|
|
167 |
1 request of thread shutdown, i. e. if command is
|
|
168 |
COM_QUIT/COM_SHUTDOWN
|
|
169 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
170 |
bool dispatch_command(enum enum_server_command command, Session *session, |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
171 |
char* packet, uint32_t packet_length) |
1
by brian
clean slate |
172 |
{
|
173 |
bool error= 0; |
|
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
174 |
Query_id &query_id= Query_id::get_query_id(); |
1
by brian
clean slate |
175 |
|
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
176 |
DRIZZLE_COMMAND_START(session->thread_id, |
177 |
command); |
|
178 |
||
179 |
session->command= command; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
180 |
session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */ |
181 |
session->set_time(); |
|
1273.1.1
by Jay Pipes
* Changes Session::warn_id to Session::warn_query_id |
182 |
session->setQueryId(query_id.value()); |
1
by brian
clean slate |
183 |
|
184 |
switch( command ) { |
|
185 |
/* Ignore these statements. */
|
|
186 |
case COM_PING: |
|
187 |
break; |
|
188 |
/* Increase id and count all other statements. */
|
|
189 |
default: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
190 |
statistic_increment(session->status_var.questions, &LOCK_status); |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
191 |
query_id.next(); |
1
by brian
clean slate |
192 |
}
|
193 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
194 |
/* TODO: set session->lex->sql_command to SQLCOM_END here */
|
1
by brian
clean slate |
195 |
|
1130.1.16
by Monty Taylor
Fixed naming issue. |
196 |
plugin::Logging::preDo(session); |
383.6.4
by Mark Atwood
more make plug logging work |
197 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
198 |
session->server_status&= |
1
by brian
clean slate |
199 |
~(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED); |
200 |
switch (command) { |
|
201 |
case COM_INIT_DB: |
|
202 |
{
|
|
1273
by Brian Aker
Revert db patch. |
203 |
LEX_STRING tmp; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
204 |
status_var_increment(session->status_var.com_stat[SQLCOM_CHANGE_DB]); |
1273
by Brian Aker
Revert db patch. |
205 |
tmp.str= packet; |
206 |
tmp.length= packet_length; |
|
207 |
if (!mysql_change_db(session, &tmp, false)) |
|
1
by brian
clean slate |
208 |
{
|
836
by Brian Aker
Fixed session call from function to method. |
209 |
session->my_ok(); |
1
by brian
clean slate |
210 |
}
|
211 |
break; |
|
212 |
}
|
|
213 |
case COM_QUERY: |
|
214 |
{
|
|
934.2.9
by Jay Pipes
Pulls alloc_query() C function out of sql_parse.cc and adds readAndStoreQuery() member method of Session class. |
215 |
if (! session->readAndStoreQuery(packet, packet_length)) |
1
by brian
clean slate |
216 |
break; // fatal error is set |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
217 |
DRIZZLE_QUERY_START(session->query, |
218 |
session->thread_id, |
|
1241.7.2
by Padraig O'Sullivan
Corrected a dtrace probe now that db is std::string and not char * in the Session class. |
219 |
const_cast<const char *>(session->db.empty() ? "" : session->db.c_str())); |
1
by brian
clean slate |
220 |
const char* end_of_stmt= NULL; |
221 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
222 |
mysql_parse(session, session->query, session->query_length, &end_of_stmt); |
1
by brian
clean slate |
223 |
|
224 |
break; |
|
225 |
}
|
|
226 |
case COM_QUIT: |
|
227 |
/* We don't calculate statistics for this command */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
228 |
session->main_da.disable_status(); // Don't send anything back |
55
by brian
Update for using real bool types. |
229 |
error=true; // End server |
1
by brian
clean slate |
230 |
break; |
231 |
case COM_SHUTDOWN: |
|
232 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
233 |
status_var_increment(session->status_var.com_other); |
836
by Brian Aker
Fixed session call from function to method. |
234 |
session->my_eof(); |
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
235 |
session->close_thread_tables(); // Free before kill |
575.4.4
by Yoshinori Sano
Rename mysql to drizzle. |
236 |
kill_drizzle(); |
55
by brian
Update for using real bool types. |
237 |
error=true; |
1
by brian
clean slate |
238 |
break; |
239 |
}
|
|
240 |
case COM_PING: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
241 |
status_var_increment(session->status_var.com_other); |
836
by Brian Aker
Fixed session call from function to method. |
242 |
session->my_ok(); // Tell client we are alive |
1
by brian
clean slate |
243 |
break; |
244 |
case COM_SLEEP: |
|
245 |
case COM_CONNECT: // Impossible here |
|
246 |
case COM_END: |
|
247 |
default: |
|
248 |
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0)); |
|
249 |
break; |
|
250 |
}
|
|
251 |
||
252 |
/* If commit fails, we should be able to reset the OK status. */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
253 |
session->main_da.can_overwrite_status= true; |
1273.1.2
by Jay Pipes
This patch does not change any algorithms or code paths, |
254 |
TransactionServices &transaction_services= TransactionServices::singleton(); |
255 |
transaction_services.ha_autocommit_or_rollback(session, session->is_error()); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
256 |
session->main_da.can_overwrite_status= false; |
1
by brian
clean slate |
257 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
258 |
session->transaction.stmt.reset(); |
1
by brian
clean slate |
259 |
|
260 |
||
261 |
/* report error issued during command execution */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
262 |
if (session->killed_errno()) |
263 |
{
|
|
264 |
if (! session->main_da.is_set()) |
|
265 |
session->send_kill_message(); |
|
266 |
}
|
|
267 |
if (session->killed == Session::KILL_QUERY || session->killed == Session::KILL_BAD_DATA) |
|
268 |
{
|
|
269 |
session->killed= Session::NOT_KILLED; |
|
270 |
session->mysys_var->abort= 0; |
|
271 |
}
|
|
272 |
||
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
273 |
/* Can not be true, but do not take chances in production. */
|
274 |
assert(! session->main_da.is_sent); |
|
275 |
||
276 |
switch (session->main_da.status()) |
|
277 |
{
|
|
278 |
case Diagnostics_area::DA_ERROR: |
|
279 |
/* The query failed, send error to log and abort bootstrap. */
|
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
280 |
session->client->sendError(session->main_da.sql_errno(), |
281 |
session->main_da.message()); |
|
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
282 |
break; |
283 |
||
284 |
case Diagnostics_area::DA_EOF: |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
285 |
session->client->sendEOF(); |
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
286 |
break; |
287 |
||
288 |
case Diagnostics_area::DA_OK: |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
289 |
session->client->sendOK(); |
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
290 |
break; |
291 |
||
292 |
case Diagnostics_area::DA_DISABLED: |
|
293 |
break; |
|
294 |
||
295 |
case Diagnostics_area::DA_EMPTY: |
|
296 |
default: |
|
971.6.1
by Eric Day
Renamed Protocol to Client, cleaned up some unnecessary methods along the way. |
297 |
session->client->sendOK(); |
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
298 |
break; |
299 |
}
|
|
300 |
||
301 |
session->main_da.is_sent= true; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
302 |
|
303 |
session->set_proc_info("closing tables"); |
|
1
by brian
clean slate |
304 |
/* Free tables */
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
305 |
session->close_thread_tables(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
306 |
|
1130.1.16
by Monty Taylor
Fixed naming issue. |
307 |
plugin::Logging::postDo(session); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
308 |
|
961.1.4
by Brian Aker
Remove another lock for processlist. |
309 |
/* Store temp state for processlist */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
310 |
session->set_proc_info("cleaning up"); |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
311 |
session->command= COM_SLEEP; |
1003.1.13
by Brian Aker
Memset should be used for init (I seconded guessed myself in a patch about |
312 |
memset(session->process_list_info, 0, PROCESS_LIST_WIDTH); |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
313 |
session->query= 0; |
314 |
session->query_length= 0; |
|
961.1.4
by Brian Aker
Remove another lock for processlist. |
315 |
|
316 |
session->set_proc_info(NULL); |
|
1253.1.1
by Monty Taylor
First bits of namespacing. Ugh. Why do I do this to myself. |
317 |
free_root(session->mem_root,MYF(memory::KEEP_PREALLOC)); |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
318 |
|
319 |
if (DRIZZLE_QUERY_DONE_ENABLED() || DRIZZLE_COMMAND_DONE_ENABLED()) |
|
320 |
{
|
|
321 |
if (command == COM_QUERY) |
|
322 |
{
|
|
1126.10.21
by Padraig O'Sullivan
Whoops, simple fix for a build warning that happens if the build is not |
323 |
DRIZZLE_QUERY_DONE(session->is_error()); |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
324 |
}
|
1126.10.21
by Padraig O'Sullivan
Whoops, simple fix for a build warning that happens if the build is not |
325 |
DRIZZLE_COMMAND_DONE(session->is_error()); |
1126.10.2
by Padraig O'Sullivan
Added hooks into the command start and query start dtrace probes. |
326 |
}
|
327 |
||
328 |
return error; |
|
1
by brian
clean slate |
329 |
}
|
330 |
||
331 |
||
332 |
/**
|
|
327.2.4
by Brian Aker
Refactoring table.h |
333 |
Create a TableList object for an INFORMATION_SCHEMA table.
|
1
by brian
clean slate |
334 |
|
335 |
This function is used in the parser to convert a SHOW or DESCRIBE
|
|
336 |
table_name command to a SELECT from INFORMATION_SCHEMA.
|
|
846
by Brian Aker
Removing on typedeffed class. |
337 |
It prepares a Select_Lex and a TableList object to represent the
|
1
by brian
clean slate |
338 |
given command as a SELECT parse tree.
|
339 |
||
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
340 |
@param session thread handle
|
341 |
@param lex current lex
|
|
342 |
@param table_ident table alias if it's used
|
|
343 |
@param schema_table_name the name of the INFORMATION_SCHEMA table to be
|
|
344 |
created
|
|
1
by brian
clean slate |
345 |
|
346 |
@note
|
|
347 |
Due to the way this function works with memory and LEX it cannot
|
|
348 |
be used outside the parser (parse tree transformations outside
|
|
349 |
the parser break PS and SP).
|
|
350 |
||
351 |
@retval
|
|
352 |
0 success
|
|
353 |
@retval
|
|
354 |
1 out of memory or SHOW commands are not allowed
|
|
355 |
in this version of the server.
|
|
356 |
*/
|
|
357 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
358 |
int prepare_schema_table(Session *session, LEX *lex, Table_ident *table_ident, |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
359 |
const string& schema_table_name) |
1
by brian
clean slate |
360 |
{
|
846
by Brian Aker
Removing on typedeffed class. |
361 |
Select_Lex *schema_select_lex= NULL; |
1
by brian
clean slate |
362 |
|
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
363 |
|
364 |
if (schema_table_name.compare("TABLES") == 0 || |
|
365 |
schema_table_name.compare("TABLE_NAMES") == 0) |
|
366 |
{
|
|
1273
by Brian Aker
Revert db patch. |
367 |
LEX_STRING db; |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
368 |
size_t dummy; |
369 |
if (lex->select_lex.db == NULL && |
|
370 |
lex->copy_db_to(&lex->select_lex.db, &dummy)) |
|
371 |
{
|
|
372 |
return (1); |
|
373 |
}
|
|
374 |
schema_select_lex= new Select_Lex(); |
|
1273
by Brian Aker
Revert db patch. |
375 |
db.str= schema_select_lex->db= lex->select_lex.db; |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
376 |
schema_select_lex->table_list.first= NULL; |
1273
by Brian Aker
Revert db patch. |
377 |
db.length= strlen(db.str); |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
378 |
|
1273
by Brian Aker
Revert db patch. |
379 |
if (check_db_name(&db)) |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
380 |
{
|
1273
by Brian Aker
Revert db patch. |
381 |
my_error(ER_WRONG_DB_NAME, MYF(0), db.str); |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
382 |
return (1); |
383 |
}
|
|
384 |
}
|
|
385 |
else if (schema_table_name.compare("COLUMNS") == 0 || |
|
386 |
schema_table_name.compare("STATISTICS") == 0) |
|
1
by brian
clean slate |
387 |
{
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
388 |
assert(table_ident); |
327.2.4
by Brian Aker
Refactoring table.h |
389 |
TableList **query_tables_last= lex->query_tables_last; |
846
by Brian Aker
Removing on typedeffed class. |
390 |
schema_select_lex= new Select_Lex(); |
1
by brian
clean slate |
391 |
/* 'parent_lex' is used in init_query() so it must be before it. */
|
392 |
schema_select_lex->parent_lex= lex; |
|
393 |
schema_select_lex->init_query(); |
|
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
394 |
if (! schema_select_lex->add_table_to_list(session, table_ident, 0, 0, TL_READ)) |
395 |
{
|
|
396 |
return (1); |
|
397 |
}
|
|
1
by brian
clean slate |
398 |
lex->query_tables_last= query_tables_last; |
399 |
}
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
400 |
|
846
by Brian Aker
Removing on typedeffed class. |
401 |
Select_Lex *select_lex= lex->current_select; |
1
by brian
clean slate |
402 |
assert(select_lex); |
1079.2.9
by Padraig O'Sullivan
Removed the dependency on knowing the position of an I_S table in the |
403 |
if (make_schema_select(session, select_lex, schema_table_name)) |
1
by brian
clean slate |
404 |
{
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
405 |
return(1); |
1
by brian
clean slate |
406 |
}
|
327.2.4
by Brian Aker
Refactoring table.h |
407 |
TableList *table_list= (TableList*) select_lex->table_list.first; |
1
by brian
clean slate |
408 |
assert(table_list); |
409 |
table_list->schema_select_lex= schema_select_lex; |
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
410 |
|
411 |
return 0; |
|
1
by brian
clean slate |
412 |
}
|
413 |
||
414 |
/**
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
415 |
Execute command saved in session and lex->sql_command.
|
1
by brian
clean slate |
416 |
|
417 |
Before every operation that can request a write lock for a table
|
|
418 |
wait if a global read lock exists. However do not wait if this
|
|
419 |
thread has locked tables already. No new locks can be requested
|
|
420 |
until the other locks are released. The thread that requests the
|
|
421 |
global read lock waits for write locked tables to become unlocked.
|
|
422 |
||
423 |
Note that wait_if_global_read_lock() sets a protection against a new
|
|
424 |
global read lock when it succeeds. This needs to be released by
|
|
425 |
start_waiting_global_read_lock() after the operation.
|
|
426 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
427 |
@param session Thread handle
|
1
by brian
clean slate |
428 |
|
429 |
@todo
|
|
430 |
- Invalidate the table in the query cache if something changed
|
|
431 |
after unlocking when changes become visible.
|
|
432 |
TODO: this is workaround. right way will be move invalidating in
|
|
433 |
the unlock procedure.
|
|
434 |
- TODO: use check_change_password()
|
|
435 |
- JOIN is not supported yet. TODO
|
|
436 |
- SUSPEND and FOR MIGRATE are not supported yet. TODO
|
|
437 |
||
438 |
@retval
|
|
55
by brian
Update for using real bool types. |
439 |
false OK
|
1
by brian
clean slate |
440 |
@retval
|
55
by brian
Update for using real bool types. |
441 |
true Error
|
1
by brian
clean slate |
442 |
*/
|
443 |
||
1085.1.2
by Monty Taylor
Fixed -Wmissing-declarations |
444 |
static int |
520.1.22
by Brian Aker
Second pass of thd cleanup |
445 |
mysql_execute_command(Session *session) |
1
by brian
clean slate |
446 |
{
|
1100.3.68
by Padraig O'Sullivan
Changed the type of res in mysql_execute_command() to bool instead of int |
447 |
bool res= false; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
448 |
LEX *lex= session->lex; |
846
by Brian Aker
Removing on typedeffed class. |
449 |
/* first Select_Lex (have special meaning for many of non-SELECTcommands) */
|
450 |
Select_Lex *select_lex= &lex->select_lex; |
|
1
by brian
clean slate |
451 |
/* list of all tables in query */
|
327.2.4
by Brian Aker
Refactoring table.h |
452 |
TableList *all_tables; |
998
by Brian Aker
Patch on show processlist from davi@apache.org |
453 |
/* A peek into the query string */
|
454 |
size_t proc_info_len= session->query_length > PROCESS_LIST_WIDTH ? |
|
455 |
PROCESS_LIST_WIDTH : session->query_length; |
|
456 |
||
457 |
memcpy(session->process_list_info, session->query, proc_info_len); |
|
458 |
session->process_list_info[proc_info_len]= '\0'; |
|
1
by brian
clean slate |
459 |
|
460 |
/*
|
|
846
by Brian Aker
Removing on typedeffed class. |
461 |
In many cases first table of main Select_Lex have special meaning =>
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
462 |
check that it is first table in global list and relink it first in
|
1
by brian
clean slate |
463 |
queries_tables list if it is necessary (we need such relinking only
|
464 |
for queries with subqueries in select list, in this case tables of
|
|
465 |
subqueries will go to global list first)
|
|
466 |
||
846
by Brian Aker
Removing on typedeffed class. |
467 |
all_tables will differ from first_table only if most upper Select_Lex
|
1
by brian
clean slate |
468 |
do not contain tables.
|
469 |
||
470 |
Because of above in place where should be at least one table in most
|
|
846
by Brian Aker
Removing on typedeffed class. |
471 |
outer Select_Lex we have following check:
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
472 |
assert(first_table == all_tables);
|
473 |
assert(first_table == all_tables && first_table != 0);
|
|
1
by brian
clean slate |
474 |
*/
|
475 |
lex->first_lists_tables_same(); |
|
476 |
/* should be assigned after making first tables same */
|
|
477 |
all_tables= lex->query_tables; |
|
478 |
/* set context for commands which do not use setup_tables */
|
|
479 |
select_lex-> |
|
327.2.4
by Brian Aker
Refactoring table.h |
480 |
context.resolve_in_table_list_only((TableList*)select_lex-> |
1
by brian
clean slate |
481 |
table_list.first); |
482 |
||
483 |
/*
|
|
484 |
Reset warning count for each query that uses tables
|
|
485 |
A better approach would be to reset this for any commands
|
|
486 |
that is not a SHOW command or a select that only access local
|
|
487 |
variables, but for now this is probably good enough.
|
|
488 |
Don't reset warnings when executing a stored routine.
|
|
489 |
*/
|
|
1100.3.63
by Padraig O'Sullivan
Extracted the ALTER TABLE command into its own class and implementation |
490 |
if (all_tables || ! lex->is_single_level_stmt()) |
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
491 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
492 |
drizzle_reset_errors(session, 0); |
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
493 |
}
|
1
by brian
clean slate |
494 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
495 |
status_var_increment(session->status_var.com_stat[lex->sql_command]); |
1
by brian
clean slate |
496 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
497 |
assert(session->transaction.stmt.modified_non_trans_table == false); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
498 |
|
1100.3.66
by Padraig O'Sullivan
Extracted the last commands....Finally removed that gigantic switch |
499 |
/* now we are ready to execute the statement */
|
500 |
res= lex->statement->execute(); |
|
1100.3.1
by Padraig O'Sullivan
Beginnings of reworking the mysql_execute_command() method. |
501 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
502 |
session->set_proc_info("query end"); |
1
by brian
clean slate |
503 |
|
504 |
/*
|
|
505 |
The return value for ROW_COUNT() is "implementation dependent" if the
|
|
506 |
statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC
|
|
507 |
wants. We also keep the last value in case of SQLCOM_CALL or
|
|
508 |
SQLCOM_EXECUTE.
|
|
509 |
*/
|
|
1100.3.49
by Padraig O'Sullivan
Extracted the KILL command into its own class and implementation files. |
510 |
if (! (sql_command_flags[lex->sql_command].test(CF_BIT_HAS_ROW_COUNT))) |
511 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
512 |
session->row_count_func= -1; |
1100.3.49
by Padraig O'Sullivan
Extracted the KILL command into its own class and implementation files. |
513 |
}
|
1
by brian
clean slate |
514 |
|
1100.3.63
by Padraig O'Sullivan
Extracted the ALTER TABLE command into its own class and implementation |
515 |
return (res || session->is_error()); |
1
by brian
clean slate |
516 |
}
|
517 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
518 |
bool execute_sqlcom_select(Session *session, TableList *all_tables) |
1
by brian
clean slate |
519 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
520 |
LEX *lex= session->lex; |
1
by brian
clean slate |
521 |
select_result *result=lex->result; |
873.1.9
by Jay Pipes
This patch fixes the following functions to properly error out |
522 |
bool res= false; |
1
by brian
clean slate |
523 |
/* assign global limit variable if limit is not given */
|
524 |
{
|
|
846
by Brian Aker
Removing on typedeffed class. |
525 |
Select_Lex *param= lex->unit.global_parameters; |
1
by brian
clean slate |
526 |
if (!param->explicit_limit) |
527 |
param->select_limit= |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
528 |
new Item_int((uint64_t) session->variables.select_limit); |
1
by brian
clean slate |
529 |
}
|
1109.1.3
by Brian Aker
Move names around a bit (to align similar methods) |
530 |
if (!(res= session->openTablesLock(all_tables))) |
1
by brian
clean slate |
531 |
{
|
532 |
if (lex->describe) |
|
533 |
{
|
|
534 |
/*
|
|
535 |
We always use select_send for EXPLAIN, even if it's an EXPLAIN
|
|
536 |
for SELECT ... INTO OUTFILE: a user application should be able
|
|
537 |
to prepend EXPLAIN to any query and receive output for it,
|
|
538 |
even if the query itself redirects the output.
|
|
539 |
*/
|
|
540 |
if (!(result= new select_send())) |
|
971.6.11
by Eric Day
Removed purecov messages. |
541 |
return true; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
542 |
session->send_explain_fields(result); |
1240.7.1
by Padraig O'Sullivan
Created an ExplainPlan class in the optimizer namespace. All printing of an explain in drizzle goes |
543 |
optimizer::ExplainPlan planner; |
544 |
res= planner.explainUnion(session, &session->lex->unit, result); |
|
1
by brian
clean slate |
545 |
if (lex->describe & DESCRIBE_EXTENDED) |
546 |
{
|
|
547 |
char buff[1024]; |
|
205
by Brian Aker
uint32 -> uin32_t |
548 |
String str(buff,(uint32_t) sizeof(buff), system_charset_info); |
1
by brian
clean slate |
549 |
str.length(0); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
550 |
session->lex->unit.print(&str, QT_ORDINARY); |
1
by brian
clean slate |
551 |
str.append('\0'); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
552 |
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE, |
1
by brian
clean slate |
553 |
ER_YES, str.ptr()); |
554 |
}
|
|
555 |
if (res) |
|
556 |
result->abort(); |
|
557 |
else
|
|
558 |
result->send_eof(); |
|
559 |
delete result; |
|
560 |
}
|
|
561 |
else
|
|
562 |
{
|
|
563 |
if (!result && !(result= new select_send())) |
|
971.6.11
by Eric Day
Removed purecov messages. |
564 |
return true; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
565 |
res= handle_select(session, lex, result, 0); |
1
by brian
clean slate |
566 |
if (result != lex->result) |
567 |
delete result; |
|
568 |
}
|
|
569 |
}
|
|
570 |
return res; |
|
571 |
}
|
|
572 |
||
573 |
||
574 |
#define MY_YACC_INIT 1000 // Start with big alloc |
|
575 |
#define MY_YACC_MAX 32000 // Because of 'short' |
|
576 |
||
577 |
bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize) |
|
578 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
579 |
LEX *lex= current_session->lex; |
1
by brian
clean slate |
580 |
ulong old_info=0; |
438.1.13
by Brian Aker
uint cleanup. |
581 |
if ((uint32_t) *yystacksize >= MY_YACC_MAX) |
1
by brian
clean slate |
582 |
return 1; |
583 |
if (!lex->yacc_yyvs) |
|
584 |
old_info= *yystacksize; |
|
585 |
*yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX); |
|
656.1.46
by Monty Taylor
More malloc return cleanups. |
586 |
unsigned char *tmpptr= NULL; |
587 |
if (!(tmpptr= (unsigned char *)realloc(lex->yacc_yyvs, |
|
588 |
*yystacksize* sizeof(**yyvs)))) |
|
589 |
return 1; |
|
590 |
lex->yacc_yyvs= tmpptr; |
|
591 |
tmpptr= NULL; |
|
592 |
if (!(tmpptr= (unsigned char*)realloc(lex->yacc_yyss, |
|
593 |
*yystacksize* sizeof(**yyss)))) |
|
594 |
return 1; |
|
595 |
lex->yacc_yyss= tmpptr; |
|
1
by brian
clean slate |
596 |
if (old_info) |
597 |
{ // Copy old info from stack |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
598 |
memcpy(lex->yacc_yyss, *yyss, old_info*sizeof(**yyss)); |
599 |
memcpy(lex->yacc_yyvs, *yyvs, old_info*sizeof(**yyvs)); |
|
1
by brian
clean slate |
600 |
}
|
601 |
*yyss=(short*) lex->yacc_yyss; |
|
602 |
*yyvs=(YYSTYPE*) lex->yacc_yyvs; |
|
603 |
return 0; |
|
604 |
}
|
|
605 |
||
606 |
||
607 |
void
|
|
608 |
mysql_init_select(LEX *lex) |
|
609 |
{
|
|
846
by Brian Aker
Removing on typedeffed class. |
610 |
Select_Lex *select_lex= lex->current_select; |
1
by brian
clean slate |
611 |
select_lex->init_select(); |
612 |
lex->wild= 0; |
|
613 |
if (select_lex == &lex->select_lex) |
|
614 |
{
|
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
615 |
assert(lex->result == 0); |
1
by brian
clean slate |
616 |
lex->exchange= 0; |
617 |
}
|
|
618 |
}
|
|
619 |
||
620 |
||
621 |
bool
|
|
622 |
mysql_new_select(LEX *lex, bool move_down) |
|
623 |
{
|
|
846
by Brian Aker
Removing on typedeffed class. |
624 |
Select_Lex *select_lex; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
625 |
Session *session= lex->session; |
1
by brian
clean slate |
626 |
|
846
by Brian Aker
Removing on typedeffed class. |
627 |
if (!(select_lex= new (session->mem_root) Select_Lex())) |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
628 |
return(1); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
629 |
select_lex->select_number= ++session->select_number; |
1
by brian
clean slate |
630 |
select_lex->parent_lex= lex; /* Used in init_query. */ |
631 |
select_lex->init_query(); |
|
632 |
select_lex->init_select(); |
|
633 |
lex->nest_level++; |
|
634 |
if (lex->nest_level > (int) MAX_SELECT_NESTING) |
|
635 |
{
|
|
636 |
my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING); |
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
637 |
return(1); |
1
by brian
clean slate |
638 |
}
|
639 |
select_lex->nest_level= lex->nest_level; |
|
640 |
if (move_down) |
|
641 |
{
|
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
642 |
Select_Lex_Unit *unit; |
1
by brian
clean slate |
643 |
/* first select_lex of subselect or derived table */
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
644 |
if (!(unit= new (session->mem_root) Select_Lex_Unit())) |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
645 |
return(1); |
1
by brian
clean slate |
646 |
|
647 |
unit->init_query(); |
|
648 |
unit->init_select(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
649 |
unit->session= session; |
1
by brian
clean slate |
650 |
unit->include_down(lex->current_select); |
651 |
unit->link_next= 0; |
|
652 |
unit->link_prev= 0; |
|
653 |
unit->return_to= lex->current_select; |
|
654 |
select_lex->include_down(unit); |
|
655 |
/*
|
|
656 |
By default we assume that it is usual subselect and we have outer name
|
|
657 |
resolution context, if no we will assign it to 0 later
|
|
658 |
*/
|
|
659 |
select_lex->context.outer_context= &select_lex->outer_select()->context; |
|
660 |
}
|
|
661 |
else
|
|
662 |
{
|
|
663 |
if (lex->current_select->order_list.first && !lex->current_select->braces) |
|
664 |
{
|
|
327.2.3
by Brian Aker
Refactoring of class Table |
665 |
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "order_st BY"); |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
666 |
return(1); |
1
by brian
clean slate |
667 |
}
|
668 |
select_lex->include_neighbour(lex->current_select); |
|
848
by Brian Aker
typdef class removal (just... use the name of the class). |
669 |
Select_Lex_Unit *unit= select_lex->master_unit(); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
670 |
if (!unit->fake_select_lex && unit->add_fake_select_lex(lex->session)) |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
671 |
return(1); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
672 |
select_lex->context.outer_context= |
1
by brian
clean slate |
673 |
unit->first_select()->context.outer_context; |
674 |
}
|
|
675 |
||
676 |
select_lex->master_unit()->global_parameters= select_lex; |
|
847
by Brian Aker
More typdef class removal. |
677 |
select_lex->include_global((Select_Lex_Node**)&lex->all_selects_list); |
1
by brian
clean slate |
678 |
lex->current_select= select_lex; |
679 |
/*
|
|
680 |
in subquery is SELECT query and we allow resolution of names in SELECT
|
|
681 |
list
|
|
682 |
*/
|
|
55
by brian
Update for using real bool types. |
683 |
select_lex->context.resolve_in_select_list= true; |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
684 |
return(0); |
1
by brian
clean slate |
685 |
}
|
686 |
||
687 |
/**
|
|
688 |
Create a select to return the same output as 'SELECT @@var_name'.
|
|
689 |
||
690 |
Used for SHOW COUNT(*) [ WARNINGS | ERROR].
|
|
691 |
||
692 |
This will crash with a core dump if the variable doesn't exists.
|
|
693 |
||
694 |
@param var_name Variable name
|
|
695 |
*/
|
|
696 |
||
697 |
void create_select_for_variable(const char *var_name) |
|
698 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
699 |
Session *session; |
1
by brian
clean slate |
700 |
LEX *lex; |
701 |
LEX_STRING tmp, null_lex_string; |
|
702 |
Item *var; |
|
673.2.1
by Toru Maesaka
First pass of replacing MySQL's strxmov with libc alternatives |
703 |
char buff[MAX_SYS_VAR_LENGTH*2+4+8]; |
704 |
char *end= buff; |
|
1
by brian
clean slate |
705 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
706 |
session= current_session; |
707 |
lex= session->lex; |
|
1
by brian
clean slate |
708 |
mysql_init_select(lex); |
709 |
lex->sql_command= SQLCOM_SELECT; |
|
710 |
tmp.str= (char*) var_name; |
|
711 |
tmp.length=strlen(var_name); |
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
712 |
memset(&null_lex_string.str, 0, sizeof(null_lex_string)); |
1
by brian
clean slate |
713 |
/*
|
714 |
We set the name of Item to @@session.var_name because that then is used
|
|
715 |
as the column name in the output.
|
|
716 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
717 |
if ((var= get_system_var(session, OPT_SESSION, tmp, null_lex_string))) |
1
by brian
clean slate |
718 |
{
|
673.2.1
by Toru Maesaka
First pass of replacing MySQL's strxmov with libc alternatives |
719 |
end+= sprintf(buff, "@@session.%s", var_name); |
1
by brian
clean slate |
720 |
var->set_name(buff, end-buff, system_charset_info); |
838
by Brian Aker
More class adoption/method |
721 |
session->add_item_to_list(var); |
1
by brian
clean slate |
722 |
}
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
723 |
return; |
1
by brian
clean slate |
724 |
}
|
725 |
||
726 |
||
727 |
/**
|
|
728 |
Parse a query.
|
|
729 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
730 |
@param session Current thread
|
1
by brian
clean slate |
731 |
@param inBuf Begining of the query text
|
732 |
@param length Length of the query text
|
|
733 |
@param[out] found_semicolon For multi queries, position of the character of
|
|
734 |
the next query in the query text.
|
|
735 |
*/
|
|
736 |
||
1165.1.49
by Stewart Smith
make mysql_parse static to sql_parse.cc |
737 |
static void mysql_parse(Session *session, const char *inBuf, uint32_t length, |
1
by brian
clean slate |
738 |
const char ** found_semicolon) |
739 |
{
|
|
740 |
/*
|
|
741 |
Warning.
|
|
742 |
The purpose of query_cache_send_result_to_client() is to lookup the
|
|
743 |
query in the query cache first, to avoid parsing and executing it.
|
|
744 |
So, the natural implementation would be to:
|
|
745 |
- first, call query_cache_send_result_to_client,
|
|
746 |
- second, if caching failed, initialise the lexical and syntactic parser.
|
|
747 |
The problem is that the query cache depends on a clean initialization
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
748 |
of (among others) lex->safe_to_cache_query and session->server_status,
|
1
by brian
clean slate |
749 |
which are reset respectively in
|
750 |
- lex_start()
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
751 |
- mysql_reset_session_for_next_command()
|
1
by brian
clean slate |
752 |
So, initializing the lexical analyser *before* using the query cache
|
753 |
is required for the cache to work properly.
|
|
754 |
FIXME: cleanup the dependencies in the code to simplify this.
|
|
755 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
756 |
lex_start(session); |
735
by Brian Aker
Refactor session. |
757 |
session->reset_for_next_command(); |
1
by brian
clean slate |
758 |
|
759 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
760 |
LEX *lex= session->lex; |
761 |
||
762 |
Lex_input_stream lip(session, inBuf, length); |
|
763 |
||
764 |
bool err= parse_sql(session, &lip); |
|
1
by brian
clean slate |
765 |
*found_semicolon= lip.found_semicolon; |
766 |
||
767 |
if (!err) |
|
768 |
{
|
|
769 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
770 |
if (! session->is_error()) |
1
by brian
clean slate |
771 |
{
|
772 |
/*
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
773 |
Binlog logs a string starting from session->query and having length
|
774 |
session->query_length; so we set session->query_length correctly (to not
|
|
1
by brian
clean slate |
775 |
log several statements in one event, when we executed only first).
|
776 |
We set it to not see the ';' (otherwise it would get into binlog
|
|
777 |
and Query_log_event::print() would give ';;' output).
|
|
778 |
This also helps display only the current query in SHOW
|
|
779 |
PROCESSLIST.
|
|
780 |
Note that we don't need LOCK_thread_count to modify query_length.
|
|
781 |
*/
|
|
782 |
if (*found_semicolon && |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
783 |
(session->query_length= (ulong)(*found_semicolon - session->query))) |
784 |
session->query_length--; |
|
1126.10.14
by Padraig O'Sullivan
Added calls to the query execution start/end dtrace probes. |
785 |
DRIZZLE_QUERY_EXEC_START(session->query, |
786 |
session->thread_id, |
|
1241.7.2
by Padraig O'Sullivan
Corrected a dtrace probe now that db is std::string and not char * in the Session class. |
787 |
const_cast<const char *>(session->db.empty() ? "" : session->db.c_str())); |
1
by brian
clean slate |
788 |
/* Actually execute the query */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
789 |
mysql_execute_command(session); |
1126.10.14
by Padraig O'Sullivan
Added calls to the query execution start/end dtrace probes. |
790 |
DRIZZLE_QUERY_EXEC_DONE(0); |
1
by brian
clean slate |
791 |
}
|
792 |
}
|
|
793 |
}
|
|
794 |
else
|
|
795 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
796 |
assert(session->is_error()); |
1
by brian
clean slate |
797 |
}
|
798 |
lex->unit.cleanup(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
799 |
session->set_proc_info("freeing items"); |
800 |
session->end_statement(); |
|
801 |
session->cleanup_after_query(); |
|
1
by brian
clean slate |
802 |
}
|
803 |
||
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
804 |
return; |
1
by brian
clean slate |
805 |
}
|
806 |
||
807 |
||
808 |
||
809 |
/**
|
|
810 |
Store field definition for create.
|
|
811 |
||
812 |
@return
|
|
813 |
Return 0 if ok
|
|
814 |
*/
|
|
815 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
816 |
bool add_field_to_list(Session *session, LEX_STRING *field_name, enum_field_types type, |
1
by brian
clean slate |
817 |
char *length, char *decimals, |
438.1.13
by Brian Aker
uint cleanup. |
818 |
uint32_t type_modifier, |
1
by brian
clean slate |
819 |
enum column_format_type column_format, |
820 |
Item *default_value, Item *on_update_value, |
|
821 |
LEX_STRING *comment, |
|
822 |
char *change, |
|
998.1.2
by Brian Aker
First pass on removing virt columns |
823 |
List<String> *interval_list, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
824 |
{
|
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
825 |
register CreateField *new_field; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
826 |
LEX *lex= session->lex; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
827 |
drizzled::statement::AlterTable *statement= (drizzled::statement::AlterTable *)lex->statement; |
1
by brian
clean slate |
828 |
|
829 |
if (check_identifier_name(field_name, ER_TOO_LONG_IDENT)) |
|
1135
by Brian Aker
Merge of Lex -> Statement refactoring |
830 |
return true; |
1
by brian
clean slate |
831 |
|
832 |
if (type_modifier & PRI_KEY_FLAG) |
|
833 |
{
|
|
834 |
Key *key; |
|
835 |
lex->col_list.push_back(new Key_part_spec(*field_name, 0)); |
|
836 |
key= new Key(Key::PRIMARY, null_lex_str, |
|
837 |
&default_key_create_info, |
|
838 |
0, lex->col_list); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
839 |
statement->alter_info.key_list.push_back(key); |
1
by brian
clean slate |
840 |
lex->col_list.empty(); |
841 |
}
|
|
842 |
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG)) |
|
843 |
{
|
|
844 |
Key *key; |
|
845 |
lex->col_list.push_back(new Key_part_spec(*field_name, 0)); |
|
846 |
key= new Key(Key::UNIQUE, null_lex_str, |
|
847 |
&default_key_create_info, 0, |
|
848 |
lex->col_list); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
849 |
statement->alter_info.key_list.push_back(key); |
1
by brian
clean slate |
850 |
lex->col_list.empty(); |
851 |
}
|
|
852 |
||
853 |
if (default_value) |
|
854 |
{
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
855 |
/*
|
1
by brian
clean slate |
856 |
Default value should be literal => basic constants =>
|
857 |
no need fix_fields()
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
858 |
|
859 |
We allow only one function as part of default value -
|
|
1
by brian
clean slate |
860 |
NOW() as default for TIMESTAMP type.
|
861 |
*/
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
862 |
if (default_value->type() == Item::FUNC_ITEM && |
1
by brian
clean slate |
863 |
!(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC && |
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
864 |
type == DRIZZLE_TYPE_TIMESTAMP)) |
1
by brian
clean slate |
865 |
{
|
866 |
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
867 |
return true; |
1
by brian
clean slate |
868 |
}
|
869 |
else if (default_value->type() == Item::NULL_ITEM) |
|
870 |
{
|
|
871 |
default_value= 0; |
|
872 |
if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == |
|
873 |
NOT_NULL_FLAG) |
|
874 |
{
|
|
875 |
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
876 |
return true; |
1
by brian
clean slate |
877 |
}
|
878 |
}
|
|
879 |
else if (type_modifier & AUTO_INCREMENT_FLAG) |
|
880 |
{
|
|
881 |
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
882 |
return true; |
1
by brian
clean slate |
883 |
}
|
884 |
}
|
|
885 |
||
212.2.2
by Patrick Galbraith
Renamed FIELD_TYPE to DRIZZLE_TYPE |
886 |
if (on_update_value && type != DRIZZLE_TYPE_TIMESTAMP) |
1
by brian
clean slate |
887 |
{
|
888 |
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name->str); |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
889 |
return true; |
1
by brian
clean slate |
890 |
}
|
891 |
||
1052.2.3
by Nathan Williams
No actual code changes. Changed Create_field to CreateField to be consistent with coding standards. |
892 |
if (!(new_field= new CreateField()) || |
520.1.22
by Brian Aker
Second pass of thd cleanup |
893 |
new_field->init(session, field_name->str, type, length, decimals, type_modifier, |
1
by brian
clean slate |
894 |
default_value, on_update_value, comment, change, |
998.1.2
by Brian Aker
First pass on removing virt columns |
895 |
interval_list, cs, 0, column_format)) |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
896 |
return true; |
1
by brian
clean slate |
897 |
|
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
898 |
statement->alter_info.create_list.push_back(new_field); |
1
by brian
clean slate |
899 |
lex->last_field=new_field; |
1128.2.4
by Brian Aker
AlterInfo refactor back to class. |
900 |
|
901 |
return false; |
|
1
by brian
clean slate |
902 |
}
|
903 |
||
904 |
||
905 |
/** Store position for column in ALTER TABLE .. ADD column. */
|
|
906 |
||
907 |
void store_position_for_column(const char *name) |
|
908 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
909 |
current_session->lex->last_field->after=const_cast<char*> (name); |
1
by brian
clean slate |
910 |
}
|
911 |
||
912 |
/**
|
|
913 |
Add a table to list of used tables.
|
|
914 |
||
915 |
@param table Table to add
|
|
916 |
@param alias alias for table (or null if no alias)
|
|
917 |
@param table_options A set of the following bits:
|
|
918 |
- TL_OPTION_UPDATING : Table will be updated
|
|
919 |
- TL_OPTION_FORCE_INDEX : Force usage of index
|
|
920 |
- TL_OPTION_ALIAS : an alias in multi table DELETE
|
|
921 |
@param lock_type How table should be locked
|
|
922 |
@param use_index List of indexed used in USE INDEX
|
|
923 |
@param ignore_index List of indexed used in IGNORE INDEX
|
|
924 |
||
925 |
@retval
|
|
926 |
0 Error
|
|
927 |
@retval
|
|
327.2.4
by Brian Aker
Refactoring table.h |
928 |
\# Pointer to TableList element added to the total table list
|
1
by brian
clean slate |
929 |
*/
|
930 |
||
846
by Brian Aker
Removing on typedeffed class. |
931 |
TableList *Select_Lex::add_table_to_list(Session *session, |
1
by brian
clean slate |
932 |
Table_ident *table, |
933 |
LEX_STRING *alias, |
|
202
by Brian Aker
Cleanup sql_lex to modern types. |
934 |
uint32_t table_options, |
1
by brian
clean slate |
935 |
thr_lock_type lock_type, |
936 |
List<Index_hint> *index_hints_arg, |
|
937 |
LEX_STRING *option) |
|
938 |
{
|
|
327.2.4
by Brian Aker
Refactoring table.h |
939 |
register TableList *ptr; |
940 |
TableList *previous_table_ref; /* The table preceding the current one. */ |
|
1
by brian
clean slate |
941 |
char *alias_str; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
942 |
LEX *lex= session->lex; |
1
by brian
clean slate |
943 |
|
944 |
if (!table) |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
945 |
return NULL; // End of memory |
1
by brian
clean slate |
946 |
alias_str= alias ? alias->str : table->table.str; |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
947 |
if (!test(table_options & TL_OPTION_ALIAS) && |
1
by brian
clean slate |
948 |
check_table_name(table->table.str, table->table.length)) |
949 |
{
|
|
950 |
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
951 |
return NULL; |
1
by brian
clean slate |
952 |
}
|
953 |
||
1273
by Brian Aker
Revert db patch. |
954 |
if (table->is_derived_table() == false && table->db.str && |
955 |
check_db_name(&table->db)) |
|
1
by brian
clean slate |
956 |
{
|
1273
by Brian Aker
Revert db patch. |
957 |
my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str); |
958 |
return NULL; |
|
1
by brian
clean slate |
959 |
}
|
960 |
||
961 |
if (!alias) /* Alias is case sensitive */ |
|
962 |
{
|
|
963 |
if (table->sel) |
|
964 |
{
|
|
965 |
my_message(ER_DERIVED_MUST_HAVE_ALIAS, |
|
966 |
ER(ER_DERIVED_MUST_HAVE_ALIAS), MYF(0)); |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
967 |
return NULL; |
1
by brian
clean slate |
968 |
}
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
969 |
if (!(alias_str= (char*) session->memdup(alias_str,table->table.length+1))) |
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
970 |
return NULL; |
1
by brian
clean slate |
971 |
}
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
972 |
if (!(ptr = (TableList *) session->calloc(sizeof(TableList)))) |
971.6.11
by Eric Day
Removed purecov messages. |
973 |
return NULL; |
1
by brian
clean slate |
974 |
if (table->db.str) |
975 |
{
|
|
55
by brian
Update for using real bool types. |
976 |
ptr->is_fqtn= true; |
1
by brian
clean slate |
977 |
ptr->db= table->db.str; |
978 |
ptr->db_length= table->db.length; |
|
979 |
}
|
|
980 |
else if (lex->copy_db_to(&ptr->db, &ptr->db_length)) |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
981 |
return NULL; |
1
by brian
clean slate |
982 |
else
|
55
by brian
Update for using real bool types. |
983 |
ptr->is_fqtn= false; |
1
by brian
clean slate |
984 |
|
985 |
ptr->alias= alias_str; |
|
55
by brian
Update for using real bool types. |
986 |
ptr->is_alias= alias ? true : false; |
1039.1.5
by Brian Aker
Remove lower case filename bits (aka we just lock into the most compatible |
987 |
if (table->table.length) |
1
by brian
clean slate |
988 |
table->table.length= my_casedn_str(files_charset_info, table->table.str); |
989 |
ptr->table_name=table->table.str; |
|
990 |
ptr->table_name_length=table->table.length; |
|
991 |
ptr->lock_type= lock_type; |
|
992 |
ptr->updating= test(table_options & TL_OPTION_UPDATING); |
|
993 |
ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); |
|
994 |
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); |
|
995 |
ptr->derived= table->sel; |
|
996 |
if (!ptr->derived && !my_strcasecmp(system_charset_info, ptr->db, |
|
575.4.7
by Monty Taylor
More header cleanup. |
997 |
INFORMATION_SCHEMA_NAME.c_str())) |
1
by brian
clean slate |
998 |
{
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
999 |
plugin::InfoSchemaTable *schema_table= plugin::InfoSchemaTable::getTable(ptr->table_name); |
1
by brian
clean slate |
1000 |
if (!schema_table || |
1063.4.1
by Padraig O'Sullivan
Re-factored the InfoSchemaTable structure to now be a class. Made all data |
1001 |
(schema_table->isHidden() && |
602.2.2
by Yoshinori Sano
Fix bugs in params of sql_command_flags[...].test(). Previously, the value such as, 0, 1, 2, 4, 8 and 16 is given to std::bitset.test() in that place, which is misunderstanding of the spec of the test(). The test(size_t n) returns true if bit n is set. |
1002 |
((sql_command_flags[lex->sql_command].test(CF_BIT_STATUS_COMMAND)) == 0 || |
1
by brian
clean slate |
1003 |
/*
|
1004 |
this check is used for show columns|keys from I_S hidden table
|
|
1005 |
*/
|
|
1006 |
lex->sql_command == SQLCOM_SHOW_FIELDS || |
|
1007 |
lex->sql_command == SQLCOM_SHOW_KEYS))) |
|
1008 |
{
|
|
1009 |
my_error(ER_UNKNOWN_TABLE, MYF(0), |
|
575.4.7
by Monty Taylor
More header cleanup. |
1010 |
ptr->table_name, INFORMATION_SCHEMA_NAME.c_str()); |
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1011 |
return NULL; |
1
by brian
clean slate |
1012 |
}
|
1013 |
}
|
|
1014 |
ptr->select_lex= lex->current_select; |
|
1015 |
ptr->index_hints= index_hints_arg; |
|
1016 |
ptr->option= option ? option->str : 0; |
|
1017 |
/* check that used name is unique */
|
|
1018 |
if (lock_type != TL_IGNORE) |
|
1019 |
{
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1020 |
TableList *first_table= (TableList*) table_list.first; |
1021 |
for (TableList *tables= first_table ; |
|
1
by brian
clean slate |
1022 |
tables ; |
1023 |
tables=tables->next_local) |
|
1024 |
{
|
|
1025 |
if (!my_strcasecmp(table_alias_charset, alias_str, tables->alias) && |
|
1026 |
!strcmp(ptr->db, tables->db)) |
|
1027 |
{
|
|
971.6.11
by Eric Day
Removed purecov messages. |
1028 |
my_error(ER_NONUNIQ_TABLE, MYF(0), alias_str); |
1029 |
return NULL; |
|
1
by brian
clean slate |
1030 |
}
|
1031 |
}
|
|
1032 |
}
|
|
1033 |
/* Store the table reference preceding the current one. */
|
|
1034 |
if (table_list.elements > 0) |
|
1035 |
{
|
|
1036 |
/*
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1037 |
table_list.next points to the last inserted TableList->next_local'
|
1
by brian
clean slate |
1038 |
element
|
1039 |
We don't use the offsetof() macro here to avoid warnings from gcc
|
|
1040 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1041 |
previous_table_ref= (TableList*) ((char*) table_list.next - |
1
by brian
clean slate |
1042 |
((char*) &(ptr->next_local) - |
1043 |
(char*) ptr)); |
|
1044 |
/*
|
|
1045 |
Set next_name_resolution_table of the previous table reference to point
|
|
1046 |
to the current table reference. In effect the list
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1047 |
TableList::next_name_resolution_table coincides with
|
1048 |
TableList::next_local. Later this may be changed in
|
|
1
by brian
clean slate |
1049 |
store_top_level_join_columns() for NATURAL/USING joins.
|
1050 |
*/
|
|
1051 |
previous_table_ref->next_name_resolution_table= ptr; |
|
1052 |
}
|
|
1053 |
||
1054 |
/*
|
|
1055 |
Link the current table reference in a local list (list for current select).
|
|
1056 |
Notice that as a side effect here we set the next_local field of the
|
|
1057 |
previous table reference to 'ptr'. Here we also add one element to the
|
|
1058 |
list 'table_list'.
|
|
1059 |
*/
|
|
481
by Brian Aker
Remove all of uchar. |
1060 |
table_list.link_in_list((unsigned char*) ptr, (unsigned char**) &ptr->next_local); |
1
by brian
clean slate |
1061 |
ptr->next_name_resolution_table= NULL; |
1062 |
/* Link table in global list (all used tables) */
|
|
1063 |
lex->add_to_query_tables(ptr); |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1064 |
return ptr; |
1
by brian
clean slate |
1065 |
}
|
1066 |
||
1067 |
||
1068 |
/**
|
|
1069 |
Initialize a new table list for a nested join.
|
|
1070 |
||
327.2.4
by Brian Aker
Refactoring table.h |
1071 |
The function initializes a structure of the TableList type
|
1
by brian
clean slate |
1072 |
for a nested join. It sets up its nested join list as empty.
|
1073 |
The created structure is added to the front of the current
|
|
846
by Brian Aker
Removing on typedeffed class. |
1074 |
join list in the Select_Lex object. Then the function
|
1
by brian
clean slate |
1075 |
changes the current nest level for joins to refer to the newly
|
1076 |
created empty list after having saved the info on the old level
|
|
1077 |
in the initialized structure.
|
|
1078 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1079 |
@param session current thread
|
1
by brian
clean slate |
1080 |
|
1081 |
@retval
|
|
1082 |
0 if success
|
|
1083 |
@retval
|
|
1084 |
1 otherwise
|
|
1085 |
*/
|
|
1086 |
||
846
by Brian Aker
Removing on typedeffed class. |
1087 |
bool Select_Lex::init_nested_join(Session *session) |
1
by brian
clean slate |
1088 |
{
|
327.2.4
by Brian Aker
Refactoring table.h |
1089 |
TableList *ptr; |
1090 |
nested_join_st *nested_join; |
|
1
by brian
clean slate |
1091 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1092 |
if (!(ptr= (TableList*) session->calloc(ALIGN_SIZE(sizeof(TableList))+ |
327.2.4
by Brian Aker
Refactoring table.h |
1093 |
sizeof(nested_join_st)))) |
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1094 |
return true; |
1
by brian
clean slate |
1095 |
nested_join= ptr->nested_join= |
481
by Brian Aker
Remove all of uchar. |
1096 |
((nested_join_st*) ((unsigned char*) ptr + ALIGN_SIZE(sizeof(TableList)))); |
1
by brian
clean slate |
1097 |
|
1098 |
join_list->push_front(ptr); |
|
1099 |
ptr->embedding= embedding; |
|
1100 |
ptr->join_list= join_list; |
|
1101 |
ptr->alias= (char*) "(nested_join)"; |
|
1102 |
embedding= ptr; |
|
1103 |
join_list= &nested_join->join_list; |
|
1104 |
join_list->empty(); |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1105 |
return false; |
1
by brian
clean slate |
1106 |
}
|
1107 |
||
1108 |
||
1109 |
/**
|
|
1110 |
End a nested join table list.
|
|
1111 |
||
1112 |
The function returns to the previous join nest level.
|
|
1113 |
If the current level contains only one member, the function
|
|
1114 |
moves it one level up, eliminating the nest.
|
|
1115 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1116 |
@param session current thread
|
1
by brian
clean slate |
1117 |
|
1118 |
@return
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1119 |
- Pointer to TableList element added to the total table list, if success
|
1
by brian
clean slate |
1120 |
- 0, otherwise
|
1121 |
*/
|
|
1122 |
||
846
by Brian Aker
Removing on typedeffed class. |
1123 |
TableList *Select_Lex::end_nested_join(Session *) |
1
by brian
clean slate |
1124 |
{
|
327.2.4
by Brian Aker
Refactoring table.h |
1125 |
TableList *ptr; |
1126 |
nested_join_st *nested_join; |
|
1
by brian
clean slate |
1127 |
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1128 |
assert(embedding); |
1
by brian
clean slate |
1129 |
ptr= embedding; |
1130 |
join_list= ptr->join_list; |
|
1131 |
embedding= ptr->embedding; |
|
1132 |
nested_join= ptr->nested_join; |
|
1133 |
if (nested_join->join_list.elements == 1) |
|
1134 |
{
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1135 |
TableList *embedded= nested_join->join_list.head(); |
1
by brian
clean slate |
1136 |
join_list->pop(); |
1137 |
embedded->join_list= join_list; |
|
1138 |
embedded->embedding= embedding; |
|
1139 |
join_list->push_front(embedded); |
|
1140 |
ptr= embedded; |
|
1141 |
}
|
|
1142 |
else if (nested_join->join_list.elements == 0) |
|
1143 |
{
|
|
1144 |
join_list->pop(); |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1145 |
ptr= NULL; // return value |
1
by brian
clean slate |
1146 |
}
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1147 |
return ptr; |
1
by brian
clean slate |
1148 |
}
|
1149 |
||
1150 |
||
1151 |
/**
|
|
1152 |
Nest last join operation.
|
|
1153 |
||
1154 |
The function nest last join operation as if it was enclosed in braces.
|
|
1155 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1156 |
@param session current thread
|
1
by brian
clean slate |
1157 |
|
1158 |
@retval
|
|
1159 |
0 Error
|
|
1160 |
@retval
|
|
327.2.4
by Brian Aker
Refactoring table.h |
1161 |
\# Pointer to TableList element created for the new nested join
|
1
by brian
clean slate |
1162 |
*/
|
1163 |
||
846
by Brian Aker
Removing on typedeffed class. |
1164 |
TableList *Select_Lex::nest_last_join(Session *session) |
1
by brian
clean slate |
1165 |
{
|
327.2.4
by Brian Aker
Refactoring table.h |
1166 |
TableList *ptr; |
1167 |
nested_join_st *nested_join; |
|
1168 |
List<TableList> *embedded_list; |
|
1
by brian
clean slate |
1169 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1170 |
if (!(ptr= (TableList*) session->calloc(ALIGN_SIZE(sizeof(TableList))+ |
327.2.4
by Brian Aker
Refactoring table.h |
1171 |
sizeof(nested_join_st)))) |
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1172 |
return NULL; |
1
by brian
clean slate |
1173 |
nested_join= ptr->nested_join= |
481
by Brian Aker
Remove all of uchar. |
1174 |
((nested_join_st*) ((unsigned char*) ptr + ALIGN_SIZE(sizeof(TableList)))); |
1
by brian
clean slate |
1175 |
|
1176 |
ptr->embedding= embedding; |
|
1177 |
ptr->join_list= join_list; |
|
1178 |
ptr->alias= (char*) "(nest_last_join)"; |
|
1179 |
embedded_list= &nested_join->join_list; |
|
1180 |
embedded_list->empty(); |
|
1181 |
||
438.1.13
by Brian Aker
uint cleanup. |
1182 |
for (uint32_t i=0; i < 2; i++) |
1
by brian
clean slate |
1183 |
{
|
327.2.4
by Brian Aker
Refactoring table.h |
1184 |
TableList *table= join_list->pop(); |
1
by brian
clean slate |
1185 |
table->join_list= embedded_list; |
1186 |
table->embedding= ptr; |
|
1187 |
embedded_list->push_back(table); |
|
1188 |
if (table->natural_join) |
|
1189 |
{
|
|
55
by brian
Update for using real bool types. |
1190 |
ptr->is_natural_join= true; |
1
by brian
clean slate |
1191 |
/*
|
1192 |
If this is a JOIN ... USING, move the list of joined fields to the
|
|
1193 |
table reference that describes the join.
|
|
1194 |
*/
|
|
1195 |
if (prev_join_using) |
|
1196 |
ptr->join_using_fields= prev_join_using; |
|
1197 |
}
|
|
1198 |
}
|
|
1199 |
join_list->push_front(ptr); |
|
1200 |
nested_join->used_tables= nested_join->not_null_tables= (table_map) 0; |
|
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1201 |
return ptr; |
1
by brian
clean slate |
1202 |
}
|
1203 |
||
1204 |
||
1205 |
/**
|
|
1206 |
Add a table to the current join list.
|
|
1207 |
||
1208 |
The function puts a table in front of the current join list
|
|
846
by Brian Aker
Removing on typedeffed class. |
1209 |
of Select_Lex object.
|
1
by brian
clean slate |
1210 |
Thus, joined tables are put into this list in the reverse order
|
1211 |
(the most outer join operation follows first).
|
|
1212 |
||
1213 |
@param table the table to add
|
|
1214 |
||
1215 |
@return
|
|
1216 |
None
|
|
1217 |
*/
|
|
1218 |
||
846
by Brian Aker
Removing on typedeffed class. |
1219 |
void Select_Lex::add_joined_table(TableList *table) |
1
by brian
clean slate |
1220 |
{
|
1221 |
join_list->push_front(table); |
|
1222 |
table->join_list= join_list; |
|
1223 |
table->embedding= embedding; |
|
1224 |
}
|
|
1225 |
||
1226 |
||
1227 |
/**
|
|
1228 |
Convert a right join into equivalent left join.
|
|
1229 |
||
1230 |
The function takes the current join list t[0],t[1] ... and
|
|
1231 |
effectively converts it into the list t[1],t[0] ...
|
|
1232 |
Although the outer_join flag for the new nested table contains
|
|
1233 |
JOIN_TYPE_RIGHT, it will be handled as the inner table of a left join
|
|
1234 |
operation.
|
|
1235 |
||
1236 |
EXAMPLES
|
|
1237 |
@verbatim
|
|
1238 |
SELECT * FROM t1 RIGHT JOIN t2 ON on_expr =>
|
|
1239 |
SELECT * FROM t2 LEFT JOIN t1 ON on_expr
|
|
1240 |
||
1241 |
SELECT * FROM t1,t2 RIGHT JOIN t3 ON on_expr =>
|
|
1242 |
SELECT * FROM t1,t3 LEFT JOIN t2 ON on_expr
|
|
1243 |
||
1244 |
SELECT * FROM t1,t2 RIGHT JOIN (t3,t4) ON on_expr =>
|
|
1245 |
SELECT * FROM t1,(t3,t4) LEFT JOIN t2 ON on_expr
|
|
1246 |
||
1247 |
SELECT * FROM t1 LEFT JOIN t2 ON on_expr1 RIGHT JOIN t3 ON on_expr2 =>
|
|
1248 |
SELECT * FROM t3 LEFT JOIN (t1 LEFT JOIN t2 ON on_expr2) ON on_expr1
|
|
1249 |
@endverbatim
|
|
1250 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1251 |
@param session current thread
|
1
by brian
clean slate |
1252 |
|
1253 |
@return
|
|
1254 |
- Pointer to the table representing the inner table, if success
|
|
1255 |
- 0, otherwise
|
|
1256 |
*/
|
|
1257 |
||
846
by Brian Aker
Removing on typedeffed class. |
1258 |
TableList *Select_Lex::convert_right_join() |
1
by brian
clean slate |
1259 |
{
|
327.2.4
by Brian Aker
Refactoring table.h |
1260 |
TableList *tab2= join_list->pop(); |
1261 |
TableList *tab1= join_list->pop(); |
|
1
by brian
clean slate |
1262 |
|
1263 |
join_list->push_front(tab2); |
|
1264 |
join_list->push_front(tab1); |
|
1265 |
tab1->outer_join|= JOIN_TYPE_RIGHT; |
|
1266 |
||
1054.1.5
by Brian Aker
Formatting/remove dead variables. |
1267 |
return tab1; |
1
by brian
clean slate |
1268 |
}
|
1269 |
||
1270 |
/**
|
|
1271 |
Set lock for all tables in current select level.
|
|
1272 |
||
1273 |
@param lock_type Lock to set for tables
|
|
1274 |
||
1275 |
@note
|
|
1276 |
If lock is a write lock, then tables->updating is set 1
|
|
1277 |
This is to get tables_ok to know that the table is updated by the
|
|
1278 |
query
|
|
1279 |
*/
|
|
1280 |
||
846
by Brian Aker
Removing on typedeffed class. |
1281 |
void Select_Lex::set_lock_for_tables(thr_lock_type lock_type) |
1
by brian
clean slate |
1282 |
{
|
1283 |
bool for_update= lock_type >= TL_READ_NO_INSERT; |
|
1284 |
||
327.2.4
by Brian Aker
Refactoring table.h |
1285 |
for (TableList *tables= (TableList*) table_list.first; |
1
by brian
clean slate |
1286 |
tables; |
1287 |
tables= tables->next_local) |
|
1288 |
{
|
|
1289 |
tables->lock_type= lock_type; |
|
1290 |
tables->updating= for_update; |
|
1291 |
}
|
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1292 |
return; |
1
by brian
clean slate |
1293 |
}
|
1294 |
||
1295 |
||
1296 |
/**
|
|
846
by Brian Aker
Removing on typedeffed class. |
1297 |
Create a fake Select_Lex for a unit.
|
1
by brian
clean slate |
1298 |
|
846
by Brian Aker
Removing on typedeffed class. |
1299 |
The method create a fake Select_Lex object for a unit.
|
1
by brian
clean slate |
1300 |
This object is created for any union construct containing a union
|
1301 |
operation and also for any single select union construct of the form
|
|
1302 |
@verbatim
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1303 |
(SELECT ... order_st BY order_list [LIMIT n]) order_st BY ...
|
1
by brian
clean slate |
1304 |
@endvarbatim
|
1305 |
or of the form
|
|
1306 |
@varbatim
|
|
327.2.3
by Brian Aker
Refactoring of class Table |
1307 |
(SELECT ... order_st BY LIMIT n) order_st BY ...
|
1
by brian
clean slate |
1308 |
@endvarbatim
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1309 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1310 |
@param session_arg thread handle
|
1
by brian
clean slate |
1311 |
|
1312 |
@note
|
|
1313 |
The object is used to retrieve rows from the temporary table
|
|
1314 |
where the result on the union is obtained.
|
|
1315 |
||
1316 |
@retval
|
|
1317 |
1 on failure to create the object
|
|
1318 |
@retval
|
|
1319 |
0 on success
|
|
1320 |
*/
|
|
1321 |
||
848
by Brian Aker
typdef class removal (just... use the name of the class). |
1322 |
bool Select_Lex_Unit::add_fake_select_lex(Session *session_arg) |
1
by brian
clean slate |
1323 |
{
|
846
by Brian Aker
Removing on typedeffed class. |
1324 |
Select_Lex *first_sl= first_select(); |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1325 |
assert(!fake_select_lex); |
1
by brian
clean slate |
1326 |
|
846
by Brian Aker
Removing on typedeffed class. |
1327 |
if (!(fake_select_lex= new (session_arg->mem_root) Select_Lex())) |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1328 |
return(1); |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1329 |
fake_select_lex->include_standalone(this, |
847
by Brian Aker
More typdef class removal. |
1330 |
(Select_Lex_Node**)&fake_select_lex); |
1
by brian
clean slate |
1331 |
fake_select_lex->select_number= INT_MAX; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1332 |
fake_select_lex->parent_lex= session_arg->lex; /* Used in init_query. */ |
1
by brian
clean slate |
1333 |
fake_select_lex->make_empty_select(); |
1334 |
fake_select_lex->linkage= GLOBAL_OPTIONS_TYPE; |
|
1335 |
fake_select_lex->select_limit= 0; |
|
1336 |
||
1337 |
fake_select_lex->context.outer_context=first_sl->context.outer_context; |
|
327.2.3
by Brian Aker
Refactoring of class Table |
1338 |
/* allow item list resolving in fake select for order_st BY */
|
55
by brian
Update for using real bool types. |
1339 |
fake_select_lex->context.resolve_in_select_list= true; |
1
by brian
clean slate |
1340 |
fake_select_lex->context.select_lex= fake_select_lex; |
1341 |
||
1342 |
if (!is_union()) |
|
1343 |
{
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1344 |
/*
|
1345 |
This works only for
|
|
327.2.3
by Brian Aker
Refactoring of class Table |
1346 |
(SELECT ... order_st BY list [LIMIT n]) order_st BY order_list [LIMIT m],
|
1347 |
(SELECT ... LIMIT n) order_st BY order_list [LIMIT m]
|
|
1
by brian
clean slate |
1348 |
just before the parser starts processing order_list
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1349 |
*/
|
1
by brian
clean slate |
1350 |
global_parameters= fake_select_lex; |
1351 |
fake_select_lex->no_table_names_allowed= 1; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1352 |
session_arg->lex->current_select= fake_select_lex; |
1
by brian
clean slate |
1353 |
}
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1354 |
session_arg->lex->pop_context(); |
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1355 |
return(0); |
1
by brian
clean slate |
1356 |
}
|
1357 |
||
1358 |
||
1359 |
/**
|
|
1360 |
Push a new name resolution context for a JOIN ... ON clause to the
|
|
1361 |
context stack of a query block.
|
|
1362 |
||
1363 |
Create a new name resolution context for a JOIN ... ON clause,
|
|
1364 |
set the first and last leaves of the list of table references
|
|
1365 |
to be used for name resolution, and push the newly created
|
|
1366 |
context to the stack of contexts of the query.
|
|
1367 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1368 |
@param session pointer to current thread
|
1
by brian
clean slate |
1369 |
@param left_op left operand of the JOIN
|
1370 |
@param right_op rigth operand of the JOIN
|
|
1371 |
||
1372 |
@retval
|
|
55
by brian
Update for using real bool types. |
1373 |
false if all is OK
|
1
by brian
clean slate |
1374 |
@retval
|
55
by brian
Update for using real bool types. |
1375 |
true if a memory allocation error occured
|
1
by brian
clean slate |
1376 |
*/
|
1377 |
||
1378 |
bool
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1379 |
push_new_name_resolution_context(Session *session, |
327.2.4
by Brian Aker
Refactoring table.h |
1380 |
TableList *left_op, TableList *right_op) |
1
by brian
clean slate |
1381 |
{
|
1382 |
Name_resolution_context *on_context; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1383 |
if (!(on_context= new (session->mem_root) Name_resolution_context)) |
55
by brian
Update for using real bool types. |
1384 |
return true; |
1
by brian
clean slate |
1385 |
on_context->init(); |
1386 |
on_context->first_name_resolution_table= |
|
1387 |
left_op->first_leaf_for_name_resolution(); |
|
1388 |
on_context->last_name_resolution_table= |
|
1389 |
right_op->last_leaf_for_name_resolution(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1390 |
return session->lex->push_context(on_context); |
1
by brian
clean slate |
1391 |
}
|
1392 |
||
1393 |
||
1394 |
/**
|
|
1395 |
Add an ON condition to the second operand of a JOIN ... ON.
|
|
1396 |
||
1397 |
Add an ON condition to the right operand of a JOIN ... ON clause.
|
|
1398 |
||
1399 |
@param b the second operand of a JOIN ... ON
|
|
1400 |
@param expr the condition to be added to the ON clause
|
|
1401 |
||
1402 |
@retval
|
|
55
by brian
Update for using real bool types. |
1403 |
false if there was some error
|
1
by brian
clean slate |
1404 |
@retval
|
55
by brian
Update for using real bool types. |
1405 |
true if all is OK
|
1
by brian
clean slate |
1406 |
*/
|
1407 |
||
327.2.4
by Brian Aker
Refactoring table.h |
1408 |
void add_join_on(TableList *b, Item *expr) |
1
by brian
clean slate |
1409 |
{
|
1410 |
if (expr) |
|
1411 |
{
|
|
1412 |
if (!b->on_expr) |
|
1413 |
b->on_expr= expr; |
|
1414 |
else
|
|
1415 |
{
|
|
1416 |
/*
|
|
1417 |
If called from the parser, this happens if you have both a
|
|
1418 |
right and left join. If called later, it happens if we add more
|
|
1419 |
than one condition to the ON clause.
|
|
1420 |
*/
|
|
1421 |
b->on_expr= new Item_cond_and(b->on_expr,expr); |
|
1422 |
}
|
|
1423 |
b->on_expr->top_level_item(); |
|
1424 |
}
|
|
1425 |
}
|
|
1426 |
||
1427 |
||
1428 |
/**
|
|
1429 |
Mark that there is a NATURAL JOIN or JOIN ... USING between two
|
|
1430 |
tables.
|
|
1431 |
||
1432 |
This function marks that table b should be joined with a either via
|
|
1433 |
a NATURAL JOIN or via JOIN ... USING. Both join types are special
|
|
1434 |
cases of each other, so we treat them together. The function
|
|
1435 |
setup_conds() creates a list of equal condition between all fields
|
|
1436 |
of the same name for NATURAL JOIN or the fields in 'using_fields'
|
|
1437 |
for JOIN ... USING. The list of equality conditions is stored
|
|
1438 |
either in b->on_expr, or in JOIN::conds, depending on whether there
|
|
1439 |
was an outer join.
|
|
1440 |
||
1441 |
EXAMPLE
|
|
1442 |
@verbatim
|
|
1443 |
SELECT * FROM t1 NATURAL LEFT JOIN t2
|
|
1444 |
<=>
|
|
1445 |
SELECT * FROM t1 LEFT JOIN t2 ON (t1.i=t2.i and t1.j=t2.j ... )
|
|
1446 |
||
1447 |
SELECT * FROM t1 NATURAL JOIN t2 WHERE <some_cond>
|
|
1448 |
<=>
|
|
1449 |
SELECT * FROM t1, t2 WHERE (t1.i=t2.i and t1.j=t2.j and <some_cond>)
|
|
1450 |
||
1451 |
SELECT * FROM t1 JOIN t2 USING(j) WHERE <some_cond>
|
|
1452 |
<=>
|
|
1453 |
SELECT * FROM t1, t2 WHERE (t1.j=t2.j and <some_cond>)
|
|
1454 |
@endverbatim
|
|
1455 |
||
1456 |
@param a Left join argument
|
|
1457 |
@param b Right join argument
|
|
1458 |
@param using_fields Field names from USING clause
|
|
1459 |
*/
|
|
1460 |
||
327.2.4
by Brian Aker
Refactoring table.h |
1461 |
void add_join_natural(TableList *a, TableList *b, List<String> *using_fields, |
846
by Brian Aker
Removing on typedeffed class. |
1462 |
Select_Lex *lex) |
1
by brian
clean slate |
1463 |
{
|
1464 |
b->natural_join= a; |
|
1465 |
lex->prev_join_using= using_fields; |
|
1466 |
}
|
|
1467 |
||
1468 |
||
1469 |
/**
|
|
1470 |
kill on thread.
|
|
1471 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1472 |
@param session Thread class
|
1
by brian
clean slate |
1473 |
@param id Thread id
|
1474 |
@param only_kill_query Should it kill the query or the connection
|
|
1475 |
||
1476 |
@note
|
|
1477 |
This is written such that we have a short lock on LOCK_thread_count
|
|
1478 |
*/
|
|
1479 |
||
230.1.9
by Monty Taylor
Merged in remove-include-dir. |
1480 |
static unsigned int |
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
1481 |
kill_one_thread(Session *, ulong id, bool only_kill_query) |
1
by brian
clean slate |
1482 |
{
|
1014.7.3
by Nathan Williams
Reformatted refactored bits per monty's suggestion. |
1483 |
Session *tmp= NULL; |
438.1.13
by Brian Aker
uint cleanup. |
1484 |
uint32_t error=ER_NO_SUCH_THREAD; |
398.1.10
by Monty Taylor
Actually removed VOID() this time. |
1485 |
pthread_mutex_lock(&LOCK_thread_count); // For unlink from list |
1014.7.1
by Nathan Williams
Replaced global I_List<Session> with std::vector<Session*> |
1486 |
|
1241.9.17
by Monty Taylor
Removed more bits from server_includes. |
1487 |
for( vector<Session*>::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it ) |
1
by brian
clean slate |
1488 |
{
|
1014.7.3
by Nathan Williams
Reformatted refactored bits per monty's suggestion. |
1489 |
if ((*it)->thread_id == id) |
1
by brian
clean slate |
1490 |
{
|
1014.7.3
by Nathan Williams
Reformatted refactored bits per monty's suggestion. |
1491 |
tmp= *it; |
1
by brian
clean slate |
1492 |
pthread_mutex_lock(&tmp->LOCK_delete); // Lock from delete |
1493 |
break; |
|
1494 |
}
|
|
1495 |
}
|
|
398.1.10
by Monty Taylor
Actually removed VOID() this time. |
1496 |
pthread_mutex_unlock(&LOCK_thread_count); |
1
by brian
clean slate |
1497 |
if (tmp) |
1498 |
{
|
|
520.1.21
by Brian Aker
THD -> Session rename |
1499 |
tmp->awake(only_kill_query ? Session::KILL_QUERY : Session::KILL_CONNECTION); |
1
by brian
clean slate |
1500 |
error=0; |
1501 |
pthread_mutex_unlock(&tmp->LOCK_delete); |
|
1502 |
}
|
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1503 |
return(error); |
1
by brian
clean slate |
1504 |
}
|
1505 |
||
1506 |
||
1507 |
/*
|
|
1508 |
kills a thread and sends response
|
|
1509 |
||
1510 |
SYNOPSIS
|
|
1511 |
sql_kill()
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1512 |
session Thread class
|
1
by brian
clean slate |
1513 |
id Thread id
|
1514 |
only_kill_query Should it kill the query or the connection
|
|
1515 |
*/
|
|
1516 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1517 |
void sql_kill(Session *session, ulong id, bool only_kill_query) |
1
by brian
clean slate |
1518 |
{
|
438.1.13
by Brian Aker
uint cleanup. |
1519 |
uint32_t error; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1520 |
if (!(error= kill_one_thread(session, id, only_kill_query))) |
836
by Brian Aker
Fixed session call from function to method. |
1521 |
session->my_ok(); |
1
by brian
clean slate |
1522 |
else
|
1523 |
my_error(error, MYF(0), id); |
|
1524 |
}
|
|
1525 |
||
1526 |
||
1527 |
/**
|
|
1528 |
Check if the select is a simple select (not an union).
|
|
1529 |
||
1530 |
@retval
|
|
1531 |
0 ok
|
|
1532 |
@retval
|
|
1533 |
1 error ; In this case the error messege is sent to the client
|
|
1534 |
*/
|
|
1535 |
||
1536 |
bool check_simple_select() |
|
1537 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1538 |
Session *session= current_session; |
1539 |
LEX *lex= session->lex; |
|
1
by brian
clean slate |
1540 |
if (lex->current_select != &lex->select_lex) |
1541 |
{
|
|
1542 |
char command[80]; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1543 |
Lex_input_stream *lip= session->m_lip; |
629.5.2
by Toru Maesaka
Second pass of replacing MySQL's strmake() with libc calls |
1544 |
strncpy(command, lip->yylval->symbol.str, |
1067.4.4
by Nathan Williams
The rest of the files in the drizzled directory were purged of the cmin macro and replace with std::min (except for the definition in globals.h and 1 usage in stacktrace.cc). |
1545 |
min(lip->yylval->symbol.length, (uint32_t)(sizeof(command)-1))); |
1546 |
command[min(lip->yylval->symbol.length, (uint32_t)(sizeof(command)-1))]=0; |
|
1
by brian
clean slate |
1547 |
my_error(ER_CANT_USE_OPTION_HERE, MYF(0), command); |
1548 |
return 1; |
|
1549 |
}
|
|
1550 |
return 0; |
|
1551 |
}
|
|
1552 |
||
1553 |
||
1554 |
/**
|
|
1555 |
Construct ALL/ANY/SOME subquery Item.
|
|
1556 |
||
1557 |
@param left_expr pointer to left expression
|
|
1558 |
@param cmp compare function creator
|
|
1559 |
@param all true if we create ALL subquery
|
|
1560 |
@param select_lex pointer on parsed subquery structure
|
|
1561 |
||
1562 |
@return
|
|
1563 |
constructed Item (or 0 if out of memory)
|
|
1564 |
*/
|
|
1565 |
Item * all_any_subquery_creator(Item *left_expr, |
|
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
1566 |
chooser_compare_func_creator cmp, |
1567 |
bool all, |
|
846
by Brian Aker
Removing on typedeffed class. |
1568 |
Select_Lex *select_lex) |
1
by brian
clean slate |
1569 |
{
|
1570 |
if ((cmp == &comp_eq_creator) && !all) // = ANY <=> IN |
|
1571 |
return new Item_in_subselect(left_expr, select_lex); |
|
1572 |
||
1573 |
if ((cmp == &comp_ne_creator) && all) // <> ALL <=> NOT IN |
|
1574 |
return new Item_func_not(new Item_in_subselect(left_expr, select_lex)); |
|
1575 |
||
1576 |
Item_allany_subselect *it= |
|
1577 |
new Item_allany_subselect(left_expr, cmp, select_lex, all); |
|
1578 |
if (all) |
|
1579 |
return it->upper_item= new Item_func_not_all(it); /* ALL */ |
|
1580 |
||
1581 |
return it->upper_item= new Item_func_nop_all(it); /* ANY/SOME */ |
|
1582 |
}
|
|
1583 |
||
1584 |
||
1585 |
/**
|
|
826
by Brian Aker
Simplify update |
1586 |
Update query pre-check.
|
1
by brian
clean slate |
1587 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1588 |
@param session Thread handler
|
1
by brian
clean slate |
1589 |
@param tables Global/local table list (have to be the same)
|
1590 |
||
1591 |
@retval
|
|
55
by brian
Update for using real bool types. |
1592 |
false OK
|
1
by brian
clean slate |
1593 |
@retval
|
55
by brian
Update for using real bool types. |
1594 |
true Error
|
1
by brian
clean slate |
1595 |
*/
|
1596 |
||
826
by Brian Aker
Simplify update |
1597 |
bool update_precheck(Session *session, TableList *) |
1
by brian
clean slate |
1598 |
{
|
1599 |
const char *msg= 0; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1600 |
LEX *lex= session->lex; |
846
by Brian Aker
Removing on typedeffed class. |
1601 |
Select_Lex *select_lex= &lex->select_lex; |
1
by brian
clean slate |
1602 |
|
826
by Brian Aker
Simplify update |
1603 |
if (session->lex->select_lex.item_list.elements != session->lex->value_list.elements) |
1
by brian
clean slate |
1604 |
{
|
1605 |
my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0)); |
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1606 |
return(true); |
1
by brian
clean slate |
1607 |
}
|
1608 |
||
826
by Brian Aker
Simplify update |
1609 |
if (session->lex->select_lex.table_list.elements > 1) |
1
by brian
clean slate |
1610 |
{
|
826
by Brian Aker
Simplify update |
1611 |
if (select_lex->order_list.elements) |
1612 |
msg= "ORDER BY"; |
|
1613 |
else if (select_lex->select_limit) |
|
1614 |
msg= "LIMIT"; |
|
1615 |
if (msg) |
|
1616 |
{
|
|
1617 |
my_error(ER_WRONG_USAGE, MYF(0), "UPDATE", msg); |
|
1618 |
return(true); |
|
1619 |
}
|
|
1
by brian
clean slate |
1620 |
}
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1621 |
return(false); |
1
by brian
clean slate |
1622 |
}
|
1623 |
||
1624 |
||
1625 |
/**
|
|
1626 |
simple INSERT query pre-check.
|
|
1627 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1628 |
@param session Thread handler
|
1
by brian
clean slate |
1629 |
@param tables Global table list
|
1630 |
||
1631 |
@retval
|
|
55
by brian
Update for using real bool types. |
1632 |
false OK
|
1
by brian
clean slate |
1633 |
@retval
|
55
by brian
Update for using real bool types. |
1634 |
true error
|
1
by brian
clean slate |
1635 |
*/
|
1636 |
||
575.1.2
by Monty Taylor
Changed a bunch of __attribute__((unused)) to removing the parameter name instead. |
1637 |
bool insert_precheck(Session *session, TableList *) |
1
by brian
clean slate |
1638 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1639 |
LEX *lex= session->lex; |
1
by brian
clean slate |
1640 |
|
1641 |
/*
|
|
1642 |
Check that we have modify privileges for the first table and
|
|
1643 |
select privileges for the rest
|
|
1644 |
*/
|
|
1645 |
if (lex->update_list.elements != lex->value_list.elements) |
|
1646 |
{
|
|
1647 |
my_message(ER_WRONG_VALUE_COUNT, ER(ER_WRONG_VALUE_COUNT), MYF(0)); |
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1648 |
return(true); |
1
by brian
clean slate |
1649 |
}
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1650 |
return(false); |
1
by brian
clean slate |
1651 |
}
|
1652 |
||
1653 |
||
1654 |
/**
|
|
1655 |
CREATE TABLE query pre-check.
|
|
1656 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1657 |
@param session Thread handler
|
1
by brian
clean slate |
1658 |
@param tables Global table list
|
1659 |
@param create_table Table which will be created
|
|
1660 |
||
1661 |
@retval
|
|
55
by brian
Update for using real bool types. |
1662 |
false OK
|
1
by brian
clean slate |
1663 |
@retval
|
55
by brian
Update for using real bool types. |
1664 |
true Error
|
1
by brian
clean slate |
1665 |
*/
|
1666 |
||
1223.4.1
by Brian Aker
Table Identifier patch. |
1667 |
bool create_table_precheck(TableIdentifier &identifier) |
1
by brian
clean slate |
1668 |
{
|
1223.4.1
by Brian Aker
Table Identifier patch. |
1669 |
if (strcmp(identifier.getDBName(), "information_schema") == 0) |
1
by brian
clean slate |
1670 |
{
|
575.4.7
by Monty Taylor
More header cleanup. |
1671 |
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), "", "", INFORMATION_SCHEMA_NAME.c_str()); |
1223.4.1
by Brian Aker
Table Identifier patch. |
1672 |
return true; |
1
by brian
clean slate |
1673 |
}
|
1674 |
||
1223.4.1
by Brian Aker
Table Identifier patch. |
1675 |
return false; |
1
by brian
clean slate |
1676 |
}
|
1677 |
||
1678 |
||
1679 |
/**
|
|
1680 |
negate given expression.
|
|
1681 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1682 |
@param session thread handler
|
1
by brian
clean slate |
1683 |
@param expr expression for negation
|
1684 |
||
1685 |
@return
|
|
1686 |
negated expression
|
|
1687 |
*/
|
|
1688 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1689 |
Item *negate_expression(Session *session, Item *expr) |
1
by brian
clean slate |
1690 |
{
|
1691 |
Item *negated; |
|
1692 |
if (expr->type() == Item::FUNC_ITEM && |
|
1693 |
((Item_func *) expr)->functype() == Item_func::NOT_FUNC) |
|
1694 |
{
|
|
1695 |
/* it is NOT(NOT( ... )) */
|
|
1696 |
Item *arg= ((Item_func *) expr)->arguments()[0]; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1697 |
enum_parsing_place place= session->lex->current_select->parsing_place; |
1
by brian
clean slate |
1698 |
if (arg->is_bool_func() || place == IN_WHERE || place == IN_HAVING) |
1699 |
return arg; |
|
1700 |
/*
|
|
1701 |
if it is not boolean function then we have to emulate value of
|
|
1702 |
not(not(a)), it will be a != 0
|
|
1703 |
*/
|
|
1704 |
return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1)); |
|
1705 |
}
|
|
1706 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1707 |
if ((negated= expr->neg_transformer(session)) != 0) |
1
by brian
clean slate |
1708 |
return negated; |
1709 |
return new Item_func_not(expr); |
|
1710 |
}
|
|
1711 |
||
1712 |
||
1713 |
/*
|
|
1714 |
Check that char length of a string does not exceed some limit.
|
|
1715 |
||
1716 |
SYNOPSIS
|
|
1717 |
check_string_char_length()
|
|
1718 |
str string to be checked
|
|
1719 |
err_msg error message to be displayed if the string is too long
|
|
1720 |
max_char_length max length in symbols
|
|
1721 |
cs string charset
|
|
1722 |
||
1723 |
RETURN
|
|
55
by brian
Update for using real bool types. |
1724 |
false the passed string is not longer than max_char_length
|
1725 |
true the passed string is longer than max_char_length
|
|
1
by brian
clean slate |
1726 |
*/
|
1727 |
||
1728 |
||
1729 |
bool check_string_char_length(LEX_STRING *str, const char *err_msg, |
|
438.1.13
by Brian Aker
uint cleanup. |
1730 |
uint32_t max_char_length, const CHARSET_INFO * const cs, |
1
by brian
clean slate |
1731 |
bool no_error) |
1732 |
{
|
|
1733 |
int well_formed_error; |
|
438.1.13
by Brian Aker
uint cleanup. |
1734 |
uint32_t res= cs->cset->well_formed_len(cs, str->str, str->str + str->length, |
1
by brian
clean slate |
1735 |
max_char_length, &well_formed_error); |
1736 |
||
1737 |
if (!well_formed_error && str->length == res) |
|
55
by brian
Update for using real bool types. |
1738 |
return false; |
1
by brian
clean slate |
1739 |
|
1740 |
if (!no_error) |
|
1741 |
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_char_length); |
|
55
by brian
Update for using real bool types. |
1742 |
return true; |
1
by brian
clean slate |
1743 |
}
|
1744 |
||
1745 |
||
575.4.7
by Monty Taylor
More header cleanup. |
1746 |
bool check_identifier_name(LEX_STRING *str, uint32_t err_code, |
1747 |
uint32_t max_char_length, |
|
1748 |
const char *param_for_err_msg) |
|
1
by brian
clean slate |
1749 |
{
|
1750 |
/*
|
|
1751 |
We don't support non-BMP characters in identifiers at the moment,
|
|
1752 |
so they should be prohibited until such support is done.
|
|
1753 |
This is why we use the 3-byte utf8 to check well-formedness here.
|
|
1754 |
*/
|
|
760
by Brian Aker
Cleanup around UTf8 code. |
1755 |
const CHARSET_INFO * const cs= &my_charset_utf8mb4_general_ci; |
1756 |
||
1
by brian
clean slate |
1757 |
int well_formed_error; |
438.1.13
by Brian Aker
uint cleanup. |
1758 |
uint32_t res= cs->cset->well_formed_len(cs, str->str, str->str + str->length, |
1
by brian
clean slate |
1759 |
max_char_length, &well_formed_error); |
1760 |
||
1761 |
if (well_formed_error) |
|
1762 |
{
|
|
1763 |
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), "identifier", str->str); |
|
55
by brian
Update for using real bool types. |
1764 |
return true; |
1
by brian
clean slate |
1765 |
}
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
1766 |
|
1
by brian
clean slate |
1767 |
if (str->length == res) |
55
by brian
Update for using real bool types. |
1768 |
return false; |
1
by brian
clean slate |
1769 |
|
1770 |
switch (err_code) |
|
1771 |
{
|
|
1772 |
case 0: |
|
1773 |
break; |
|
1774 |
case ER_WRONG_STRING_LENGTH: |
|
1775 |
my_error(err_code, MYF(0), str->str, param_for_err_msg, max_char_length); |
|
1776 |
break; |
|
1777 |
case ER_TOO_LONG_IDENT: |
|
1778 |
my_error(err_code, MYF(0), str->str); |
|
1779 |
break; |
|
1780 |
default: |
|
51.1.61
by Jay Pipes
Removed/replaced BUG symbols and standardized TRUE/FALSE |
1781 |
assert(0); |
1
by brian
clean slate |
1782 |
break; |
1783 |
}
|
|
55
by brian
Update for using real bool types. |
1784 |
return true; |
1
by brian
clean slate |
1785 |
}
|
1786 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1787 |
extern int DRIZZLEparse(void *session); // from sql_yacc.cc |
1
by brian
clean slate |
1788 |
|
1789 |
||
1790 |
/**
|
|
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1791 |
This is a wrapper of DRIZZLEparse(). All the code should call parse_sql()
|
1792 |
instead of DRIZZLEparse().
|
|
1
by brian
clean slate |
1793 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1794 |
@param session Thread context.
|
1
by brian
clean slate |
1795 |
@param lip Lexer context.
|
1796 |
||
1797 |
@return Error status.
|
|
55
by brian
Update for using real bool types. |
1798 |
@retval false on success.
|
1799 |
@retval true on parsing error.
|
|
1
by brian
clean slate |
1800 |
*/
|
1801 |
||
1165.1.48
by Stewart Smith
make parse_sql static to sql_parse.cc |
1802 |
static bool parse_sql(Session *session, Lex_input_stream *lip) |
1
by brian
clean slate |
1803 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1804 |
assert(session->m_lip == NULL); |
1
by brian
clean slate |
1805 |
|
1126.10.15
by Padraig O'Sullivan
Added calls to the parsing related dtrace probes. |
1806 |
DRIZZLE_QUERY_PARSE_START(session->query); |
1807 |
||
1
by brian
clean slate |
1808 |
/* Set Lex_input_stream. */
|
1809 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1810 |
session->m_lip= lip; |
1
by brian
clean slate |
1811 |
|
1812 |
/* Parse the query. */
|
|
1813 |
||
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1814 |
bool mysql_parse_status= DRIZZLEparse(session) != 0; |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1815 |
|
520.4.50
by Monty Taylor
Finish changing the bison namespace argument from MYSQL to DRIZZLE |
1816 |
/* Check that if DRIZZLEparse() failed, session->is_error() is set. */
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1817 |
|
1818 |
assert(!mysql_parse_status || session->is_error()); |
|
1
by brian
clean slate |
1819 |
|
1820 |
/* Reset Lex_input_stream. */
|
|
1821 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1822 |
session->m_lip= NULL; |
1
by brian
clean slate |
1823 |
|
1126.10.15
by Padraig O'Sullivan
Added calls to the parsing related dtrace probes. |
1824 |
DRIZZLE_QUERY_PARSE_DONE(mysql_parse_status || session->is_fatal_error); |
1825 |
||
1
by brian
clean slate |
1826 |
/* That's it. */
|
1827 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1828 |
return mysql_parse_status || session->is_fatal_error; |
1
by brian
clean slate |
1829 |
}
|
1830 |
||
1831 |
/**
|
|
1832 |
@} (end of group Runtime_Environment)
|
|
1833 |
*/
|