260
260
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.
264
struct st_savepoint *prev;
267
Ha_trx_info *ha_list;
270
extern pthread_mutex_t LOCK_xid_cache;
271
extern HASH xid_cache;
273
#include <drizzled/security_context.h>
274
#include <drizzled/open_tables_state.h>
276
#include <drizzled/internal_error_handler.h>
277
#include <drizzled/diagnostics_area.h>
280
Storage engine specific thread local data.
285
Storage engine specific thread local data.
286
Lifetime: one user connection.
290
0: Life time: one statement within a transaction. If @@autocommit is
291
on, also represents the entire transaction.
292
@sa trans_register_ha()
294
1: Life time: one transaction within a connection.
295
If the storage engine does not participate in a transaction,
296
this should not be used.
297
@sa trans_register_ha()
299
Ha_trx_info ha_info[2];
301
Ha_data() :ha_ptr(NULL) {}
305
* Represents a client connection to the database server.
307
* Contains the client/server protocol object, the current statement
308
* being executed, local-to-session variables and status counters, and
309
* a host of other information.
313
* The Session class should have a vector of Statement object pointers which
314
* comprise the statements executed on the Session. Until this architectural
315
* change is done, we can forget about parallel operations inside a session.
319
* Make member variables private and have inlined accessors and setters. Hide
320
* all member variables that are not critical to non-internal operations of the
323
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
327
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
301
328
handler of fields used is set
310
337
enum enum_mark_columns mark_used_columns;
338
inline void* alloc(size_t size)
340
return alloc_root(mem_root,size);
342
inline void* calloc(size_t size)
345
if ((ptr= alloc_root(mem_root,size)))
346
memset(ptr, 0, size);
349
inline char *strdup(const char *str)
351
return strdup_root(mem_root,str);
353
inline char *strmake(const char *str, size_t size)
355
return strmake_root(mem_root,str,size);
357
inline void *memdup(const void *str, size_t size)
359
return memdup_root(mem_root,str,size);
361
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
364
if ((ptr= alloc_root(mem_root,size+gap)))
365
memcpy(ptr,str,size);
368
/** Frees all items attached to this Statement */
371
* List of items created in the parser for this query. Every item puts
372
* itself to the list on creation (see Item::Item() for details))
375
MEM_ROOT *mem_root; /**< Pointer to current memroot */
377
* Uniquely identifies each statement object in thread scope; change during
378
* statement lifetime.
380
* @todo should be const
312
383
LEX *lex; /**< parse tree descriptor */
314
385
Points to the query associated with this statement. It's const, but
351
422
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
425
Constant for Session::where initialization in the beginning of every query.