390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
1
by brian
clean slate |
19 |
|
20 |
||
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. |
21 |
#ifndef DRIZZLED_SESSION_H
|
22 |
#define DRIZZLED_SESSION_H
|
|
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
23 |
|
1
by brian
clean slate |
24 |
/* Classes in mysql */
|
538
by Monty Taylor
Moved gettext.h into drizzled in anticipation of the new client lib. |
25 |
|
971.3.48
by Eric Day
New Listen interface about done, not quite compiling yet, but need a backup. |
26 |
#include <drizzled/plugin/protocol.h> |
561.1.3
by Monty Taylor
Split some more things out of common_includes.h. |
27 |
#include <drizzled/sql_locale.h> |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
28 |
#include <drizzled/ha_trx_info.h> |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
29 |
#include <mysys/my_alloc.h> |
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
30 |
#include <mysys/my_tree.h> |
584.1.13
by Monty Taylor
Split out a little more code. Removed table_list.h from common_includes. |
31 |
#include <drizzled/handler.h> |
670.2.1
by Monty Taylor
Moved pthread keys |
32 |
#include <drizzled/current_session.h> |
584.1.14
by Monty Taylor
Removed field.h from common_includes. |
33 |
#include <drizzled/sql_error.h> |
831.1.3
by Brian Aker
Moved over file_exchange class. |
34 |
#include <drizzled/file_exchange.h> |
837
by Brian Aker
Reworked some classes out of session.h |
35 |
#include <drizzled/select_result_interceptor.h> |
934.2.4
by Jay Pipes
This changeset pulls check_user(), check_connection(), and login_connection() out of sql_connect.cc and makes them member methods of Session, where they belong. Also, made sure that functions that return a bool return true when it succeeds, and not false... |
36 |
#include <drizzled/authentication.h> |
37 |
#include <drizzled/db.h> |
|
934.2.15
by Jay Pipes
Pulls remainder of XID and xid_cache implementation into xid.cc and xid.h from drizzled/session.cc. |
38 |
#include <drizzled/xid.h> |
934.2.4
by Jay Pipes
This changeset pulls check_user(), check_connection(), and login_connection() out of sql_connect.cc and makes them member methods of Session, where they belong. Also, made sure that functions that return a bool return true when it succeeds, and not false... |
39 |
|
40 |
#include <netdb.h> |
|
694
by Brian Aker
Refactor out char* strdup for string class in user. |
41 |
#include <string> |
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
42 |
#include <bitset> |
1
by brian
clean slate |
43 |
|
934.2.4
by Jay Pipes
This changeset pulls check_user(), check_connection(), and login_connection() out of sql_connect.cc and makes them member methods of Session, where they belong. Also, made sure that functions that return a bool return true when it succeeds, and not false... |
44 |
#define MIN_HANDSHAKE_SIZE 6
|
45 |
||
1
by brian
clean slate |
46 |
class Lex_input_stream; |
584.1.12
by Monty Taylor
HA! Removed item.h from common_includes. woot. |
47 |
class user_var_entry; |
1052.2.2
by Nathan Williams
No actual code changes. Changed Copy_field to CopyField, to reflect the coding standards. |
48 |
class CopyField; |
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. |
49 |
class Table_ident; |
1
by brian
clean slate |
50 |
|
51 |
extern char internal_table_name[2]; |
|
52 |
extern char empty_c_string[1]; |
|
53 |
extern const char **errmesg; |
|
54 |
||
55 |
#define TC_HEURISTIC_RECOVER_COMMIT 1
|
|
56 |
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
|
|
482
by Brian Aker
Remove uint. |
57 |
extern uint32_t tc_heuristic_recover; |
1
by brian
clean slate |
58 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
59 |
/**
|
1
by brian
clean slate |
60 |
The COPY_INFO structure is used by INSERT/REPLACE code.
|
61 |
The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
|
|
62 |
UPDATE code:
|
|
63 |
If a row is inserted then the copied variable is incremented.
|
|
64 |
If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
|
|
65 |
new data differs from the old one then the copied and the updated
|
|
66 |
variables are incremented.
|
|
67 |
The touched variable is incremented if a row was touched by the update part
|
|
68 |
of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
|
|
69 |
was actually changed or not.
|
|
70 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
71 |
typedef struct st_copy_info |
72 |
{
|
|
1
by brian
clean slate |
73 |
ha_rows records; /**< Number of processed records */ |
74 |
ha_rows deleted; /**< Number of deleted records */ |
|
75 |
ha_rows updated; /**< Number of updated records */ |
|
76 |
ha_rows copied; /**< Number of copied records */ |
|
77 |
ha_rows error_count; |
|
78 |
ha_rows touched; /* Number of touched records */ |
|
79 |
enum enum_duplicates handle_duplicates; |
|
80 |
int escape_char, last_errno; |
|
81 |
bool ignore; |
|
82 |
/* for INSERT ... UPDATE */
|
|
83 |
List<Item> *update_fields; |
|
84 |
List<Item> *update_values; |
|
85 |
/* for VIEW ... WITH CHECK OPTION */
|
|
86 |
} COPY_INFO; |
|
87 |
||
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
88 |
typedef struct drizzled_lock_st |
1
by brian
clean slate |
89 |
{
|
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
90 |
Table **table; |
1054.1.6
by Brian Aker
Removed internal logic/dead variables for LOCK TABLES. |
91 |
uint32_t table_count; |
92 |
uint32_t lock_count; |
|
1
by brian
clean slate |
93 |
THR_LOCK_DATA **locks; |
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
94 |
} DRIZZLE_LOCK; |
1
by brian
clean slate |
95 |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
96 |
#include <drizzled/lex_column.h> |
1
by brian
clean slate |
97 |
|
98 |
class select_result; |
|
99 |
class Time_zone; |
|
100 |
||
520.1.21
by Brian Aker
THD -> Session rename |
101 |
#define Session_SENTRY_MAGIC 0xfeedd1ff
|
102 |
#define Session_SENTRY_GONE 0xdeadbeef
|
|
1
by brian
clean slate |
103 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
104 |
#define Session_CHECK_SENTRY(session) assert(session->dbug_sentry == Session_SENTRY_MAGIC)
|
1
by brian
clean slate |
105 |
|
106 |
struct system_variables |
|
107 |
{
|
|
896.1.4
by Monty Taylor
Fixed compiler warnings. |
108 |
system_variables() {}; |
1
by brian
clean slate |
109 |
/*
|
110 |
How dynamically allocated system variables are handled:
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
111 |
|
1
by brian
clean slate |
112 |
The global_system_variables and max_system_variables are "authoritative"
|
113 |
They both should have the same 'version' and 'size'.
|
|
114 |
When attempting to access a dynamic variable, if the session version
|
|
115 |
is out of date, then the session version is updated and realloced if
|
|
116 |
neccessary and bytes copied from global to make up for missing data.
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
117 |
*/
|
1
by brian
clean slate |
118 |
ulong dynamic_variables_version; |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
119 |
char * dynamic_variables_ptr; |
482
by Brian Aker
Remove uint. |
120 |
uint32_t dynamic_variables_head; /* largest valid variable offset */ |
121 |
uint32_t dynamic_variables_size; /* how many bytes are in use */ |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
122 |
|
151
by Brian Aker
Ulonglong to uint64_t |
123 |
uint64_t myisam_max_extra_sort_file_size; |
124 |
uint64_t max_heap_table_size; |
|
125 |
uint64_t tmp_table_size; |
|
1
by brian
clean slate |
126 |
ha_rows select_limit; |
127 |
ha_rows max_join_size; |
|
819.1.1
by Toru Maesaka
Removed the 16bit limitation of auto_increment_(increment|offset) system variables |
128 |
uint64_t auto_increment_increment; |
129 |
uint64_t auto_increment_offset; |
|
616
by Brian Aker
ulong fixes. |
130 |
uint64_t bulk_insert_buff_size; |
131 |
uint64_t join_buff_size; |
|
132 |
uint32_t max_allowed_packet; |
|
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
133 |
uint32_t myisam_stats_method; |
616
by Brian Aker
ulong fixes. |
134 |
uint64_t max_error_count; |
135 |
uint64_t max_length_for_sort_data; |
|
910.4.4
by Stewart Smith
max_sort_length should be size_t everywhere. Causing numerous failures on SPARC and PowerPC due to strang value being retrieved in filesort. Basically, anything with filesort fails without this patch. |
136 |
size_t max_sort_length; |
617
by Brian Aker
ulong fixes |
137 |
uint64_t min_examined_row_limit; |
616
by Brian Aker
ulong fixes. |
138 |
uint32_t net_buffer_length; |
139 |
uint32_t net_read_timeout; |
|
140 |
uint32_t net_retry_count; |
|
141 |
uint32_t net_wait_timeout; |
|
142 |
uint32_t net_write_timeout; |
|
619
by Brian Aker
Removed ulong methods from vars. |
143 |
bool optimizer_prune_level; |
1030.1.3
by Brian Aker
Final bits to structure alignment |
144 |
bool log_warnings; |
145 |
bool engine_condition_pushdown; |
|
146 |
||
619
by Brian Aker
Removed ulong methods from vars. |
147 |
uint32_t optimizer_search_depth; |
1
by brian
clean slate |
148 |
/*
|
149 |
Controls use of Engine-MRR:
|
|
150 |
0 - auto, based on cost
|
|
151 |
1 - force MRR when the storage engine is capable of doing it
|
|
152 |
2 - disable MRR.
|
|
153 |
*/
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
154 |
uint32_t optimizer_use_mrr; |
1
by brian
clean slate |
155 |
/* A bitmap for switching optimizations on/off */
|
617
by Brian Aker
ulong fixes |
156 |
uint32_t optimizer_switch; |
1030.1.3
by Brian Aker
Final bits to structure alignment |
157 |
uint32_t div_precincrement; |
619
by Brian Aker
Removed ulong methods from vars. |
158 |
uint64_t preload_buff_size; |
159 |
uint32_t read_buff_size; |
|
160 |
uint32_t read_rnd_buff_size; |
|
629.4.1
by Monty Taylor
First step in support size_t sys_var stuff. |
161 |
size_t sortbuff_size; |
619
by Brian Aker
Removed ulong methods from vars. |
162 |
uint32_t thread_handling; |
617
by Brian Aker
ulong fixes |
163 |
uint32_t tx_isolation; |
619
by Brian Aker
Removed ulong methods from vars. |
164 |
uint32_t completion_type; |
1
by brian
clean slate |
165 |
/* Determines which non-standard SQL behaviour should be enabled */
|
619
by Brian Aker
Removed ulong methods from vars. |
166 |
uint32_t sql_mode; |
617
by Brian Aker
ulong fixes |
167 |
uint64_t max_seeks_for_key; |
629.4.1
by Monty Taylor
First step in support size_t sys_var stuff. |
168 |
size_t range_alloc_block_size; |
615
by Brian Aker
Added 32bit system variable support |
169 |
uint32_t query_alloc_block_size; |
170 |
uint32_t query_prealloc_size; |
|
171 |
uint32_t trans_alloc_block_size; |
|
172 |
uint32_t trans_prealloc_size; |
|
617
by Brian Aker
ulong fixes |
173 |
uint64_t group_concat_max_len; |
555
by Monty
Fixed 32-bit issues. |
174 |
/* TODO: change this to my_thread_id - but have to fix set_var first */
|
175 |
uint64_t pseudo_thread_id; |
|
1
by brian
clean slate |
176 |
|
971.1.21
by Monty Taylor
Store StorageEngine in system variables, rather than storage engine plugin. |
177 |
StorageEngine *storage_engine; |
1
by brian
clean slate |
178 |
|
179 |
/* Only charset part of these variables is sensible */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
180 |
const CHARSET_INFO *character_set_filesystem; |
1
by brian
clean slate |
181 |
|
182 |
/* Both charset and collation parts of these variables are important */
|
|
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
183 |
const CHARSET_INFO *collation_server; |
748
by Brian Aker
Removal of client side collation. |
184 |
|
185 |
inline const CHARSET_INFO *getCollation(void) |
|
186 |
{
|
|
1014.3.2
by Brian Aker
Factor out need for session in many "schema" calls. Removed variable about |
187 |
return collation_server; |
748
by Brian Aker
Removal of client side collation. |
188 |
}
|
1
by brian
clean slate |
189 |
|
190 |
/* Locale Support */
|
|
191 |
MY_LOCALE *lc_time_names; |
|
192 |
||
193 |
Time_zone *time_zone; |
|
194 |
};
|
|
195 |
||
520.6.7
by Monty Taylor
Moved a bunch of crap out of common_includes. |
196 |
extern struct system_variables global_system_variables; |
197 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
198 |
#include "sql_lex.h" |
199 |
||
200 |
/**
|
|
201 |
* Per-session local status counters
|
|
202 |
*/
|
|
1
by brian
clean slate |
203 |
typedef struct system_status_var |
204 |
{
|
|
151
by Brian Aker
Ulonglong to uint64_t |
205 |
uint64_t bytes_received; |
206 |
uint64_t bytes_sent; |
|
1
by brian
clean slate |
207 |
ulong com_other; |
895
by Brian Aker
Completion (?) of uint conversion. |
208 |
ulong com_stat[(uint32_t) SQLCOM_END]; |
1
by brian
clean slate |
209 |
ulong created_tmp_disk_tables; |
210 |
ulong created_tmp_tables; |
|
211 |
ulong ha_commit_count; |
|
212 |
ulong ha_delete_count; |
|
213 |
ulong ha_read_first_count; |
|
214 |
ulong ha_read_last_count; |
|
215 |
ulong ha_read_key_count; |
|
216 |
ulong ha_read_next_count; |
|
217 |
ulong ha_read_prev_count; |
|
218 |
ulong ha_read_rnd_count; |
|
219 |
ulong ha_read_rnd_next_count; |
|
220 |
ulong ha_rollback_count; |
|
221 |
ulong ha_update_count; |
|
222 |
ulong ha_write_count; |
|
223 |
ulong ha_prepare_count; |
|
224 |
ulong ha_savepoint_count; |
|
225 |
ulong ha_savepoint_rollback_count; |
|
226 |
||
227 |
/* KEY_CACHE parts. These are copies of the original */
|
|
228 |
ulong key_blocks_changed; |
|
229 |
ulong key_blocks_used; |
|
230 |
ulong key_cache_r_requests; |
|
231 |
ulong key_cache_read; |
|
232 |
ulong key_cache_w_requests; |
|
233 |
ulong key_cache_write; |
|
234 |
/* END OF KEY_CACHE parts */
|
|
235 |
||
236 |
ulong net_big_packet_count; |
|
237 |
ulong opened_tables; |
|
238 |
ulong opened_shares; |
|
239 |
ulong select_full_join_count; |
|
240 |
ulong select_full_range_join_count; |
|
241 |
ulong select_range_count; |
|
242 |
ulong select_range_check_count; |
|
243 |
ulong select_scan_count; |
|
244 |
ulong long_query_count; |
|
245 |
ulong filesort_merge_passes; |
|
246 |
ulong filesort_range_count; |
|
247 |
ulong filesort_rows; |
|
248 |
ulong filesort_scan_count; |
|
249 |
/*
|
|
250 |
Number of statements sent from the client
|
|
251 |
*/
|
|
252 |
ulong questions; |
|
253 |
||
254 |
/*
|
|
255 |
IMPORTANT!
|
|
256 |
SEE last_system_status_var DEFINITION BELOW.
|
|
257 |
||
258 |
Below 'last_system_status_var' are all variables which doesn't make any
|
|
259 |
sense to add to the /global/ status variable counter.
|
|
260 |
*/
|
|
261 |
double last_query_cost; |
|
262 |
} STATUS_VAR; |
|
263 |
||
264 |
/*
|
|
265 |
This is used for 'SHOW STATUS'. It must be updated to the last ulong
|
|
266 |
variable in system_status_var which is makes sens to add to the global
|
|
267 |
counter
|
|
268 |
*/
|
|
269 |
||
270 |
#define last_system_status_var questions
|
|
271 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
272 |
void mark_transaction_to_rollback(Session *session, bool all); |
1
by brian
clean slate |
273 |
|
274 |
/**
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
275 |
* Single command executed against this connection.
|
276 |
*
|
|
277 |
* @details
|
|
278 |
*
|
|
279 |
* One connection can contain a lot of simultaneously running statements,
|
|
280 |
* some of which could be prepared, that is, contain placeholders.
|
|
281 |
*
|
|
282 |
* To perform some action with statement we reset Session part to the state of
|
|
283 |
* that statement, do the action, and then save back modified state from Session
|
|
284 |
* to the statement. It will be changed in near future, and Statement will
|
|
285 |
* be used explicitly.
|
|
286 |
*
|
|
287 |
* @todo
|
|
288 |
*
|
|
289 |
* The above comment is bullshit in Drizzle. See TODO markers on Session to
|
|
290 |
* completely detach the inheritance of Session from Statement.
|
|
291 |
*/
|
|
292 |
class Statement |
|
1
by brian
clean slate |
293 |
{
|
294 |
Statement(const Statement &rhs); /* not implemented: */ |
|
295 |
Statement &operator=(const Statement &rhs); /* non-copyable */ |
|
296 |
public: |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
297 |
/**
|
298 |
* List of items created in the parser for this query. Every item puts
|
|
299 |
* itself to the list on creation (see Item::Item() for details))
|
|
300 |
*/
|
|
301 |
Item *free_list; |
|
302 |
MEM_ROOT *mem_root; /**< Pointer to current memroot */ |
|
303 |
/**
|
|
304 |
* Uniquely identifies each statement object in thread scope; change during
|
|
305 |
* statement lifetime.
|
|
306 |
*
|
|
307 |
* @todo should be const
|
|
308 |
*/
|
|
309 |
uint32_t id; |
|
1
by brian
clean slate |
310 |
|
311 |
/*
|
|
312 |
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
|
|
313 |
handler of fields used is set
|
|
314 |
MARK_COLUMNS_READ: Means a bit in read set is set to inform handler
|
|
315 |
that the field is to be read. If field list contains
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
316 |
duplicates, then session->dup_field is set to point
|
1
by brian
clean slate |
317 |
to the last found duplicate.
|
318 |
MARK_COLUMNS_WRITE: Means a bit is set in write set to inform handler
|
|
319 |
that it needs to update this field in write_row
|
|
320 |
and update_row.
|
|
321 |
*/
|
|
322 |
enum enum_mark_columns mark_used_columns; |
|
323 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
324 |
LEX *lex; /**< parse tree descriptor */ |
325 |
/**
|
|
1
by brian
clean slate |
326 |
Points to the query associated with this statement. It's const, but
|
327 |
we need to declare it char * because all table handlers are written
|
|
328 |
in C and need to point to it.
|
|
329 |
||
330 |
Note that (A) if we set query = NULL, we must at the same time set
|
|
331 |
query_length = 0, and protect the whole operation with the
|
|
332 |
LOCK_thread_count mutex. And (B) we are ONLY allowed to set query to a
|
|
333 |
non-NULL value if its previous value is NULL. We do not need to protect
|
|
334 |
operation (B) with any mutex. To avoid crashes in races, if we do not
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
335 |
know that session->query cannot change at the moment, one should print
|
336 |
session->query like this:
|
|
1
by brian
clean slate |
337 |
(1) reserve the LOCK_thread_count mutex;
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
338 |
(2) check if session->query is NULL;
|
339 |
(3) if not NULL, then print at most session->query_length characters from
|
|
1
by brian
clean slate |
340 |
it. We will see the query_length field as either 0, or the right value
|
341 |
for it.
|
|
342 |
Assuming that the write and read of an n-bit memory field in an n-bit
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
343 |
computer is atomic, we can avoid races in the above way.
|
1
by brian
clean slate |
344 |
This printing is needed at least in SHOW PROCESSLIST and SHOW INNODB
|
345 |
STATUS.
|
|
346 |
*/
|
|
347 |
char *query; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
348 |
uint32_t query_length; /**< current query length */ |
1
by brian
clean slate |
349 |
|
350 |
/**
|
|
351 |
Name of the current (default) database.
|
|
352 |
||
353 |
If there is the current (default) database, "db" contains its name. If
|
|
354 |
there is no current (default) database, "db" is NULL and "db_length" is
|
|
355 |
0. In other words, "db", "db_length" must either be NULL, or contain a
|
|
356 |
valid database name.
|
|
357 |
||
358 |
@note this attribute is set and alloced by the slave SQL thread (for
|
|
520.1.21
by Brian Aker
THD -> Session rename |
359 |
the Session of that thread); that thread is (and must remain, for now) the
|
1
by brian
clean slate |
360 |
only responsible for freeing this member.
|
361 |
*/
|
|
362 |
char *db; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
363 |
uint32_t db_length; /**< Length of current schema name */ |
1
by brian
clean slate |
364 |
|
365 |
public: |
|
366 |
||
367 |
/* This constructor is called for backup statements */
|
|
368 |
Statement() {} |
|
369 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
370 |
Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, uint32_t id_arg) |
371 |
:
|
|
372 |
free_list(NULL), |
|
373 |
mem_root(mem_root_arg), |
|
374 |
id(id_arg), |
|
375 |
mark_used_columns(MARK_COLUMNS_READ), |
|
376 |
lex(lex_arg), |
|
377 |
query(NULL), |
|
378 |
query_length(0), |
|
379 |
db(NULL), |
|
380 |
db_length(0) |
|
381 |
{}
|
|
382 |
virtual ~Statement() {} |
|
383 |
inline void* alloc(size_t size) |
|
384 |
{
|
|
385 |
return alloc_root(mem_root,size); |
|
386 |
}
|
|
387 |
inline void* calloc(size_t size) |
|
388 |
{
|
|
389 |
void *ptr; |
|
390 |
if ((ptr= alloc_root(mem_root,size))) |
|
391 |
memset(ptr, 0, size); |
|
392 |
return ptr; |
|
393 |
}
|
|
394 |
inline char *strdup(const char *str) |
|
395 |
{
|
|
396 |
return strdup_root(mem_root,str); |
|
397 |
}
|
|
398 |
inline char *strmake(const char *str, size_t size) |
|
399 |
{
|
|
400 |
return strmake_root(mem_root,str,size); |
|
401 |
}
|
|
402 |
inline void *memdup(const void *str, size_t size) |
|
403 |
{
|
|
404 |
return memdup_root(mem_root,str,size); |
|
405 |
}
|
|
406 |
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap) |
|
407 |
{
|
|
408 |
void *ptr; |
|
409 |
if ((ptr= alloc_root(mem_root,size+gap))) |
|
410 |
memcpy(ptr,str,size); |
|
411 |
return ptr; |
|
412 |
}
|
|
413 |
/** Frees all items attached to this Statement */
|
|
414 |
void free_items(); |
|
1
by brian
clean slate |
415 |
};
|
416 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
417 |
struct st_savepoint |
418 |
{
|
|
1
by brian
clean slate |
419 |
struct st_savepoint *prev; |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
420 |
char *name; |
421 |
uint32_t length; |
|
422 |
Ha_trx_info *ha_list; |
|
1
by brian
clean slate |
423 |
};
|
424 |
||
425 |
extern pthread_mutex_t LOCK_xid_cache; |
|
426 |
extern HASH xid_cache; |
|
427 |
||
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
428 |
#include <drizzled/security_context.h> |
429 |
#include <drizzled/open_tables_state.h> |
|
1
by brian
clean slate |
430 |
|
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
431 |
#include <drizzled/internal_error_handler.h> |
432 |
#include <drizzled/diagnostics_area.h> |
|
1
by brian
clean slate |
433 |
|
434 |
/**
|
|
435 |
Storage engine specific thread local data.
|
|
436 |
*/
|
|
437 |
struct Ha_data |
|
438 |
{
|
|
439 |
/**
|
|
440 |
Storage engine specific thread local data.
|
|
441 |
Lifetime: one user connection.
|
|
442 |
*/
|
|
443 |
void *ha_ptr; |
|
444 |
/**
|
|
445 |
0: Life time: one statement within a transaction. If @@autocommit is
|
|
446 |
on, also represents the entire transaction.
|
|
447 |
@sa trans_register_ha()
|
|
448 |
||
449 |
1: Life time: one transaction within a connection.
|
|
450 |
If the storage engine does not participate in a transaction,
|
|
451 |
this should not be used.
|
|
452 |
@sa trans_register_ha()
|
|
453 |
*/
|
|
454 |
Ha_trx_info ha_info[2]; |
|
455 |
||
456 |
Ha_data() :ha_ptr(NULL) {} |
|
457 |
};
|
|
458 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
459 |
/**
|
460 |
* Represents a client connection to the database server.
|
|
461 |
*
|
|
462 |
* Contains the client/server protocol object, the current statement
|
|
463 |
* being executed, local-to-session variables and status counters, and
|
|
464 |
* a host of other information.
|
|
465 |
*
|
|
466 |
* @todo
|
|
467 |
*
|
|
468 |
* Session should NOT inherit from Statement, but rather it should have a
|
|
469 |
* vector of Statement object pointers which comprise the statements executed
|
|
470 |
* on the Session. Until this architectural change is done, we can forget
|
|
471 |
* about parallel operations inside a session.
|
|
472 |
*
|
|
473 |
* @todo
|
|
474 |
*
|
|
475 |
* Make member variables private and have inlined accessors and setters. Hide
|
|
476 |
* all member variables that are not critical to non-internal operations of the
|
|
477 |
* session object.
|
|
478 |
*/
|
|
934.2.16
by Jay Pipes
Removes dead USER_CONN struct and member variable in Session class. |
479 |
class Session :public Statement, public Open_tables_state |
1
by brian
clean slate |
480 |
{
|
481 |
public: |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
482 |
/**
|
520.1.21
by Brian Aker
THD -> Session rename |
483 |
Constant for Session::where initialization in the beginning of every query.
|
1
by brian
clean slate |
484 |
|
520.1.21
by Brian Aker
THD -> Session rename |
485 |
It's needed because we do not save/restore Session::where normally during
|
1
by brian
clean slate |
486 |
primary (non subselect) query execution.
|
487 |
*/
|
|
488 |
static const char * const DEFAULT_WHERE; |
|
489 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
490 |
MEM_ROOT warn_root; /**< Allocation area for warnings and errors */ |
491 |
Protocol *protocol; /**< Pointer to the current protocol */ |
|
492 |
HASH user_vars; /**< Hash of user variables defined during the session's lifetime */ |
|
493 |
String packet; /**< dynamic buffer for network I/O */ |
|
494 |
String convert_buffer; /**< A buffer for charset conversions */ |
|
495 |
struct system_variables variables; /**< Mutable local variables local to the session */ |
|
496 |
struct system_status_var status_var; /**< Session-local status counters */ |
|
497 |
struct system_status_var *initial_status_var; /* used by show status */ |
|
498 |
THR_LOCK_INFO lock_info; /**< Locking information for this session */ |
|
499 |
THR_LOCK_OWNER main_lock_id; /**< To use for conventional queries */ |
|
500 |
THR_LOCK_OWNER *lock_id; /**< If not main_lock_id, points to the lock_id of a cursor. */ |
|
501 |
pthread_mutex_t LOCK_delete; /**< Locked before session is deleted */ |
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
502 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
503 |
/**
|
504 |
* A peek into the query string for the session. This is a best effort
|
|
505 |
* delivery, there is no guarantee whether the content is meaningful.
|
|
506 |
*/
|
|
998
by Brian Aker
Patch on show processlist from davi@apache.org |
507 |
char process_list_info[PROCESS_LIST_WIDTH+1]; |
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
508 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
509 |
/**
|
510 |
* A pointer to the stack frame of handle_one_connection(),
|
|
511 |
* which is called first in the thread for handling a client
|
|
512 |
*/
|
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
513 |
char *thread_stack; |
1
by brian
clean slate |
514 |
|
515 |
/**
|
|
516 |
@note
|
|
520.1.21
by Brian Aker
THD -> Session rename |
517 |
Some members of Session (currently 'Statement::db',
|
1055.2.16
by Jay Pipes
Removes dead Session::catalog member variable |
518 |
'query') are set and alloced by the slave SQL thread
|
520.1.21
by Brian Aker
THD -> Session rename |
519 |
(for the Session of that thread); that thread is (and must remain, for now)
|
1
by brian
clean slate |
520 |
the only responsible for freeing these 3 members. If you add members
|
521 |
here, and you add code to set them in replication, don't forget to
|
|
522 |
free_them_and_set_them_to_0 in replication properly. For details see
|
|
523 |
the 'err:' label of the handle_slave_sql() in sql/slave.cc.
|
|
524 |
||
525 |
@see handle_slave_sql
|
|
526 |
*/
|
|
694
by Brian Aker
Refactor out char* strdup for string class in user. |
527 |
Security_context security_ctx; |
1
by brian
clean slate |
528 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
529 |
/**
|
1
by brian
clean slate |
530 |
Used in error messages to tell user in what part of MySQL we found an
|
531 |
error. E. g. when where= "having clause", if fix_fields() fails, user
|
|
532 |
will know that the error was in having clause.
|
|
533 |
*/
|
|
534 |
const char *where; |
|
535 |
||
536 |
/*
|
|
537 |
One thread can hold up to one named user-level lock. This variable
|
|
538 |
points to a lock object if the lock is present. See item_func.cc and
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
539 |
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
|
1
by brian
clean slate |
540 |
*/
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
541 |
uint32_t dbug_sentry; /**< watch for memory corruption */ |
1
by brian
clean slate |
542 |
struct st_my_thread_var *mysys_var; |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
543 |
/**
|
544 |
* Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from
|
|
545 |
* first byte of the packet in executeStatement()
|
|
546 |
*/
|
|
1
by brian
clean slate |
547 |
enum enum_server_command command; |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
548 |
uint32_t file_id; /**< File ID for LOAD DATA INFILE */ |
1055.2.15
by Jay Pipes
Removed unused cached character set variables in Session along with dead update_charset() method. |
549 |
/* @note the following three members should likely move to Protocol */
|
550 |
uint32_t client_capabilities; /**< What the client supports */ |
|
551 |
uint16_t peer_port; /**< The remote (peer) port */ |
|
552 |
uint32_t max_client_packet_length; /**< Maximum number of bytes a client can send in a single packet */ |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
553 |
time_t start_time; |
554 |
time_t user_time; |
|
555 |
uint64_t connect_utime; |
|
556 |
uint64_t thr_create_utime; /**< track down slow pthread_create */ |
|
557 |
uint64_t start_utime; |
|
558 |
uint64_t utime_after_lock; |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
559 |
|
1
by brian
clean slate |
560 |
thr_lock_type update_lock_default; |
561 |
||
661
by Brian Aker
First major pass through new replication. |
562 |
/*
|
563 |
Both of the following container points in session will be converted to an API.
|
|
564 |
*/
|
|
565 |
||
1
by brian
clean slate |
566 |
/* container for handler's private per-connection data */
|
567 |
Ha_data ha_data[MAX_HA]; |
|
568 |
||
661
by Brian Aker
First major pass through new replication. |
569 |
/* container for replication data */
|
570 |
void *replication_data; |
|
1
by brian
clean slate |
571 |
|
572 |
struct st_transactions { |
|
573 |
SAVEPOINT *savepoints; |
|
520.1.21
by Brian Aker
THD -> Session rename |
574 |
Session_TRANS all; // Trans since BEGIN WORK |
575 |
Session_TRANS stmt; // Trans for current statement |
|
1
by brian
clean slate |
576 |
bool on; // see ha_enable_transaction() |
577 |
XID_STATE xid_state; |
|
578 |
||
579 |
/*
|
|
580 |
Tables changed in transaction (that must be invalidated in query cache).
|
|
581 |
List contain only transactional tables, that not invalidated in query
|
|
582 |
cache (instead of full list of changed in transaction tables).
|
|
583 |
*/
|
|
327.2.4
by Brian Aker
Refactoring table.h |
584 |
CHANGED_TableList* changed_tables; |
1
by brian
clean slate |
585 |
MEM_ROOT mem_root; // Transaction-life memory allocation pool |
586 |
void cleanup() |
|
587 |
{
|
|
588 |
changed_tables= 0; |
|
589 |
savepoints= 0; |
|
590 |
free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); |
|
591 |
}
|
|
592 |
st_transactions() |
|
593 |
{
|
|
212.6.6
by Mats Kindahl
Removing redundant use of casts in drizzled/ for memcmp(), memcpy(), memset(), and memmove(). |
594 |
memset(this, 0, sizeof(*this)); |
1
by brian
clean slate |
595 |
xid_state.xid.null(); |
596 |
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); |
|
597 |
}
|
|
598 |
} transaction; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
599 |
Field *dup_field; |
1
by brian
clean slate |
600 |
sigset_t signals; |
601 |
||
602 |
/* Tells if LAST_INSERT_ID(#) was called for the current statement */
|
|
603 |
bool arg_of_last_insert_id_function; |
|
604 |
/*
|
|
605 |
ALL OVER THIS FILE, "insert_id" means "*automatically generated* value for
|
|
606 |
insertion into an auto_increment column".
|
|
607 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
608 |
/**
|
1
by brian
clean slate |
609 |
This is the first autogenerated insert id which was *successfully*
|
610 |
inserted by the previous statement (exactly, if the previous statement
|
|
611 |
didn't successfully insert an autogenerated insert id, then it's the one
|
|
612 |
of the statement before, etc).
|
|
613 |
It can also be set by SET LAST_INSERT_ID=# or SELECT LAST_INSERT_ID(#).
|
|
614 |
It is returned by LAST_INSERT_ID().
|
|
615 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
616 |
uint64_t first_successful_insert_id_in_prev_stmt; |
617 |
/**
|
|
1
by brian
clean slate |
618 |
This is the first autogenerated insert id which was *successfully*
|
619 |
inserted by the current statement. It is maintained only to set
|
|
620 |
first_successful_insert_id_in_prev_stmt when statement ends.
|
|
621 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
622 |
uint64_t first_successful_insert_id_in_cur_stmt; |
623 |
/**
|
|
1
by brian
clean slate |
624 |
We follow this logic:
|
625 |
- when stmt starts, first_successful_insert_id_in_prev_stmt contains the
|
|
626 |
first insert id successfully inserted by the previous stmt.
|
|
627 |
- as stmt makes progress, handler::insert_id_for_cur_row changes;
|
|
628 |
every time get_auto_increment() is called,
|
|
629 |
auto_inc_intervals_in_cur_stmt_for_binlog is augmented with the
|
|
630 |
reserved interval (if statement-based binlogging).
|
|
631 |
- at first successful insertion of an autogenerated value,
|
|
632 |
first_successful_insert_id_in_cur_stmt is set to
|
|
633 |
handler::insert_id_for_cur_row.
|
|
634 |
- when stmt goes to binlog,
|
|
635 |
auto_inc_intervals_in_cur_stmt_for_binlog is binlogged if
|
|
636 |
non-empty.
|
|
637 |
- when stmt ends, first_successful_insert_id_in_prev_stmt is set to
|
|
638 |
first_successful_insert_id_in_cur_stmt.
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
639 |
|
1
by brian
clean slate |
640 |
List of auto_increment intervals reserved by the thread so far, for
|
641 |
storage in the statement-based binlog.
|
|
642 |
Note that its minimum is not first_successful_insert_id_in_cur_stmt:
|
|
643 |
assuming a table with an autoinc column, and this happens:
|
|
644 |
INSERT INTO ... VALUES(3);
|
|
645 |
SET INSERT_ID=3; INSERT IGNORE ... VALUES (NULL);
|
|
646 |
then the latter INSERT will insert no rows
|
|
647 |
(first_successful_insert_id_in_cur_stmt == 0), but storing "INSERT_ID=3"
|
|
648 |
in the binlog is still needed; the list's minimum will contain 3.
|
|
649 |
*/
|
|
650 |
Discrete_intervals_list auto_inc_intervals_in_cur_stmt_for_binlog; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
651 |
/** Used by replication and SET INSERT_ID */
|
1
by brian
clean slate |
652 |
Discrete_intervals_list auto_inc_intervals_forced; |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
653 |
|
654 |
uint64_t limit_found_rows; |
|
1055.2.15
by Jay Pipes
Removed unused cached character set variables in Session along with dead update_charset() method. |
655 |
uint64_t options; /**< Bitmap of options */ |
656 |
int64_t row_count_func; /**< For the ROW_COUNT() function */ |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
657 |
ha_rows cuted_fields; /**< Count of "cut" or truncated fields. @todo Kill this friggin thing. */ |
658 |
||
659 |
/**
|
|
660 |
* Number of rows we actually sent to the client, including "synthetic"
|
|
661 |
* rows in ROLLUP etc.
|
|
662 |
*/
|
|
663 |
ha_rows sent_row_count; |
|
664 |
||
665 |
/**
|
|
666 |
* Number of rows we read, sent or not, including in create_sort_index()
|
|
667 |
*/
|
|
668 |
ha_rows examined_row_count; |
|
669 |
||
670 |
/**
|
|
671 |
* The set of those tables whose fields are referenced in all subqueries
|
|
672 |
* of the query.
|
|
673 |
*
|
|
674 |
* @todo
|
|
675 |
*
|
|
676 |
* Possibly this it is incorrect to have used tables in Session because
|
|
677 |
* with more than one subquery, it is not clear what does the field mean.
|
|
678 |
*/
|
|
679 |
table_map used_tables; |
|
680 |
||
681 |
/**
|
|
682 |
@todo
|
|
683 |
|
|
684 |
This, and some other variables like 'count_cuted_fields'
|
|
1
by brian
clean slate |
685 |
maybe should be statement/cursor local, that is, moved to Statement
|
686 |
class. With current implementation warnings produced in each prepared
|
|
687 |
statement/cursor settle here.
|
|
688 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
689 |
List<DRIZZLE_ERROR> warn_list; |
690 |
uint32_t warn_count[(uint32_t) DRIZZLE_ERROR::WARN_LEVEL_END]; |
|
691 |
uint32_t total_warn_count; |
|
1
by brian
clean slate |
692 |
Diagnostics_area main_da; |
693 |
||
694 |
/*
|
|
695 |
Id of current query. Statement can be reused to execute several queries
|
|
696 |
query_id is global in context of the whole MySQL server.
|
|
697 |
ID is automatically generated from mutex-protected counter.
|
|
698 |
It's used in handler code for various purposes: to check which columns
|
|
699 |
from table are necessary for this select, to check if it's necessary to
|
|
700 |
update auto-updatable fields (like auto_increment and timestamp).
|
|
701 |
*/
|
|
1055.2.15
by Jay Pipes
Removed unused cached character set variables in Session along with dead update_charset() method. |
702 |
query_id_t query_id; |
703 |
query_id_t warn_id; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
704 |
ulong col_access; |
1
by brian
clean slate |
705 |
|
706 |
#ifdef ERROR_INJECT_SUPPORT
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
707 |
ulong error_inject_value; |
1
by brian
clean slate |
708 |
#endif
|
709 |
/* Statement id is thread-wide. This counter is used to generate ids */
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
710 |
uint32_t statement_id_counter; |
711 |
uint32_t rand_saved_seed1; |
|
712 |
uint32_t rand_saved_seed2; |
|
713 |
/**
|
|
1
by brian
clean slate |
714 |
Row counter, mainly for errors and warnings. Not increased in
|
715 |
create_sort_index(); may differ from examined_row_count.
|
|
716 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
717 |
uint32_t row_count; |
718 |
pthread_t real_id; /**< For debugging */ |
|
719 |
my_thread_id thread_id; |
|
1046.1.7
by Brian Aker
Style cleanup. |
720 |
uint32_t tmp_table; |
721 |
uint32_t global_read_lock; |
|
722 |
uint32_t server_status; |
|
723 |
uint32_t open_options; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
724 |
uint32_t select_number; /**< number of select (used for EXPLAIN) */ |
1
by brian
clean slate |
725 |
/* variables.transaction_isolation is reset to this after each commit */
|
726 |
enum_tx_isolation session_tx_isolation; |
|
727 |
enum_check_fields count_cuted_fields; |
|
728 |
||
729 |
enum killed_state |
|
730 |
{
|
|
550
by Monty Taylor
Moved error.h into just the files that need it. |
731 |
NOT_KILLED, |
732 |
KILL_BAD_DATA, |
|
733 |
KILL_CONNECTION, |
|
734 |
KILL_QUERY, |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
735 |
KILLED_NO_VALUE /* means none of the above states apply */ |
1
by brian
clean slate |
736 |
};
|
737 |
killed_state volatile killed; |
|
738 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
739 |
bool some_tables_deleted; |
740 |
bool no_errors; |
|
741 |
bool password; |
|
1
by brian
clean slate |
742 |
/**
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
743 |
Set to true if execution of the current compound statement
|
1
by brian
clean slate |
744 |
can not continue. In particular, disables activation of
|
745 |
CONTINUE or EXIT handlers of stored routines.
|
|
746 |
Reset in the end of processing of the current user request, in
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
747 |
@see mysql_reset_session_for_next_command().
|
1
by brian
clean slate |
748 |
*/
|
749 |
bool is_fatal_error; |
|
750 |
/**
|
|
751 |
Set by a storage engine to request the entire
|
|
752 |
transaction (that possibly spans multiple engines) to
|
|
753 |
rollback. Reset in ha_rollback.
|
|
754 |
*/
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
755 |
bool transaction_rollback_request; |
1
by brian
clean slate |
756 |
/**
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
757 |
true if we are in a sub-statement and the current error can
|
1
by brian
clean slate |
758 |
not be safely recovered until we left the sub-statement mode.
|
759 |
In particular, disables activation of CONTINUE and EXIT
|
|
760 |
handlers inside sub-statements. E.g. if it is a deadlock
|
|
761 |
error and requires a transaction-wide rollback, this flag is
|
|
762 |
raised (traditionally, MySQL first has to close all the reads
|
|
763 |
via @see handler::ha_index_or_rnd_end() and only then perform
|
|
764 |
the rollback).
|
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
765 |
Reset to false when we leave the sub-statement mode.
|
1
by brian
clean slate |
766 |
*/
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
767 |
bool is_fatal_sub_stmt_error; |
768 |
/** for IS NULL => = last_insert_id() fix in remove_eq_conds() */
|
|
769 |
bool substitute_null_with_insert_id; |
|
770 |
bool cleanup_done; |
|
771 |
||
772 |
bool abort_on_warning; |
|
773 |
bool got_warning; /**< Set on call to push_warning() */ |
|
774 |
bool no_warnings_for_error; /**< no warnings on call to my_error() */ |
|
775 |
/** set during loop of derived table processing */
|
|
776 |
bool derived_tables_processing; |
|
1055.2.15
by Jay Pipes
Removed unused cached character set variables in Session along with dead update_charset() method. |
777 |
bool tablespace_op; /**< This is true in DISCARD/IMPORT TABLESPACE */ |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
778 |
|
779 |
/** Used by the sys_var class to store temporary values */
|
|
1
by brian
clean slate |
780 |
union
|
781 |
{
|
|
1055.2.17
by Jay Pipes
More style cleanups in Session |
782 |
bool bool_value; |
783 |
uint32_t uint32_t_value; |
|
784 |
int32_t int32_t_value; |
|
151
by Brian Aker
Ulonglong to uint64_t |
785 |
uint64_t uint64_t_value; |
1
by brian
clean slate |
786 |
} sys_var_tmp; |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
787 |
|
1
by brian
clean slate |
788 |
/**
|
789 |
Character input stream consumed by the lexical analyser,
|
|
790 |
used during parsing.
|
|
791 |
Note that since the parser is not re-entrant, we keep only one input
|
|
792 |
stream here. This member is valid only when executing code during parsing,
|
|
793 |
and may point to invalid memory after that.
|
|
794 |
*/
|
|
795 |
Lex_input_stream *m_lip; |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
796 |
|
797 |
/** session_scheduler for events */
|
|
798 |
void *scheduler; |
|
799 |
||
800 |
/** Place to store various things */
|
|
801 |
void *session_marker; |
|
1055.2.17
by Jay Pipes
More style cleanups in Session |
802 |
/** Keeps a copy of the previous table around in case we are just slamming on particular table */
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
803 |
Table *cached_table; |
804 |
||
805 |
/**
|
|
806 |
Points to info-string that we show in SHOW PROCESSLIST
|
|
807 |
You are supposed to call Session_SET_PROC_INFO only if you have coded
|
|
808 |
a time-consuming piece that MySQL can get stuck in for a long time.
|
|
809 |
||
810 |
Set it using the session_proc_info(Session *thread, const char *message)
|
|
811 |
macro/function.
|
|
812 |
*/
|
|
813 |
inline void set_proc_info(const char *info) |
|
814 |
{
|
|
815 |
proc_info= info; |
|
816 |
}
|
|
817 |
inline const char* get_proc_info() const |
|
818 |
{
|
|
819 |
return proc_info; |
|
820 |
}
|
|
821 |
||
822 |
inline void setReplicationData (void *data) |
|
823 |
{
|
|
824 |
replication_data= data; |
|
825 |
}
|
|
826 |
inline void *getReplicationData () const |
|
827 |
{
|
|
828 |
return replication_data; |
|
829 |
}
|
|
830 |
||
831 |
/** Returns the current query ID */
|
|
832 |
inline query_id_t getQueryId() const |
|
833 |
{
|
|
834 |
return query_id; |
|
835 |
}
|
|
836 |
||
837 |
/** Returns the current query text */
|
|
838 |
inline const char *getQueryString() const |
|
839 |
{
|
|
840 |
return query; |
|
841 |
}
|
|
842 |
||
843 |
/** Returns the length of the current query text */
|
|
844 |
inline size_t getQueryLength() const |
|
845 |
{
|
|
846 |
return strlen(query); |
|
847 |
}
|
|
848 |
||
849 |
/** Accessor method returning the server's ID. */
|
|
850 |
inline uint32_t getServerId() const |
|
851 |
{
|
|
852 |
/* We return the global server ID. */
|
|
853 |
return server_id; |
|
854 |
}
|
|
855 |
||
856 |
/** Returns the current transaction ID for the session's current statement */
|
|
857 |
inline my_xid getTransactionId() |
|
858 |
{
|
|
859 |
return transaction.xid_state.xid.quick_get_my_xid(); |
|
860 |
}
|
|
861 |
/**
|
|
862 |
There is BUG#19630 where statement-based replication of stored
|
|
863 |
functions/triggers with two auto_increment columns breaks.
|
|
864 |
We however ensure that it works when there is 0 or 1 auto_increment
|
|
865 |
column; our rules are
|
|
866 |
a) on master, while executing a top statement involving substatements,
|
|
867 |
first top- or sub- statement to generate auto_increment values wins the
|
|
868 |
exclusive right to see its values be written to binlog (the write
|
|
869 |
will be done by the statement or its caller), and the losers won't see
|
|
870 |
their values be written to binlog.
|
|
871 |
b) on slave, while replicating a top statement involving substatements,
|
|
872 |
first top- or sub- statement to need to read auto_increment values from
|
|
873 |
the master's binlog wins the exclusive right to read them (so the losers
|
|
874 |
won't read their values from binlog but instead generate on their own).
|
|
875 |
a) implies that we mustn't backup/restore
|
|
876 |
auto_inc_intervals_in_cur_stmt_for_binlog.
|
|
877 |
b) implies that we mustn't backup/restore auto_inc_intervals_forced.
|
|
878 |
||
879 |
If there are more than 1 auto_increment columns, then intervals for
|
|
880 |
different columns may mix into the
|
|
881 |
auto_inc_intervals_in_cur_stmt_for_binlog list, which is logically wrong,
|
|
882 |
but there is no point in preventing this mixing by preventing intervals
|
|
883 |
from the secondly inserted column to come into the list, as such
|
|
884 |
prevention would be wrong too.
|
|
885 |
What will happen in the case of
|
|
886 |
INSERT INTO t1 (auto_inc) VALUES(NULL);
|
|
887 |
where t1 has a trigger which inserts into an auto_inc column of t2, is
|
|
888 |
that in binlog we'll store the interval of t1 and the interval of t2 (when
|
|
889 |
we store intervals, soon), then in slave, t1 will use both intervals, t2
|
|
890 |
will use none; if t1 inserts the same number of rows as on master,
|
|
891 |
normally the 2nd interval will not be used by t1, which is fine. t2's
|
|
892 |
values will be wrong if t2's internal auto_increment counter is different
|
|
893 |
from what it was on master (which is likely). In 5.1, in mixed binlogging
|
|
894 |
mode, row-based binlogging is used for such cases where two
|
|
895 |
auto_increment columns are inserted.
|
|
896 |
*/
|
|
897 |
inline void record_first_successful_insert_id_in_cur_stmt(uint64_t id_arg) |
|
898 |
{
|
|
899 |
if (first_successful_insert_id_in_cur_stmt == 0) |
|
900 |
first_successful_insert_id_in_cur_stmt= id_arg; |
|
901 |
}
|
|
902 |
inline uint64_t read_first_successful_insert_id_in_prev_stmt(void) |
|
903 |
{
|
|
904 |
return first_successful_insert_id_in_prev_stmt; |
|
905 |
}
|
|
906 |
/**
|
|
907 |
Used by Intvar_log_event::do_apply_event() and by "SET INSERT_ID=#"
|
|
908 |
(mysqlbinlog). We'll soon add a variant which can take many intervals in
|
|
909 |
argument.
|
|
910 |
*/
|
|
911 |
inline void force_one_auto_inc_interval(uint64_t next_id) |
|
912 |
{
|
|
913 |
auto_inc_intervals_forced.empty(); // in case of multiple SET INSERT_ID |
|
914 |
auto_inc_intervals_forced.append(next_id, UINT64_MAX, 0); |
|
915 |
}
|
|
1
by brian
clean slate |
916 |
|
971.3.12
by Eric Day
Started abstracting Protocol, removed init_connect, init_file. |
917 |
Session(Protocol *protocol_arg); |
520.1.21
by Brian Aker
THD -> Session rename |
918 |
~Session(); |
1
by brian
clean slate |
919 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
920 |
/**
|
1
by brian
clean slate |
921 |
Initialize memory roots necessary for query processing and (!)
|
520.1.21
by Brian Aker
THD -> Session rename |
922 |
pre-allocate memory for it. We can't do that in Session constructor because
|
1
by brian
clean slate |
923 |
there are use cases (acl_init, watcher threads,
|
924 |
killing mysqld) where it's vital to not allocate excessive and not used
|
|
925 |
memory. Note, that we still don't return error from init_for_queries():
|
|
926 |
if preallocation fails, we should notice that at the first call to
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
927 |
alloc_root.
|
1
by brian
clean slate |
928 |
*/
|
929 |
void init_for_queries(); |
|
930 |
void cleanup(void); |
|
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
931 |
/**
|
932 |
* Cleans up after query.
|
|
933 |
*
|
|
934 |
* @details
|
|
935 |
*
|
|
936 |
* This function is used to reset thread data to its default state.
|
|
937 |
*
|
|
938 |
* This function is not suitable for setting thread data to some
|
|
939 |
* non-default values, as there is only one replication thread, so
|
|
940 |
* different master threads may overwrite data of each other on
|
|
941 |
* slave.
|
|
942 |
*/
|
|
1
by brian
clean slate |
943 |
void cleanup_after_query(); |
944 |
bool store_globals(); |
|
520.1.21
by Brian Aker
THD -> Session rename |
945 |
void awake(Session::killed_state state_to_set); |
934.2.6
by Jay Pipes
This changeset removes a few more C functions from sql_connect.cc/connect.h |
946 |
/**
|
947 |
* Pulls thread-specific variables into Session state.
|
|
948 |
*
|
|
949 |
* Returns true most times, or false if there was a problem
|
|
950 |
* allocating resources for thread-specific storage.
|
|
951 |
*
|
|
952 |
* @TODO Kill this. It's not necessary once my_thr_init() is bye bye.
|
|
953 |
*
|
|
954 |
*/
|
|
955 |
bool initGlobals(); |
|
956 |
||
957 |
/**
|
|
958 |
* Initializes the Session to handle queries.
|
|
959 |
*/
|
|
960 |
void prepareForQueries(); |
|
1
by brian
clean slate |
961 |
|
934.2.4
by Jay Pipes
This changeset pulls check_user(), check_connection(), and login_connection() out of sql_connect.cc and makes them member methods of Session, where they belong. Also, made sure that functions that return a bool return true when it succeeds, and not false... |
962 |
/**
|
934.2.8
by Jay Pipes
Refactors the do_command() function out of the sql_parse.cc stuff and implements it as a member method, executeStatement() on the Session object. |
963 |
* Executes a single statement received from the
|
964 |
* client connection.
|
|
965 |
*
|
|
966 |
* Returns true if the statement was successful, or false
|
|
967 |
* otherwise.
|
|
968 |
*
|
|
969 |
* @note
|
|
970 |
*
|
|
971 |
* For profiling to work, it must never be called recursively.
|
|
972 |
*
|
|
973 |
* In MySQL, this used to be the do_command() C function whic
|
|
974 |
* accepted a single parameter of the THD pointer.
|
|
975 |
*/
|
|
976 |
bool executeStatement(); |
|
977 |
||
978 |
/**
|
|
934.2.9
by Jay Pipes
Pulls alloc_query() C function out of sql_parse.cc and adds readAndStoreQuery() member method of Session class. |
979 |
* Reads a query from packet and stores it.
|
980 |
*
|
|
981 |
* Returns true if query is read and allocated successfully,
|
|
982 |
* false otherwise. On a return of false, Session::fatal_error
|
|
983 |
* is set.
|
|
984 |
*
|
|
985 |
* @note Used in COM_QUERY and COM_STMT_PREPARE.
|
|
986 |
*
|
|
987 |
* Sets the following Session variables:
|
|
988 |
* - query
|
|
989 |
* - query_length
|
|
990 |
*
|
|
991 |
* @param The packet pointer to read from
|
|
992 |
* @param The length of the query to read
|
|
993 |
*/
|
|
994 |
bool readAndStoreQuery(const char *in_packet, uint32_t in_packet_length); |
|
995 |
||
996 |
/**
|
|
934.2.11
by Jay Pipes
Moves end_trans(), begin_trans(), end_active_trans() out of the parser module and adds startTransaction(), endTransaction(), and endActiveTransaction() member methods of Session object. |
997 |
* Ends the current transaction and (maybe) begins the next.
|
998 |
*
|
|
999 |
* Returns true if the transaction completed successfully,
|
|
1000 |
* otherwise false.
|
|
1001 |
*
|
|
1002 |
* @param Completion type
|
|
1003 |
*/
|
|
1004 |
bool endTransaction(enum enum_mysql_completiontype completion); |
|
1005 |
bool endActiveTransaction(); |
|
1006 |
bool startTransaction(); |
|
1007 |
||
1008 |
/**
|
|
934.2.4
by Jay Pipes
This changeset pulls check_user(), check_connection(), and login_connection() out of sql_connect.cc and makes them member methods of Session, where they belong. Also, made sure that functions that return a bool return true when it succeeds, and not false... |
1009 |
* Authenticates users, with error reporting.
|
1010 |
*
|
|
1011 |
* Returns true on success, or false on failure.
|
|
1012 |
*/
|
|
1013 |
bool authenticate(); |
|
1014 |
||
1
by brian
clean slate |
1015 |
/*
|
1016 |
For enter_cond() / exit_cond() to work the mutex must be got before
|
|
1017 |
enter_cond(); this mutex is then released by exit_cond().
|
|
1018 |
Usage must be: lock mutex; enter_cond(); your code; exit_cond().
|
|
1019 |
*/
|
|
821
by Brian Aker
Removed dead prepare2 call. |
1020 |
inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg) |
1
by brian
clean slate |
1021 |
{
|
1022 |
const char* old_msg = get_proc_info(); |
|
1023 |
safe_mutex_assert_owner(mutex); |
|
1024 |
mysys_var->current_mutex = mutex; |
|
1025 |
mysys_var->current_cond = cond; |
|
322.2.5
by Mats Kindahl
Replaced use of thd_proc_info() macro with calls to |
1026 |
this->set_proc_info(msg); |
1
by brian
clean slate |
1027 |
return old_msg; |
1028 |
}
|
|
1029 |
inline void exit_cond(const char* old_msg) |
|
1030 |
{
|
|
1031 |
/*
|
|
1032 |
Putting the mutex unlock in exit_cond() ensures that
|
|
1033 |
mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is
|
|
1034 |
locked (if that would not be the case, you'll get a deadlock if someone
|
|
520.1.21
by Brian Aker
THD -> Session rename |
1035 |
does a Session::awake() on you).
|
1
by brian
clean slate |
1036 |
*/
|
1037 |
pthread_mutex_unlock(mysys_var->current_mutex); |
|
1038 |
pthread_mutex_lock(&mysys_var->mutex); |
|
1039 |
mysys_var->current_mutex = 0; |
|
1040 |
mysys_var->current_cond = 0; |
|
322.2.5
by Mats Kindahl
Replaced use of thd_proc_info() macro with calls to |
1041 |
this->set_proc_info(old_msg); |
1
by brian
clean slate |
1042 |
pthread_mutex_unlock(&mysys_var->mutex); |
1043 |
}
|
|
735
by Brian Aker
Refactor session. |
1044 |
inline time_t query_start() { return start_time; } |
1
by brian
clean slate |
1045 |
inline void set_time() |
1046 |
{
|
|
1047 |
if (user_time) |
|
1048 |
{
|
|
1049 |
start_time= user_time; |
|
1050 |
start_utime= utime_after_lock= my_micro_time(); |
|
1051 |
}
|
|
1052 |
else
|
|
1053 |
start_utime= utime_after_lock= my_micro_time_and_time(&start_time); |
|
1054 |
}
|
|
713.1.3
by Monty Taylor
Fixed one more my_time thing. |
1055 |
inline void set_current_time() { start_time= time(NULL); } |
1
by brian
clean slate |
1056 |
inline void set_time(time_t t) |
1057 |
{
|
|
1058 |
start_time= user_time= t; |
|
1059 |
start_utime= utime_after_lock= my_micro_time(); |
|
1060 |
}
|
|
1061 |
void set_time_after_lock() { utime_after_lock= my_micro_time(); } |
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
1062 |
/**
|
1063 |
* Returns the current micro-timestamp
|
|
1064 |
*/
|
|
1065 |
inline uint64_t getCurrentTimestamp() |
|
1066 |
{
|
|
1067 |
return my_micro_time(); |
|
1068 |
}
|
|
151
by Brian Aker
Ulonglong to uint64_t |
1069 |
inline uint64_t found_rows(void) |
1
by brian
clean slate |
1070 |
{
|
1071 |
return limit_found_rows; |
|
1072 |
}
|
|
934.2.28
by Jay Pipes
Renamed some things to our standards and made private methods private... |
1073 |
/** Returns whether the session is currently inside a transaction */
|
1074 |
inline bool inTransaction() |
|
1
by brian
clean slate |
1075 |
{
|
1076 |
return server_status & SERVER_STATUS_IN_TRANS; |
|
1077 |
}
|
|
1078 |
inline bool fill_derived_tables() |
|
1079 |
{
|
|
1080 |
return !lex->only_view_structure(); |
|
1081 |
}
|
|
1082 |
inline void* trans_alloc(unsigned int size) |
|
1083 |
{
|
|
1084 |
return alloc_root(&transaction.mem_root,size); |
|
1085 |
}
|
|
1086 |
||
1087 |
LEX_STRING *make_lex_string(LEX_STRING *lex_str, |
|
482
by Brian Aker
Remove uint. |
1088 |
const char* str, uint32_t length, |
1
by brian
clean slate |
1089 |
bool allocate_lex_string); |
1090 |
||
327.1.5
by Brian Aker
Refactor around classes. TABLE_LIST has been factored out of table.h |
1091 |
void add_changed_table(Table *table); |
1
by brian
clean slate |
1092 |
void add_changed_table(const char *key, long key_length); |
327.2.4
by Brian Aker
Refactoring table.h |
1093 |
CHANGED_TableList * changed_table_dup(const char *key, long key_length); |
1
by brian
clean slate |
1094 |
int send_explain_fields(select_result *result); |
1095 |
/**
|
|
1096 |
Clear the current error, if any.
|
|
1097 |
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
|
|
1098 |
assume this is never called if the fatal error is set.
|
|
1099 |
@todo: To silence an error, one should use Internal_error_handler
|
|
1100 |
mechanism. In future this function will be removed.
|
|
1101 |
*/
|
|
1102 |
inline void clear_error() |
|
1103 |
{
|
|
1104 |
if (main_da.is_error()) |
|
1105 |
main_da.reset_diagnostics_area(); |
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1106 |
return; |
1
by brian
clean slate |
1107 |
}
|
383.1.55
by Monty Taylor
Removed libvio deps from drizzled. |
1108 |
|
1
by brian
clean slate |
1109 |
/**
|
1110 |
Mark the current error as fatal. Warning: this does not
|
|
1111 |
set any error, it sets a property of the error, so must be
|
|
1112 |
followed or prefixed with my_error().
|
|
1113 |
*/
|
|
1114 |
inline void fatal_error() |
|
1115 |
{
|
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1116 |
assert(main_da.is_error()); |
1055.2.17
by Jay Pipes
More style cleanups in Session |
1117 |
is_fatal_error= true; |
1
by brian
clean slate |
1118 |
}
|
1119 |
/**
|
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1120 |
true if there is an error in the error stack.
|
1
by brian
clean slate |
1121 |
|
1122 |
Please use this method instead of direct access to
|
|
1123 |
net.report_error.
|
|
1124 |
||
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1125 |
If true, the current (sub)-statement should be aborted.
|
1
by brian
clean slate |
1126 |
The main difference between this member and is_fatal_error
|
1127 |
is that a fatal error can not be handled by a stored
|
|
1128 |
procedure continue handler, whereas a normal error can.
|
|
1129 |
||
1130 |
To raise this flag, use my_error().
|
|
1131 |
*/
|
|
1132 |
inline bool is_error() const { return main_da.is_error(); } |
|
748
by Brian Aker
Removal of client side collation. |
1133 |
inline const CHARSET_INFO *charset() { return default_charset_info; } |
1
by brian
clean slate |
1134 |
|
1135 |
void change_item_tree(Item **place, Item *new_value) |
|
1136 |
{
|
|
1137 |
*place= new_value; |
|
1138 |
}
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1139 |
/**
|
1
by brian
clean slate |
1140 |
Cleanup statement parse state (parse tree, lex) and execution
|
1141 |
state after execution of a non-prepared SQL statement.
|
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1142 |
|
1143 |
@todo
|
|
1144 |
||
1145 |
Move this to Statement::~Statement
|
|
1
by brian
clean slate |
1146 |
*/
|
1147 |
void end_statement(); |
|
1148 |
inline int killed_errno() const |
|
1149 |
{
|
|
1150 |
killed_state killed_val; /* to cache the volatile 'killed' */ |
|
1151 |
return (killed_val= killed) != KILL_BAD_DATA ? killed_val : 0; |
|
1152 |
}
|
|
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
1153 |
void send_kill_message() const; |
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1154 |
/* return true if we will abort query if we make a warning now */
|
1
by brian
clean slate |
1155 |
inline bool really_abort_on_warning() |
1156 |
{
|
|
1157 |
return (abort_on_warning); |
|
1158 |
}
|
|
1159 |
void set_status_var_init(); |
|
1160 |
void reset_n_backup_open_tables_state(Open_tables_state *backup); |
|
1161 |
void restore_backup_open_tables_state(Open_tables_state *backup); |
|
1162 |
||
1163 |
/**
|
|
1164 |
Set the current database; use deep copy of C-string.
|
|
1165 |
||
1166 |
@param new_db a pointer to the new database name.
|
|
1167 |
@param new_db_len length of the new database name.
|
|
1168 |
||
1169 |
Initialize the current database from a NULL-terminated string with
|
|
1170 |
length. If we run out of memory, we free the current database and
|
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1171 |
return true. This way the user will notice the error as there will be
|
1
by brian
clean slate |
1172 |
no current database selected (in addition to the error message set by
|
1173 |
malloc).
|
|
1174 |
||
1175 |
@note This operation just sets {db, db_length}. Switching the current
|
|
1176 |
database usually involves other actions, like switching other database
|
|
1177 |
attributes including security context. In the future, this operation
|
|
1178 |
will be made private and more convenient interface will be provided.
|
|
1179 |
||
1180 |
@return Operation status
|
|
51.1.50
by Jay Pipes
Removed/replaced DBUG symbols and standardized TRUE/FALSE |
1181 |
@retval false Success
|
1182 |
@retval true Out-of-memory error
|
|
1
by brian
clean slate |
1183 |
*/
|
656.1.22
by Monty Taylor
Removed my_malloc related stuff from log_event and session. |
1184 |
bool set_db(const char *new_db, size_t new_db_len); |
1
by brian
clean slate |
1185 |
|
1186 |
/**
|
|
1187 |
Set the current database; use shallow copy of C-string.
|
|
1188 |
||
1189 |
@param new_db a pointer to the new database name.
|
|
1190 |
@param new_db_len length of the new database name.
|
|
1191 |
||
1192 |
@note This operation just sets {db, db_length}. Switching the current
|
|
1193 |
database usually involves other actions, like switching other database
|
|
1194 |
attributes including security context. In the future, this operation
|
|
1195 |
will be made private and more convenient interface will be provided.
|
|
1196 |
*/
|
|
1197 |
void reset_db(char *new_db, size_t new_db_len) |
|
1198 |
{
|
|
1199 |
db= new_db; |
|
1200 |
db_length= new_db_len; |
|
1201 |
}
|
|
1202 |
/*
|
|
1203 |
Copy the current database to the argument. Use the current arena to
|
|
1204 |
allocate memory for a deep copy: current database may be freed after
|
|
1205 |
a statement is parsed but before it's executed.
|
|
1206 |
*/
|
|
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
1207 |
bool copy_db_to(char **p_db, size_t *p_db_length); |
1
by brian
clean slate |
1208 |
|
1209 |
public: |
|
1210 |
/**
|
|
1211 |
Add an internal error handler to the thread execution context.
|
|
1212 |
@param handler the exception handler to add
|
|
1213 |
*/
|
|
1214 |
void push_internal_handler(Internal_error_handler *handler); |
|
1215 |
||
1216 |
/**
|
|
1217 |
Handle an error condition.
|
|
1218 |
@param sql_errno the error number
|
|
1219 |
@param level the error level
|
|
1220 |
@return true if the error is handled
|
|
1221 |
*/
|
|
482
by Brian Aker
Remove uint. |
1222 |
virtual bool handle_error(uint32_t sql_errno, const char *message, |
261.4.1
by Felipe
- Renamed MYSQL_ERROR to DRIZZLE_ERROR. |
1223 |
DRIZZLE_ERROR::enum_warning_level level); |
1
by brian
clean slate |
1224 |
|
1225 |
/**
|
|
1226 |
Remove the error handler last pushed.
|
|
1227 |
*/
|
|
1228 |
void pop_internal_handler(); |
|
1229 |
||
693
by Brian Aker
Cleaning up session class. |
1230 |
/**
|
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1231 |
Resets Session part responsible for command processing state.
|
1232 |
||
1233 |
This needs to be called before execution of every statement
|
|
1234 |
(prepared or conventional).
|
|
1235 |
It is not called by substatements of routines.
|
|
1236 |
||
1237 |
@todo
|
|
1238 |
Make it a method of Session and align its name with the rest of
|
|
1239 |
reset/end/start/init methods.
|
|
1240 |
@todo
|
|
1241 |
Call it after we use Session for queries, not before.
|
|
735
by Brian Aker
Refactor session. |
1242 |
*/
|
1243 |
void reset_for_next_command(); |
|
1244 |
||
1245 |
/**
|
|
934.2.6
by Jay Pipes
This changeset removes a few more C functions from sql_connect.cc/connect.h |
1246 |
* Disconnects the session from a client connection and
|
1247 |
* updates any status variables necessary.
|
|
1248 |
*
|
|
1249 |
* @param errcode Error code to print to console
|
|
1250 |
* @param should_lock 1 if we have have to lock LOCK_thread_count
|
|
1251 |
*
|
|
1252 |
* @note For the connection that is doing shutdown, this is called twice
|
|
1253 |
*/
|
|
1254 |
void disconnect(uint32_t errcode, bool lock); |
|
693
by Brian Aker
Cleaning up session class. |
1255 |
|
934.2.28
by Jay Pipes
Renamed some things to our standards and made private methods private... |
1256 |
/**
|
1257 |
* Check if user exists and the password supplied is correct.
|
|
1258 |
*
|
|
1259 |
* Returns true on success, and false on failure.
|
|
1260 |
*
|
|
1261 |
* @note Host, user and passwd may point to communication buffer.
|
|
1262 |
* Current implementation does not depend on that, but future changes
|
|
1263 |
* should be done with this in mind;
|
|
1264 |
*
|
|
1265 |
* @param Scrambled password received from client
|
|
1266 |
* @param Length of scrambled password
|
|
1267 |
* @param Database name to connect to, may be NULL
|
|
1268 |
*/
|
|
965
by Brian Aker
Merge with Jay |
1269 |
bool checkUser(const char *passwd, uint32_t passwd_len, const char *db); |
971.3.6
by Eric Day
Moved the last of the libdrizzleclient calls into Protocol. |
1270 |
|
1271 |
private: |
|
322.2.2
by Mats Kindahl
Hiding THD::proc_info field and providing a setter and getter. |
1272 |
const char *proc_info; |
1273 |
||
1
by brian
clean slate |
1274 |
/** The current internal error handler for this thread, or NULL. */
|
1275 |
Internal_error_handler *m_internal_handler; |
|
1276 |
/**
|
|
1277 |
The lex to hold the parsed tree of conventional (non-prepared) queries.
|
|
1278 |
Whereas for prepared and stored procedure statements we use an own lex
|
|
1279 |
instance for each new query, for conventional statements we reuse
|
|
1280 |
the same lex. (@see mysql_parse for details).
|
|
1281 |
*/
|
|
1282 |
LEX main_lex; |
|
1283 |
/**
|
|
1284 |
This memory root is used for two purposes:
|
|
1285 |
- for conventional queries, to allocate structures stored in main_lex
|
|
1286 |
during parsing, and allocate runtime data (execution plan, etc.)
|
|
1287 |
during execution.
|
|
1288 |
- for prepared queries, only to allocate runtime data. The parsed
|
|
1289 |
tree itself is reused between executions and thus is stored elsewhere.
|
|
1290 |
*/
|
|
1291 |
MEM_ROOT main_mem_root; |
|
836
by Brian Aker
Fixed session call from function to method. |
1292 |
|
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1293 |
/**
|
1294 |
* Marks all tables in the list which were used by current substatement
|
|
1295 |
* as free for reuse.
|
|
1296 |
*
|
|
1297 |
* @param Head of the list of tables
|
|
1298 |
*
|
|
1299 |
* @note
|
|
1300 |
*
|
|
1301 |
* The reason we reset query_id is that it's not enough to just test
|
|
1302 |
* if table->query_id != session->query_id to know if a table is in use.
|
|
1303 |
*
|
|
1304 |
* For example
|
|
1305 |
*
|
|
1306 |
* SELECT f1_that_uses_t1() FROM t1;
|
|
1307 |
*
|
|
1308 |
* In f1_that_uses_t1() we will see one instance of t1 where query_id is
|
|
1309 |
* set to query_id of original query.
|
|
1310 |
*/
|
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
1311 |
void mark_used_tables_as_free_for_reuse(Table *table); |
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1312 |
/**
|
1313 |
Mark all temporary tables which were used by the current statement or
|
|
1314 |
substatement as free for reuse, but only if the query_id can be cleared.
|
|
1315 |
||
1316 |
@param session thread context
|
|
1317 |
||
1318 |
@remark For temp tables associated with a open SQL HANDLER the query_id
|
|
1319 |
is not reset until the HANDLER is closed.
|
|
1320 |
*/
|
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
1321 |
void mark_temp_tables_as_free_for_reuse(); |
1322 |
||
836
by Brian Aker
Fixed session call from function to method. |
1323 |
public: |
1046.1.4
by Brian Aker
Move lazy read of refresh to outside of LOCK_open (we don't lock the refresh |
1324 |
|
836
by Brian Aker
Fixed session call from function to method. |
1325 |
/** A short cut for session->main_da.set_ok_status(). */
|
1326 |
inline void my_ok(ha_rows affected_rows= 0, uint64_t passed_id= 0, const char *message= NULL) |
|
1327 |
{
|
|
1328 |
main_da.set_ok_status(this, affected_rows, passed_id, message); |
|
1329 |
}
|
|
1330 |
||
1331 |
||
1332 |
/** A short cut for session->main_da.set_eof_status(). */
|
|
1333 |
||
1334 |
inline void my_eof() |
|
1335 |
{
|
|
1336 |
main_da.set_eof_status(this); |
|
1337 |
}
|
|
838
by Brian Aker
More class adoption/method |
1338 |
|
1339 |
/* Some inline functions for more speed */
|
|
1340 |
||
1341 |
inline bool add_item_to_list(Item *item) |
|
1342 |
{
|
|
1343 |
return lex->current_select->add_item_to_list(this, item); |
|
1344 |
}
|
|
1345 |
||
1346 |
inline bool add_value_to_list(Item *value) |
|
1347 |
{
|
|
1348 |
return lex->value_list.push_back(value); |
|
1349 |
}
|
|
1350 |
||
1351 |
inline bool add_order_to_list(Item *item, bool asc) |
|
1352 |
{
|
|
1353 |
return lex->current_select->add_order_to_list(this, item, asc); |
|
1354 |
}
|
|
1355 |
||
1356 |
inline bool add_group_to_list(Item *item, bool asc) |
|
1357 |
{
|
|
1358 |
return lex->current_select->add_group_to_list(this, item, asc); |
|
1359 |
}
|
|
855
by Brian Aker
Refactor reset of status. |
1360 |
void refresh_status(); |
995
by Brian Aker
Refactor get_variable to session |
1361 |
user_var_entry *getVariable(LEX_STRING &name, bool create_if_not_exists); |
1046.1.14
by Brian Aker
More redactoring of all lock issue code that is session bound, to be a |
1362 |
|
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1363 |
/**
|
1364 |
* Closes all tables used by the current substatement, or all tables
|
|
1365 |
* used by this thread if we are on the upper level.
|
|
1366 |
*/
|
|
1039.1.16
by Brian Aker
A lot of little cleanups (most based off lcov) |
1367 |
void close_thread_tables(); |
1089.1.7
by Brian Aker
Shuffled free_cached_table() to table |
1368 |
void close_old_data_files(bool morph_locks= false, |
1369 |
bool send_refresh= false); |
|
1046.1.14
by Brian Aker
More redactoring of all lock issue code that is session bound, to be a |
1370 |
void close_open_tables(); |
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1371 |
void close_data_files_and_morph_locks(const char *db, const char *table_name); |
1089.1.7
by Brian Aker
Shuffled free_cached_table() to table |
1372 |
|
1373 |
private: |
|
1374 |
bool free_cached_table(); |
|
1375 |
public: |
|
1376 |
||
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1377 |
/**
|
1378 |
* Prepares statement for reopening of tables and recalculation of set of
|
|
1379 |
* prelocked tables.
|
|
1380 |
*
|
|
1381 |
* @param Pointer to a pointer to a list of tables which we were trying to open and lock
|
|
1382 |
*/
|
|
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1383 |
void close_tables_for_reopen(TableList **tables); |
1089.1.7
by Brian Aker
Shuffled free_cached_table() to table |
1384 |
|
1385 |
||
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1386 |
/**
|
1387 |
* Open all tables in list, locks them (all, including derived)
|
|
1388 |
*
|
|
1389 |
* @param Pointer to a list of tables for open & locking
|
|
1390 |
*
|
|
1391 |
* @retval
|
|
1392 |
* false - ok
|
|
1393 |
* @retval
|
|
1394 |
* true - error
|
|
1395 |
*
|
|
1396 |
* @note
|
|
1397 |
*
|
|
1398 |
* The lock will automaticaly be freed by close_thread_tables()
|
|
1399 |
*/
|
|
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1400 |
int open_and_lock_tables(TableList *tables); |
1055.2.24
by Jay Pipes
Merge with trunk and resolve conflicts. |
1401 |
/**
|
1402 |
* Open all tables in list and process derived tables
|
|
1403 |
*
|
|
1404 |
* @param Pointer to a list of tables for open
|
|
1405 |
* @param Bitmap of flags to modify how the tables will be open:
|
|
1406 |
* DRIZZLE_LOCK_IGNORE_FLUSH - open table even if someone has
|
|
1407 |
* done a flush or namelock on it.
|
|
1408 |
*
|
|
1409 |
* @retval
|
|
1410 |
* false - ok
|
|
1411 |
* @retval
|
|
1412 |
* true - error
|
|
1413 |
*
|
|
1414 |
* @note
|
|
1415 |
*
|
|
1416 |
* This is to be used on prepare stage when you don't read any
|
|
1417 |
* data from the tables.
|
|
1418 |
*/
|
|
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1419 |
bool open_normal_and_derived_tables(TableList *tables, uint32_t flags); |
1420 |
int open_tables_from_list(TableList **start, uint32_t *counter, uint32_t flags); |
|
1054.1.11
by Brian Aker
Remove dead lock.cc commands. |
1421 |
Table *open_ltable(TableList *table_list, thr_lock_type lock_type); |
1054.1.10
by Brian Aker
Move open_table() to session. |
1422 |
Table *open_table(TableList *table_list, bool *refresh, uint32_t flags); |
1054.1.11
by Brian Aker
Remove dead lock.cc commands. |
1423 |
void unlink_open_table(Table *find); |
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1424 |
void drop_open_table(Table *table, const char *db_name, |
1425 |
const char *table_name); |
|
1054.1.11
by Brian Aker
Remove dead lock.cc commands. |
1426 |
void close_cached_table(Table *table); |
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1427 |
|
1428 |
/* Create a lock in the cache */
|
|
1429 |
Table *table_cache_insert_placeholder(const char *key, uint32_t key_length); |
|
1430 |
bool lock_table_name_if_not_cached(const char *db, |
|
1431 |
const char *table_name, Table **table); |
|
1432 |
||
1433 |
/* Work with temporary tables */
|
|
1434 |
Table *find_temporary_table(TableList *table_list); |
|
1435 |
Table *find_temporary_table(const char *db, const char *table_name); |
|
1046.1.14
by Brian Aker
More redactoring of all lock issue code that is session bound, to be a |
1436 |
void close_temporary_tables(); |
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1437 |
void close_temporary_table(Table *table, bool free_share, bool delete_table); |
1438 |
int drop_temporary_table(TableList *table_list); |
|
1439 |
||
1440 |
/* Reopen operations */
|
|
1046.1.14
by Brian Aker
More redactoring of all lock issue code that is session bound, to be a |
1441 |
bool reopen_tables(bool get_locks, bool mark_share_as_old); |
1054.1.9
by Brian Aker
This is a large number of refactors against the Session class for its |
1442 |
bool reopen_name_locked_table(TableList* table_list, bool link_in); |
1054.1.10
by Brian Aker
Move open_table() to session. |
1443 |
|
1444 |
void wait_for_condition(pthread_mutex_t *mutex, pthread_cond_t *cond); |
|
1
by brian
clean slate |
1445 |
};
|
1446 |
||
1447 |
class JOIN; |
|
1448 |
||
1449 |
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape |
|
1450 |
||
850
by Brian Aker
More class creation. |
1451 |
#include <drizzled/select_to_file.h> |
1452 |
#include <drizzled/select_export.h> |
|
1453 |
#include <drizzled/select_dump.h> |
|
1454 |
#include <drizzled/select_insert.h> |
|
1455 |
#include <drizzled/select_create.h> |
|
992.1.25
by Monty Taylor
Moved myisam to new plugin system. |
1456 |
#include <plugin/myisam/myisam.h> |
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
1457 |
#include <drizzled/tmp_table_param.h> |
1458 |
#include <drizzled/select_union.h> |
|
1459 |
#include <drizzled/select_subselect.h> |
|
1460 |
#include <drizzled/select_singlerow_subselect.h> |
|
1461 |
#include <drizzled/select_max_min_finder_subselect.h> |
|
1462 |
#include <drizzled/select_exists_subselect.h> |
|
1
by brian
clean slate |
1463 |
|
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1464 |
/**
|
1465 |
* A structure used to describe sort information
|
|
1466 |
* for a field or item used in ORDER BY.
|
|
1467 |
*/
|
|
1468 |
typedef struct st_sort_field |
|
1469 |
{
|
|
1470 |
Field *field; /**< Field to sort */ |
|
1471 |
Item *item; /**< Item if not sorting fields */ |
|
1472 |
size_t length; /**< Length of sort field */ |
|
1473 |
uint32_t suffix_length; /**< Length suffix (0-4) */ |
|
1474 |
Item_result result_type; /**< Type of item */ |
|
1475 |
bool reverse; /**< if descending sort */ |
|
1476 |
bool need_strxnfrm; /**< If we have to use strxnfrm() */ |
|
1
by brian
clean slate |
1477 |
} SORT_FIELD; |
1478 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1479 |
typedef struct st_sort_buffer |
1480 |
{
|
|
1481 |
uint32_t index; /* 0 or 1 */ |
|
482
by Brian Aker
Remove uint. |
1482 |
uint32_t sort_orders; |
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1483 |
uint32_t change_pos; /* If sort-fields changed */ |
1
by brian
clean slate |
1484 |
char **buff; |
1485 |
SORT_FIELD *sortorder; |
|
1486 |
} SORT_BUFFER; |
|
1487 |
||
851
by Brian Aker
Class rewrite of Session (aka get all of the junk out) |
1488 |
#include <drizzled/table_ident.h> |
1489 |
#include <drizzled/user_var_entry.h> |
|
1490 |
#include <drizzled/unique.h> |
|
1491 |
#include <drizzled/multi_delete.h> |
|
1492 |
#include <drizzled/multi_update.h> |
|
1493 |
#include <drizzled/my_var.h> |
|
1494 |
#include <drizzled/select_dumpvar.h> |
|
1
by brian
clean slate |
1495 |
|
1496 |
/* Bits in sql_command_flags */
|
|
1497 |
||
1055.2.13
by Jay Pipes
Documentation and style fixes in Session class. Doxygen should finally pick up the Statement and Session classes now. Removes the silly Query_arena class, as it's not needed anymore. |
1498 |
enum sql_command_flag_bits |
1499 |
{
|
|
590.2.17
by Monty Taylor
Changed CF_BIT_* to an enum. |
1500 |
CF_BIT_CHANGES_DATA, |
1501 |
CF_BIT_HAS_ROW_COUNT, |
|
1502 |
CF_BIT_STATUS_COMMAND, |
|
1503 |
CF_BIT_SHOW_TABLE_COMMAND, |
|
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
1504 |
CF_BIT_WRITE_LOGS_COMMAND, |
1505 |
CF_BIT_SIZE
|
|
590.2.17
by Monty Taylor
Changed CF_BIT_* to an enum. |
1506 |
};
|
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. |
1507 |
|
590.2.18
by Monty Taylor
Changed the bitset<32> to a bitset<5>. Made the int constants into bitset constants. |
1508 |
static const std::bitset<CF_BIT_SIZE> CF_CHANGES_DATA(1 << CF_BIT_CHANGES_DATA); |
1509 |
static const std::bitset<CF_BIT_SIZE> CF_HAS_ROW_COUNT(1 << CF_BIT_HAS_ROW_COUNT); |
|
1510 |
static const std::bitset<CF_BIT_SIZE> CF_STATUS_COMMAND(1 << CF_BIT_STATUS_COMMAND); |
|
1511 |
static const std::bitset<CF_BIT_SIZE> CF_SHOW_TABLE_COMMAND(1 << CF_BIT_SHOW_TABLE_COMMAND); |
|
1512 |
static const std::bitset<CF_BIT_SIZE> CF_WRITE_LOGS_COMMAND(1 << CF_BIT_WRITE_LOGS_COMMAND); |
|
1
by brian
clean slate |
1513 |
|
1514 |
/* Functions in sql_class.cc */
|
|
1515 |
void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var); |
|
1516 |
||
1517 |
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, |
|
1518 |
STATUS_VAR *dec_var); |
|
1519 |
||
897.2.2
by Jay Pipes
Replaced custom List in select_dumpvar.h with std::vector<> |
1520 |
#endif /* DRIZZLED_SESSION_H */ |