265
265
void mark_transaction_to_rollback(Session *session, bool all);
268
* Single command executed against this connection.
272
* One connection can contain a lot of simultaneously running statements,
273
* some of which could be prepared, that is, contain placeholders.
275
* To perform some action with statement we reset Session part to the state of
276
* that statement, do the action, and then save back modified state from Session
277
* to the statement. It will be changed in near future, and Statement will
278
* be used explicitly.
282
* The above comment is bullshit in Drizzle. See TODO markers on Session to
283
* completely detach the inheritance of Session from Statement.
269
struct st_savepoint *prev;
272
Ha_trx_info *ha_list;
275
extern pthread_mutex_t LOCK_xid_cache;
276
extern HASH xid_cache;
278
#include <drizzled/security_context.h>
279
#include <drizzled/open_tables_state.h>
281
#include <drizzled/internal_error_handler.h>
282
#include <drizzled/diagnostics_area.h>
285
Storage engine specific thread local data.
290
Storage engine specific thread local data.
291
Lifetime: one user connection.
295
0: Life time: one statement within a transaction. If @@autocommit is
296
on, also represents the entire transaction.
297
@sa trans_register_ha()
299
1: Life time: one transaction within a connection.
300
If the storage engine does not participate in a transaction,
301
this should not be used.
302
@sa trans_register_ha()
304
Ha_trx_info ha_info[2];
306
Ha_data() :ha_ptr(NULL) {}
310
* Represents a client connection to the database server.
312
* Contains the client/server protocol object, the current statement
313
* being executed, local-to-session variables and status counters, and
314
* a host of other information.
318
* Session should NOT inherit from Statement, but rather it should have a
319
* vector of Statement object pointers which comprise the statements executed
320
* on the Session. Until this architectural change is done, we can forget
321
* about parallel operations inside a session.
325
* Make member variables private and have inlined accessors and setters. Hide
326
* all member variables that are not critical to non-internal operations of the
329
class Session : public Open_tables_state
287
Statement(const Statement &rhs); /* not implemented: */
288
Statement &operator=(const Statement &rhs); /* non-copyable */
291
* List of items created in the parser for this query. Every item puts
292
* itself to the list on creation (see Item::Item() for details))
295
MEM_ROOT *mem_root; /**< Pointer to current memroot */
297
* Uniquely identifies each statement object in thread scope; change during
298
* statement lifetime.
300
* @todo should be const
334
* The elements from here until the END_STATEMENT_VARIABLES below have
335
* been coped from the original Statement class that used to be declared
336
* in this header file. Session used to inherit from that class. Thus, we
337
* copied the elements from Statement that were needed in Session and then
338
* removed the Statement class.
305
342
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
306
343
handler of fields used is set
315
352
enum enum_mark_columns mark_used_columns;
353
inline void* alloc(size_t size)
355
return alloc_root(mem_root,size);
357
inline void* calloc(size_t size)
360
if ((ptr= alloc_root(mem_root,size)))
361
memset(ptr, 0, size);
364
inline char *strdup(const char *str)
366
return strdup_root(mem_root,str);
368
inline char *strmake(const char *str, size_t size)
370
return strmake_root(mem_root,str,size);
372
inline void *memdup(const void *str, size_t size)
374
return memdup_root(mem_root,str,size);
376
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
379
if ((ptr= alloc_root(mem_root,size+gap)))
380
memcpy(ptr,str,size);
383
/** Frees all items attached to this Statement */
386
* List of items created in the parser for this query. Every item puts
387
* itself to the list on creation (see Item::Item() for details))
390
MEM_ROOT *mem_root; /**< Pointer to current memroot */
392
* Uniquely identifies each statement object in thread scope; change during
393
* statement lifetime.
395
* @todo should be const
317
398
LEX *lex; /**< parse tree descriptor */
319
400
Points to the query associated with this statement. It's const, but
356
437
uint32_t db_length; /**< Length of current schema name */
360
/* This constructor is called for backup statements */
363
Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, uint32_t id_arg)
366
mem_root(mem_root_arg),
368
mark_used_columns(MARK_COLUMNS_READ),
375
virtual ~Statement() {}
376
inline void* alloc(size_t size)
378
return alloc_root(mem_root,size);
380
inline void* calloc(size_t size)
383
if ((ptr= alloc_root(mem_root,size)))
384
memset(ptr, 0, size);
387
inline char *strdup(const char *str)
389
return strdup_root(mem_root,str);
391
inline char *strmake(const char *str, size_t size)
393
return strmake_root(mem_root,str,size);
395
inline void *memdup(const void *str, size_t size)
397
return memdup_root(mem_root,str,size);
399
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
402
if ((ptr= alloc_root(mem_root,size+gap)))
403
memcpy(ptr,str,size);
406
/** Frees all items attached to this Statement */
412
struct st_savepoint *prev;
415
Ha_trx_info *ha_list;
418
extern pthread_mutex_t LOCK_xid_cache;
419
extern HASH xid_cache;
421
#include <drizzled/security_context.h>
422
#include <drizzled/open_tables_state.h>
424
#include <drizzled/internal_error_handler.h>
425
#include <drizzled/diagnostics_area.h>
428
Storage engine specific thread local data.
433
Storage engine specific thread local data.
434
Lifetime: one user connection.
438
0: Life time: one statement within a transaction. If @@autocommit is
439
on, also represents the entire transaction.
440
@sa trans_register_ha()
442
1: Life time: one transaction within a connection.
443
If the storage engine does not participate in a transaction,
444
this should not be used.
445
@sa trans_register_ha()
447
Ha_trx_info ha_info[2];
449
Ha_data() :ha_ptr(NULL) {}
453
* Represents a client connection to the database server.
455
* Contains the client/server protocol object, the current statement
456
* being executed, local-to-session variables and status counters, and
457
* a host of other information.
461
* Session should NOT inherit from Statement, but rather it should have a
462
* vector of Statement object pointers which comprise the statements executed
463
* on the Session. Until this architectural change is done, we can forget
464
* about parallel operations inside a session.
468
* Make member variables private and have inlined accessors and setters. Hide
469
* all member variables that are not critical to non-internal operations of the
472
class Session :public Statement, public Open_tables_state
438
/**< END_STATEMENT_VARIABLES */
476
441
Constant for Session::where initialization in the beginning of every query.