260
261
void mark_transaction_to_rollback(Session *session, bool all);
263
* Single command executed against this connection.
267
* One connection can contain a lot of simultaneously running statements,
268
* some of which could be prepared, that is, contain placeholders.
270
* To perform some action with statement we reset Session part to the state of
271
* that statement, do the action, and then save back modified state from Session
272
* to the statement. It will be changed in near future, and Statement will
273
* be used explicitly.
277
* The above comment is bullshit in Drizzle. See TODO markers on Session to
278
* completely detach the inheritance of Session from Statement.
265
struct st_savepoint *prev;
268
Ha_trx_info *ha_list;
271
extern pthread_mutex_t LOCK_xid_cache;
272
extern HASH xid_cache;
274
#include <drizzled/security_context.h>
275
#include <drizzled/open_tables_state.h>
277
#include <drizzled/internal_error_handler.h>
278
#include <drizzled/diagnostics_area.h>
281
Storage engine specific thread local data.
286
Storage engine specific thread local data.
287
Lifetime: one user connection.
291
0: Life time: one statement within a transaction. If @@autocommit is
292
on, also represents the entire transaction.
293
@sa trans_register_ha()
295
1: Life time: one transaction within a connection.
296
If the storage engine does not participate in a transaction,
297
this should not be used.
298
@sa trans_register_ha()
300
Ha_trx_info ha_info[2];
302
Ha_data() :ha_ptr(NULL) {}
306
* Represents a client connection to the database server.
308
* Contains the client/server protocol object, the current statement
309
* being executed, local-to-session variables and status counters, and
310
* a host of other information.
314
* The Session class should have a vector of Statement object pointers which
315
* comprise the statements executed on the Session. Until this architectural
316
* change is done, we can forget about parallel operations inside a session.
320
* Make member variables private and have inlined accessors and setters. Hide
321
* all member variables that are not critical to non-internal operations of the
324
class Session : public Open_tables_state
282
Statement(const Statement &rhs); /* not implemented: */
283
Statement &operator=(const Statement &rhs); /* non-copyable */
286
* List of items created in the parser for this query. Every item puts
287
* itself to the list on creation (see Item::Item() for details))
290
MEM_ROOT *mem_root; /**< Pointer to current memroot */
292
* Uniquely identifies each statement object in thread scope; change during
293
* statement lifetime.
295
* @todo should be const
300
328
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
301
329
handler of fields used is set
310
338
enum enum_mark_columns mark_used_columns;
339
inline void* alloc(size_t size)
341
return alloc_root(mem_root,size);
343
inline void* calloc(size_t size)
346
if ((ptr= alloc_root(mem_root,size)))
347
memset(ptr, 0, size);
350
inline char *strdup(const char *str)
352
return strdup_root(mem_root,str);
354
inline char *strmake(const char *str, size_t size)
356
return strmake_root(mem_root,str,size);
358
inline void *memdup(const void *str, size_t size)
360
return memdup_root(mem_root,str,size);
362
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
365
if ((ptr= alloc_root(mem_root,size+gap)))
366
memcpy(ptr,str,size);
369
/** Frees all items attached to this Statement */
372
* List of items created in the parser for this query. Every item puts
373
* itself to the list on creation (see Item::Item() for details))
376
MEM_ROOT *mem_root; /**< Pointer to current memroot */
378
* Uniquely identifies each statement object in thread scope; change during
379
* statement lifetime.
381
* @todo should be const
312
384
LEX *lex; /**< parse tree descriptor */
314
386
Points to the query associated with this statement. It's const, but
351
423
uint32_t db_length; /**< Length of current schema name */
355
/* This constructor is called for backup statements */
358
Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg, uint32_t id_arg)
361
mem_root(mem_root_arg),
363
mark_used_columns(MARK_COLUMNS_READ),
370
virtual ~Statement() {}
371
inline void* alloc(size_t size)
373
return alloc_root(mem_root,size);
375
inline void* calloc(size_t size)
378
if ((ptr= alloc_root(mem_root,size)))
379
memset(ptr, 0, size);
382
inline char *strdup(const char *str)
384
return strdup_root(mem_root,str);
386
inline char *strmake(const char *str, size_t size)
388
return strmake_root(mem_root,str,size);
390
inline void *memdup(const void *str, size_t size)
392
return memdup_root(mem_root,str,size);
394
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
397
if ((ptr= alloc_root(mem_root,size+gap)))
398
memcpy(ptr,str,size);
401
/** Frees all items attached to this Statement */
407
struct st_savepoint *prev;
410
Ha_trx_info *ha_list;
413
extern pthread_mutex_t LOCK_xid_cache;
414
extern HASH xid_cache;
416
#include <drizzled/security_context.h>
417
#include <drizzled/open_tables_state.h>
419
#include <drizzled/internal_error_handler.h>
420
#include <drizzled/diagnostics_area.h>
423
Storage engine specific thread local data.
428
Storage engine specific thread local data.
429
Lifetime: one user connection.
433
0: Life time: one statement within a transaction. If @@autocommit is
434
on, also represents the entire transaction.
435
@sa trans_register_ha()
437
1: Life time: one transaction within a connection.
438
If the storage engine does not participate in a transaction,
439
this should not be used.
440
@sa trans_register_ha()
442
Ha_trx_info ha_info[2];
444
Ha_data() :ha_ptr(NULL) {}
448
* Represents a client connection to the database server.
450
* Contains the client/server protocol object, the current statement
451
* being executed, local-to-session variables and status counters, and
452
* a host of other information.
456
* Session should NOT inherit from Statement, but rather it should have a
457
* vector of Statement object pointers which comprise the statements executed
458
* on the Session. Until this architectural change is done, we can forget
459
* about parallel operations inside a session.
463
* Make member variables private and have inlined accessors and setters. Hide
464
* all member variables that are not critical to non-internal operations of the
467
class Session :public Statement, public Open_tables_state
471
426
Constant for Session::where initialization in the beginning of every query.