~jaypipes/drizzle/split-xa-resource-manager

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Jay Pipes
  • Date: 2010-02-06 01:51:20 UTC
  • mfrom: (1273.1.10 build)
  • Revision ID: jpipes@serialcoder-20100206015120-as4vb638inbzrb59
Merge trunk changes and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <bitset>
43
43
#include <deque>
44
44
 
 
45
#include <drizzled/security_context.h>
 
46
#include <drizzled/open_tables_state.h>
 
47
 
 
48
#include <drizzled/internal_error_handler.h>
 
49
#include <drizzled/diagnostics_area.h>
 
50
 
45
51
#define MIN_HANDSHAKE_SIZE      6
46
52
 
47
53
namespace drizzled
48
54
{
 
55
 
49
56
namespace plugin
50
57
{
51
58
class Client;
56
63
class Transaction;
57
64
class Statement;
58
65
}
 
66
namespace internal
 
67
{
 
68
struct st_my_thread_var;
59
69
}
60
70
 
61
71
class Lex_input_stream;
63
73
class CopyField;
64
74
class Table_ident;
65
75
 
66
 
struct st_my_thread_var;
67
76
 
68
77
extern char internal_table_name[2];
69
78
extern char empty_c_string[1];
79
88
  to hande the entire table-share for a local table. Once Hash is done,
80
89
  we should consider exchanging the map for it.
81
90
*/
82
 
typedef std::map <std::string, drizzled::message::Table> ProtoCache;
 
91
typedef std::map <std::string, message::Table> ProtoCache;
83
92
 
84
93
/**
85
94
  The COPY_INFO structure is used by INSERT/REPLACE code.
118
127
  THR_LOCK_DATA **locks;
119
128
} DRIZZLE_LOCK;
120
129
 
 
130
} /* namespace drizzled */
 
131
 
 
132
/** @TODO why is this in the middle of the file */
121
133
#include <drizzled/lex_column.h>
122
134
 
 
135
namespace drizzled
 
136
{
 
137
 
123
138
class select_result;
124
139
class Time_zone;
125
140
 
182
197
  uint64_t group_concat_max_len;
183
198
  uint64_t pseudo_thread_id;
184
199
 
185
 
  drizzled::plugin::StorageEngine *storage_engine;
 
200
  plugin::StorageEngine *storage_engine;
186
201
 
187
202
  /* Only charset part of these variables is sensible */
188
203
  const CHARSET_INFO  *character_set_filesystem;
203
218
 
204
219
extern struct system_variables global_system_variables;
205
220
 
206
 
#include "sql_lex.h"
 
221
} /* namespace drizzled */
 
222
 
 
223
#include "drizzled/sql_lex.h"
 
224
 
 
225
namespace drizzled
 
226
{
207
227
 
208
228
/**
209
229
 * Per-session local status counters
282
302
extern pthread_mutex_t LOCK_xid_cache;
283
303
extern HASH xid_cache;
284
304
 
285
 
#include <drizzled/security_context.h>
286
 
#include <drizzled/open_tables_state.h>
287
 
 
288
 
#include <drizzled/internal_error_handler.h>
289
 
#include <drizzled/diagnostics_area.h>
290
305
 
291
306
/**
292
307
  Storage engine specific thread local data.
384
399
   * itself to the list on creation (see Item::Item() for details))
385
400
   */
386
401
  Item *free_list;
387
 
  drizzled::memory::Root *mem_root; /**< Pointer to current memroot */
 
402
  memory::Root *mem_root; /**< Pointer to current memroot */
388
403
  /**
389
404
   * Uniquely identifies each statement object in thread scope; change during
390
405
   * statement lifetime.
440
455
  */
441
456
  static const char * const DEFAULT_WHERE;
442
457
 
443
 
  drizzled::memory::Root warn_root; /**< Allocation area for warnings and errors */
444
 
  drizzled::plugin::Client *client; /**< Pointer to client object */
445
 
  drizzled::plugin::Scheduler *scheduler; /**< Pointer to scheduler object */
 
458
  memory::Root warn_root; /**< Allocation area for warnings and errors */
 
459
  plugin::Client *client; /**< Pointer to client object */
 
460
  plugin::Scheduler *scheduler; /**< Pointer to scheduler object */
446
461
  void *scheduler_arg; /**< Pointer to the optional scheduler argument */
447
462
  HASH user_vars; /**< Hash of user variables defined during the session's lifetime */
448
463
  struct system_variables variables; /**< Mutable local variables local to the session */
492
507
    chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
493
508
  */
494
509
  uint32_t dbug_sentry; /**< watch for memory corruption */
495
 
  struct st_my_thread_var *mysys_var;
 
510
  internal::st_my_thread_var *mysys_var;
496
511
  /**
497
512
   * Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from
498
513
   * first byte of the packet in executeStatement()
527
542
  query_id_t query_id;
528
543
  query_id_t warn_query_id;
529
544
public:
530
 
  void **getEngineData(const drizzled::plugin::StorageEngine *engine);
531
 
  drizzled::ResourceContext *getResourceContext(const drizzled::plugin::StorageEngine *engine,
532
 
                                                size_t index= 0);
 
545
  void **getEngineData(const plugin::StorageEngine *engine);
 
546
  ResourceContext *getResourceContext(const plugin::StorageEngine *engine,
 
547
                                      size_t index= 0);
533
548
 
534
549
  struct st_transactions {
535
 
    std::deque<drizzled::NamedSavepoint> savepoints;
536
 
    drizzled::TransactionContext all; ///< Trans since BEGIN WORK
537
 
    drizzled::TransactionContext stmt; ///< Trans for current statement
 
550
    std::deque<NamedSavepoint> savepoints;
 
551
    TransactionContext all; ///< Trans since BEGIN WORK
 
552
    TransactionContext stmt; ///< Trans for current statement
538
553
    XID_STATE xid_state;
539
554
 
540
555
    void cleanup()
546
561
      all(),
547
562
      stmt(),
548
563
      xid_state()
549
 
    {
550
 
    }
 
564
    { }
551
565
  } transaction;
552
566
 
553
567
  Field *dup_field;
872
886
    auto_inc_intervals_forced.append(next_id, UINT64_MAX, 0);
873
887
  }
874
888
 
875
 
  Session(drizzled::plugin::Client *client_arg);
 
889
  Session(plugin::Client *client_arg);
876
890
  virtual ~Session();
877
891
 
878
892
  void cleanup(void);
1201
1215
   * Session being managed by the ReplicationServices component, or
1202
1216
   * NULL if no active message.
1203
1217
   */
1204
 
  drizzled::message::Transaction *getTransactionMessage() const
 
1218
  message::Transaction *getTransactionMessage() const
1205
1219
  {
1206
1220
    return transaction_message;
1207
1221
  }
1210
1224
   * Returns a pointer to the active Statement message for this
1211
1225
   * Session, or NULL if no active message.
1212
1226
   */
1213
 
  drizzled::message::Statement *getStatementMessage() const
 
1227
  message::Statement *getStatementMessage() const
1214
1228
  {
1215
1229
    return statement_message;
1216
1230
  }
1221
1235
   *
1222
1236
   * @param[in] Pointer to the message
1223
1237
   */
1224
 
  void setTransactionMessage(drizzled::message::Transaction *in_message)
 
1238
  void setTransactionMessage(message::Transaction *in_message)
1225
1239
  {
1226
1240
    transaction_message= in_message;
1227
1241
  }
1232
1246
   *
1233
1247
   * @param[in] Pointer to the message
1234
1248
   */
1235
 
  void setStatementMessage(drizzled::message::Statement *in_message)
 
1249
  void setStatementMessage(message::Statement *in_message)
1236
1250
  {
1237
1251
    statement_message= in_message;
1238
1252
  }
1239
1253
private:
1240
1254
  /** Pointers to memory managed by the ReplicationServices component */
1241
 
  drizzled::message::Transaction *transaction_message;
1242
 
  drizzled::message::Statement *statement_message;
 
1255
  message::Transaction *transaction_message;
 
1256
  message::Statement *statement_message;
1243
1257
  /** Microsecond timestamp of when Session connected */
1244
1258
  uint64_t connect_microseconds;
1245
1259
  const char *proc_info;
1261
1275
    - for prepared queries, only to allocate runtime data. The parsed
1262
1276
    tree itself is reused between executions and thus is stored elsewhere.
1263
1277
  */
1264
 
  drizzled::memory::Root main_mem_root;
 
1278
  memory::Root main_mem_root;
1265
1279
 
1266
1280
  /**
1267
1281
   * Marks all tables in the list which were used by current substatement
1421
1435
public:
1422
1436
 
1423
1437
  int drop_temporary_table(TableList *table_list);
1424
 
  bool rm_temporary_table(drizzled::plugin::StorageEngine *base, const char *path);
1425
 
  bool rm_temporary_table(drizzled::plugin::StorageEngine *base, drizzled::TableIdentifier &identifier);
1426
 
  Table *open_temporary_table(drizzled::TableIdentifier &identifier,
 
1438
  bool rm_temporary_table(plugin::StorageEngine *base, const char *path);
 
1439
  bool rm_temporary_table(plugin::StorageEngine *base, TableIdentifier &identifier);
 
1440
  Table *open_temporary_table(TableIdentifier &identifier,
1427
1441
                              bool link_in_list= true);
1428
1442
 
1429
1443
  /* Reopen operations */
1444
1458
    @return
1445
1459
    pointer to plugin::StorageEngine
1446
1460
  */
1447
 
  drizzled::plugin::StorageEngine *getDefaultStorageEngine()
 
1461
  plugin::StorageEngine *getDefaultStorageEngine()
1448
1462
  {
1449
1463
    if (variables.storage_engine)
1450
1464
      return variables.storage_engine;
1459
1473
 
1460
1474
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
1461
1475
 
 
1476
} /* namespace drizzled */
 
1477
 
 
1478
/** @TODO why is this in the middle of the file */
1462
1479
#include <drizzled/select_to_file.h>
1463
1480
#include <drizzled/select_export.h>
1464
1481
#include <drizzled/select_dump.h>
1471
1488
#include <drizzled/select_max_min_finder_subselect.h>
1472
1489
#include <drizzled/select_exists_subselect.h>
1473
1490
 
 
1491
namespace drizzled
 
1492
{
 
1493
 
1474
1494
/**
1475
1495
 * A structure used to describe sort information
1476
1496
 * for a field or item used in ORDER BY.
1495
1515
  SORT_FIELD *sortorder;
1496
1516
} SORT_BUFFER;
1497
1517
 
 
1518
} /* namespace drizzled */
 
1519
 
 
1520
/** @TODO why is this in the middle of the file */
 
1521
 
1498
1522
#include <drizzled/table_ident.h>
1499
1523
#include <drizzled/user_var_entry.h>
1500
1524
#include <drizzled/unique.h>
1501
1525
#include <drizzled/my_var.h>
1502
1526
#include <drizzled/select_dumpvar.h>
1503
1527
 
 
1528
namespace drizzled
 
1529
{
 
1530
 
1504
1531
/* Bits in sql_command_flags */
1505
1532
 
1506
1533
enum sql_command_flag_bits 
1525
1552
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
1526
1553
                        STATUS_VAR *dec_var);
1527
1554
 
 
1555
} /* namespace drizzled */
 
1556
 
1528
1557
#endif /* DRIZZLED_SESSION_H */