~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Andrew Hutchings
  • Date: 2011-02-02 12:51:57 UTC
  • mto: (2157.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2158.
  • Revision ID: andrew@linuxjedi.co.uk-20110202125157-r6thh7ox4g9l90ec
Make transaction_message_threshold a read-only global variable instead of a per-session variable
Make replication_dictionary column lengths use transation_message_threshold

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
 
20
 
 
21
 
20
22
#ifndef DRIZZLED_SESSION_H
21
23
#define DRIZZLED_SESSION_H
22
24
 
 
25
#include "drizzled/plugin.h"
 
26
#include "drizzled/sql_locale.h"
 
27
#include "drizzled/resource_context.h"
 
28
#include "drizzled/cursor.h"
 
29
#include "drizzled/current_session.h"
 
30
#include "drizzled/sql_error.h"
 
31
#include "drizzled/file_exchange.h"
 
32
#include "drizzled/select_result_interceptor.h"
 
33
#include "drizzled/statistics_variables.h"
 
34
#include "drizzled/xid.h"
 
35
#include "drizzled/query_id.h"
 
36
#include "drizzled/named_savepoint.h"
 
37
#include "drizzled/transaction_context.h"
 
38
#include "drizzled/util/storable.h"
 
39
#include "drizzled/my_hash.h"
 
40
#include "drizzled/pthread_globals.h"
 
41
#include <netdb.h>
 
42
#include <sys/time.h>
 
43
#include <sys/resource.h>
 
44
 
23
45
#include <algorithm>
24
46
#include <bitset>
25
 
#include <boost/make_shared.hpp>
26
 
#include <boost/thread/condition_variable.hpp>
 
47
#include <deque>
 
48
#include <map>
 
49
#include <string>
 
50
 
 
51
#include "drizzled/identifier.h"
 
52
#include "drizzled/open_tables_state.h"
 
53
#include "drizzled/internal_error_handler.h"
 
54
#include "drizzled/diagnostics_area.h"
 
55
#include "drizzled/plugin/authorization.h"
 
56
 
 
57
#include "drizzled/catalog/instance.h"
 
58
#include "drizzled/catalog/local.h"
 
59
 
 
60
#include <boost/unordered_map.hpp>
 
61
 
 
62
#include <boost/thread/thread.hpp>
27
63
#include <boost/thread/mutex.hpp>
28
64
#include <boost/thread/shared_mutex.hpp>
29
 
#include <boost/thread/thread.hpp>
30
 
#include <map>
31
 
#include <netdb.h>
32
 
#include <string>
33
 
#include <sys/resource.h>
34
 
#include <sys/time.h>
 
65
#include <boost/thread/condition_variable.hpp>
 
66
#include <boost/make_shared.hpp>
35
67
 
36
 
#include <drizzled/catalog/instance.h>
37
 
#include <drizzled/catalog/local.h>
38
 
#include <drizzled/copy_info.h>
39
 
#include <drizzled/cursor.h>
40
 
#include <drizzled/diagnostics_area.h>
41
 
#include <drizzled/file_exchange.h>
42
 
#include <drizzled/ha_data.h>
43
 
#include <drizzled/identifier.h>
44
 
#include <drizzled/lex_column.h>
45
 
#include <drizzled/my_hash.h>
46
 
#include <drizzled/named_savepoint.h>
47
 
#include <drizzled/open_tables_state.h>
48
 
#include <drizzled/plugin.h>
49
 
#include <drizzled/plugin/authorization.h>
50
 
#include <drizzled/pthread_globals.h>
51
 
#include <drizzled/query_id.h>
52
 
#include <drizzled/resource_context.h>
53
 
#include <drizzled/session/property_map.h>
54
 
#include <drizzled/session/state.h>
55
 
#include <drizzled/session/table_messages.h>
56
 
#include <drizzled/session/transactions.h>
57
 
#include <drizzled/sql_error.h>
58
 
#include <drizzled/sql_lex.h>
59
 
#include <drizzled/sql_locale.h>
60
 
#include <drizzled/statistics_variables.h>
61
 
#include <drizzled/system_variables.h>
62
 
#include <drizzled/system_variables.h>
63
 
#include <drizzled/table_ident.h>
64
 
#include <drizzled/transaction_context.h>
65
 
#include <drizzled/util/storable.h>
66
 
#include <drizzled/var.h>
67
 
#include <drizzled/visibility.h>
 
68
#include "drizzled/visibility.h"
68
69
 
69
70
#define MIN_HANDSHAKE_SIZE      6
70
71
 
85
86
class Resultset;
86
87
}
87
88
 
88
 
namespace internal { struct st_my_thread_var; }
89
 
namespace table { class Placeholder; }
90
 
 
 
89
namespace internal
 
90
{
 
91
struct st_my_thread_var;
 
92
}
 
93
 
 
94
namespace table
 
95
{
 
96
class Placeholder;
 
97
}
 
98
 
 
99
class Lex_input_stream;
 
100
class user_var_entry;
91
101
class CopyField;
92
 
class DrizzleXid;
93
 
class Internal_error_handler;
94
 
class Lex_input_stream;
 
102
class Table_ident;
 
103
 
95
104
class TableShareInstance;
96
 
class Table_ident;
97
 
class Time_zone;
98
 
class select_result;
99
 
class user_var_entry;
100
105
 
101
106
extern char internal_table_name[2];
102
107
extern char empty_c_string[1];
106
111
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
107
112
extern uint32_t tc_heuristic_recover;
108
113
 
 
114
/**
 
115
  @brief
 
116
  Local storage for proto that are tmp table. This should be enlarged
 
117
  to hande the entire table-share for a local table. Once Hash is done,
 
118
  we should consider exchanging the map for it.
 
119
*/
 
120
typedef std::map <std::string, message::Table> ProtoCache;
 
121
 
 
122
/**
 
123
  The COPY_INFO structure is used by INSERT/REPLACE code.
 
124
  The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
 
125
  UPDATE code:
 
126
    If a row is inserted then the copied variable is incremented.
 
127
    If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
 
128
      new data differs from the old one then the copied and the updated
 
129
      variables are incremented.
 
130
    The touched variable is incremented if a row was touched by the update part
 
131
      of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
 
132
      was actually changed or not.
 
133
*/
 
134
class CopyInfo 
 
135
{
 
136
public:
 
137
  ha_rows records; /**< Number of processed records */
 
138
  ha_rows deleted; /**< Number of deleted records */
 
139
  ha_rows updated; /**< Number of updated records */
 
140
  ha_rows copied;  /**< Number of copied records */
 
141
  ha_rows error_count;
 
142
  ha_rows touched; /* Number of touched records */
 
143
  enum enum_duplicates handle_duplicates;
 
144
  int escape_char, last_errno;
 
145
  bool ignore;
 
146
  /* for INSERT ... UPDATE */
 
147
  List<Item> *update_fields;
 
148
  List<Item> *update_values;
 
149
  /* for VIEW ... WITH CHECK OPTION */
 
150
 
 
151
  CopyInfo() :
 
152
    records(0),
 
153
    deleted(0),
 
154
    updated(0),
 
155
    copied(0),
 
156
    error_count(0),
 
157
    touched(0),
 
158
    escape_char(0),
 
159
    last_errno(0),
 
160
    ignore(0),
 
161
    update_fields(0),
 
162
    update_values(0)
 
163
  { }
 
164
 
 
165
};
 
166
 
 
167
} /* namespace drizzled */
 
168
 
 
169
/** @TODO why is this in the middle of the file */
 
170
#include <drizzled/lex_column.h>
 
171
 
 
172
namespace drizzled
 
173
{
 
174
 
 
175
class select_result;
 
176
class Time_zone;
 
177
 
109
178
#define Session_SENTRY_MAGIC 0xfeedd1ff
110
179
#define Session_SENTRY_GONE  0xdeadbeef
111
180
 
 
181
struct drizzle_system_variables
 
182
{
 
183
  drizzle_system_variables()
 
184
  {}
 
185
  /*
 
186
    How dynamically allocated system variables are handled:
 
187
 
 
188
    The global_system_variables and max_system_variables are "authoritative"
 
189
    They both should have the same 'version' and 'size'.
 
190
    When attempting to access a dynamic variable, if the session version
 
191
    is out of date, then the session version is updated and realloced if
 
192
    neccessary and bytes copied from global to make up for missing data.
 
193
  */
 
194
  ulong dynamic_variables_version;
 
195
  char * dynamic_variables_ptr;
 
196
  uint32_t dynamic_variables_head;  /* largest valid variable offset */
 
197
  uint32_t dynamic_variables_size;  /* how many bytes are in use */
 
198
 
 
199
  uint64_t myisam_max_extra_sort_file_size;
 
200
  uint64_t max_heap_table_size;
 
201
  uint64_t tmp_table_size;
 
202
  ha_rows select_limit;
 
203
  ha_rows max_join_size;
 
204
  uint64_t auto_increment_increment;
 
205
  uint64_t auto_increment_offset;
 
206
  uint64_t bulk_insert_buff_size;
 
207
  uint64_t join_buff_size;
 
208
  uint32_t max_allowed_packet;
 
209
  uint64_t max_error_count;
 
210
  uint64_t max_length_for_sort_data;
 
211
  size_t max_sort_length;
 
212
  uint64_t min_examined_row_limit;
 
213
  bool optimizer_prune_level;
 
214
  bool log_warnings;
 
215
 
 
216
  uint32_t optimizer_search_depth;
 
217
  uint32_t div_precincrement;
 
218
  uint64_t preload_buff_size;
 
219
  uint32_t read_buff_size;
 
220
  uint32_t read_rnd_buff_size;
 
221
  bool replicate_query;
 
222
  size_t sortbuff_size;
 
223
  uint32_t thread_handling;
 
224
  uint32_t tx_isolation;
 
225
  uint32_t completion_type;
 
226
  /* Determines which non-standard SQL behaviour should be enabled */
 
227
  uint32_t sql_mode;
 
228
  uint64_t max_seeks_for_key;
 
229
  size_t range_alloc_block_size;
 
230
  uint32_t query_alloc_block_size;
 
231
  uint32_t query_prealloc_size;
 
232
  uint64_t group_concat_max_len;
 
233
  uint64_t pseudo_thread_id;
 
234
 
 
235
  plugin::StorageEngine *storage_engine;
 
236
 
 
237
  /* Only charset part of these variables is sensible */
 
238
  const CHARSET_INFO  *character_set_filesystem;
 
239
 
 
240
  /* Both charset and collation parts of these variables are important */
 
241
  const CHARSET_INFO    *collation_server;
 
242
 
 
243
  inline const CHARSET_INFO  *getCollation(void) 
 
244
  {
 
245
    return collation_server;
 
246
  }
 
247
 
 
248
  /* Locale Support */
 
249
  MY_LOCALE *lc_time_names;
 
250
 
 
251
  Time_zone *time_zone;
 
252
};
 
253
 
112
254
extern DRIZZLED_API struct drizzle_system_variables global_system_variables;
113
255
 
 
256
} /* namespace drizzled */
 
257
 
 
258
#include "drizzled/sql_lex.h"
 
259
 
 
260
namespace drizzled
 
261
{
 
262
 
 
263
DRIZZLED_API void mark_transaction_to_rollback(Session *session, bool all);
 
264
 
 
265
/**
 
266
  Storage engine specific thread local data.
 
267
*/
 
268
struct Ha_data
 
269
{
 
270
  /**
 
271
    Storage engine specific thread local data.
 
272
    Lifetime: one user connection.
 
273
  */
 
274
  void *ha_ptr;
 
275
  /**
 
276
   * Resource contexts for both the "statement" and "normal"
 
277
   * transactions.
 
278
   *
 
279
   * Resource context at index 0:
 
280
   *
 
281
   * Life time: one statement within a transaction. If @@autocommit is
 
282
   * on, also represents the entire transaction.
 
283
   *
 
284
   * Resource context at index 1:
 
285
   *
 
286
   * Life time: one transaction within a connection. 
 
287
   *
 
288
   * @note
 
289
   *
 
290
   * If the storage engine does not participate in a transaction, 
 
291
   * there will not be a resource context.
 
292
   */
 
293
  drizzled::ResourceContext resource_context[2];
 
294
 
 
295
  Ha_data() :ha_ptr(NULL) {}
 
296
};
 
297
 
114
298
/**
115
299
 * Represents a client connection to the database server.
116
300
 *
131
315
 * session object.
132
316
 */
133
317
 
134
 
class DRIZZLED_API Session : public Open_tables_state
 
318
class DRIZZLED_API Session :
 
319
  public Open_tables_state
135
320
{
136
321
public:
137
322
  // Plugin storage in Session.
 
323
  typedef boost::unordered_map<std::string, util::Storable *, util::insensitive_hash, util::insensitive_equal_to> PropertyMap;
 
324
  typedef Session* Ptr;
138
325
  typedef boost::shared_ptr<Session> shared_ptr;
139
326
  typedef Session& reference;
140
327
  typedef const Session& const_reference;
159
346
                        and update_row.
160
347
  */
161
348
  enum enum_mark_columns mark_used_columns;
 
349
  inline void* alloc(size_t size)
 
350
  {
 
351
    return mem_root->alloc_root(size);
 
352
  }
162
353
  inline void* calloc(size_t size)
163
354
  {
164
355
    void *ptr;
166
357
      memset(ptr, 0, size);
167
358
    return ptr;
168
359
  }
 
360
  inline char *strdup(const char *str)
 
361
  {
 
362
    return mem_root->strdup_root(str);
 
363
  }
169
364
  inline char *strmake(const char *str, size_t size)
170
365
  {
171
366
    return mem_root->strmake_root(str,size);
172
367
  }
173
 
 
 
368
  inline void *memdup(const void *str, size_t size)
 
369
  {
 
370
    return mem_root->memdup_root(str, size);
 
371
  }
174
372
  inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
175
373
  {
176
374
    void *ptr;
180
378
  }
181
379
  /** Frees all items attached to this Statement */
182
380
  void free_items();
183
 
 
184
381
  /**
185
382
   * List of items created in the parser for this query. Every item puts
186
383
   * itself to the list on creation (see Item::Item() for details))
213
410
   * @todo should be const
214
411
   */
215
412
  uint32_t id;
216
 
private:
217
413
  LEX *lex; /**< parse tree descriptor */
218
414
 
219
 
public:
220
415
  LEX *getLex() 
221
416
  {
222
417
    return lex;
223
418
  }
224
 
 
225
 
  enum_sql_command getSqlCommand() const
226
 
  {
227
 
    return lex->sql_command;
228
 
  }
229
 
 
230
419
  /** query associated with this statement */
231
420
  typedef boost::shared_ptr<const std::string> QueryString;
232
 
 
233
421
private:
234
422
  boost::shared_ptr<std::string> query;
235
423
 
268
456
    return to_return;
269
457
  }
270
458
 
 
459
  class State {
 
460
    std::vector <char> _query;
 
461
 
 
462
  public:
 
463
    typedef boost::shared_ptr<State> const_shared_ptr;
 
464
 
 
465
    State(const char *in_packet, size_t in_packet_length)
 
466
    {
 
467
      if (in_packet_length)
 
468
      {
 
469
        size_t minimum= std::min(in_packet_length, static_cast<size_t>(PROCESS_LIST_WIDTH));
 
470
        _query.resize(minimum + 1);
 
471
        memcpy(&_query[0], in_packet, minimum);
 
472
      }
 
473
      else
 
474
      {
 
475
        _query.resize(0);
 
476
      }
 
477
    }
 
478
 
 
479
    const char *query() const
 
480
    {
 
481
      if (_query.size())
 
482
        return &_query[0];
 
483
 
 
484
      return "";
 
485
    }
 
486
 
 
487
    const char *query(size_t &size) const
 
488
    {
 
489
      if (_query.size())
 
490
      {
 
491
        size= _query.size() -1;
 
492
        return &_query[0];
 
493
      }
 
494
 
 
495
      size= 0;
 
496
      return "";
 
497
    }
 
498
  protected:
 
499
    friend class Session;
 
500
    typedef boost::shared_ptr<State> shared_ptr;
 
501
  };
271
502
private:
272
 
  session::State::shared_ptr  _state; 
273
 
 
 
503
  State::shared_ptr  _state; 
274
504
public:
275
505
 
276
 
  session::State::const_shared_ptr state()
 
506
  State::const_shared_ptr state()
277
507
  {
278
508
    return _state;
279
509
  }
292
522
  */
293
523
private:
294
524
  util::string::shared_ptr _schema;
295
 
 
296
525
public:
297
526
 
298
527
  util::string::const_shared_ptr schema() const
335
564
  void *scheduler_arg; /**< Pointer to the optional scheduler argument */
336
565
 
337
566
  typedef boost::unordered_map< std::string, user_var_entry *, util::insensitive_hash, util::insensitive_equal_to> UserVars;
338
 
 
339
567
private:
340
568
  typedef std::pair< UserVars::iterator, UserVars::iterator > UserVarsRange;
341
569
  UserVars user_vars; /**< Hash of user variables defined during the session's lifetime */
342
570
 
343
571
public:
 
572
 
344
573
  const UserVars &getUserVariables() const
345
574
  {
346
575
    return user_vars;
347
576
  }
348
577
 
349
578
  drizzle_system_variables variables; /**< Mutable local variables local to the session */
350
 
 
351
 
  enum_tx_isolation getTxIsolation()
352
 
  {
353
 
    return (enum_tx_isolation)variables.tx_isolation;
354
 
  }
355
 
 
356
579
  struct system_status_var status_var; /**< Session-local status counters */
357
580
  THR_LOCK_INFO lock_info; /**< Locking information for this session */
358
581
  THR_LOCK_OWNER main_lock_id; /**< To use for conventional queries */
373
596
  {
374
597
    assert(this->dbug_sentry == Session_SENTRY_MAGIC);
375
598
  }
376
 
 
377
599
public:
378
600
  identifier::User::const_shared_ptr user() const
379
601
  {
435
657
  boost::this_thread::disable_interruption *interrupt;
436
658
 
437
659
  internal::st_my_thread_var *mysys_var;
 
660
public:
438
661
 
439
 
public:
440
662
  boost_thread_shared_ptr &getThread()
441
663
  {
442
664
    return _thread;
517
739
  ResourceContext *getResourceContext(const plugin::MonitoredInTransaction *monitored,
518
740
                                      size_t index= 0);
519
741
 
520
 
  session::Transactions transaction;
 
742
  /**
 
743
   * Structure used to manage "statement transactions" and
 
744
   * "normal transactions". In autocommit mode, the normal transaction is
 
745
   * equivalent to the statement transaction.
 
746
   *
 
747
   * Storage engines will be registered here when they participate in
 
748
   * a transaction. No engine is registered more than once.
 
749
   */
 
750
  struct st_transactions {
 
751
    std::deque<NamedSavepoint> savepoints;
 
752
 
 
753
    /**
 
754
     * The normal transaction (since BEGIN WORK).
 
755
     *
 
756
     * Contains a list of all engines that have participated in any of the
 
757
     * statement transactions started within the context of the normal
 
758
     * transaction.
 
759
     *
 
760
     * @note In autocommit mode, this is empty.
 
761
     */
 
762
    TransactionContext all;
 
763
 
 
764
    /**
 
765
     * The statment transaction.
 
766
     *
 
767
     * Contains a list of all engines participating in the given statement.
 
768
     *
 
769
     * @note In autocommit mode, this will be used to commit/rollback the
 
770
     * normal transaction.
 
771
     */
 
772
    TransactionContext stmt;
 
773
 
 
774
    XID_STATE xid_state;
 
775
 
 
776
    void cleanup()
 
777
    {
 
778
      savepoints.clear();
 
779
    }
 
780
    st_transactions() :
 
781
      savepoints(),
 
782
      all(),
 
783
      stmt(),
 
784
      xid_state()
 
785
    { }
 
786
  } transaction;
521
787
 
522
788
  Field *dup_field;
523
789
  sigset_t signals;
525
791
  // As of right now we do not allow a concurrent execute to launch itself
526
792
private:
527
793
  bool concurrent_execute_allowed;
528
 
 
529
794
public:
530
795
 
531
796
  void setConcurrentExecute(bool arg)
594
859
  uint64_t limit_found_rows;
595
860
  uint64_t options; /**< Bitmap of options */
596
861
  int64_t row_count_func; /**< For the ROW_COUNT() function */
597
 
 
598
 
  int64_t rowCount() const
599
 
  {
600
 
    return row_count_func;
601
 
  }
602
 
 
603
862
  ha_rows cuted_fields; /**< Count of "cut" or truncated fields. @todo Kill this friggin thing. */
604
863
 
605
864
  /** 
772
1031
 
773
1032
private:
774
1033
  bool abort_on_warning;
775
 
  bool tablespace_op; /**< This is true in DISCARD/IMPORT TABLESPACE */
776
1034
 
777
1035
public:
778
1036
  bool got_warning; /**< Set on call to push_warning() */
779
1037
  bool no_warnings_for_error; /**< no warnings on call to my_error() */
780
1038
  /** set during loop of derived table processing */
781
1039
  bool derived_tables_processing;
782
 
 
783
 
  bool doing_tablespace_operation(void)
784
 
  {
785
 
    return tablespace_op;
786
 
  }
787
 
 
788
 
  void setDoingTablespaceOperation(bool doing)
789
 
  {
790
 
    tablespace_op= doing;
791
 
  }
792
 
 
 
1040
  bool tablespace_op; /**< This is true in DISCARD/IMPORT TABLESPACE */
793
1041
 
794
1042
  /** Used by the sys_var class to store temporary values */
795
1043
  union
1014
1262
  bool endTransaction(enum enum_mysql_completiontype completion);
1015
1263
  bool endActiveTransaction();
1016
1264
  bool startTransaction(start_transaction_option_t opt= START_TRANS_NO_OPTIONS);
1017
 
  void markTransactionForRollback(bool all);
1018
1265
 
1019
1266
  /**
1020
1267
   * Authenticates users, with error reporting.
1579
1826
  table::Placeholder *table_cache_insert_placeholder(const identifier::Table &identifier);
1580
1827
  bool lock_table_name_if_not_cached(const identifier::Table &identifier, Table **table);
1581
1828
 
 
1829
  typedef boost::unordered_map<std::string, message::Table, util::insensitive_hash, util::insensitive_equal_to> TableMessageCache;
 
1830
 
 
1831
  class TableMessages
 
1832
  {
 
1833
    TableMessageCache table_message_cache;
 
1834
 
 
1835
  public:
 
1836
    bool storeTableMessage(const identifier::Table &identifier, message::Table &table_message);
 
1837
    bool removeTableMessage(const identifier::Table &identifier);
 
1838
    bool getTableMessage(const identifier::Table &identifier, message::Table &table_message);
 
1839
    bool doesTableMessageExist(const identifier::Table &identifier);
 
1840
    bool renameTableMessage(const identifier::Table &from, const identifier::Table &to);
 
1841
  };
 
1842
 
1582
1843
private:
1583
 
  session::TableMessages _table_message_cache;
 
1844
  TableMessages _table_message_cache;
1584
1845
 
1585
1846
public:
1586
 
  session::TableMessages &getMessageCache()
 
1847
  TableMessages &getMessageCache()
1587
1848
  {
1588
1849
    return _table_message_cache;
1589
1850
  }
1598
1859
 
1599
1860
  drizzled::util::Storable *getProperty(const std::string &arg)
1600
1861
  {
1601
 
    return life_properties.getProperty(arg);
 
1862
    return life_properties[arg];
1602
1863
  }
1603
1864
 
1604
1865
  template<class T>
1605
1866
  bool setProperty(const std::string &arg, T *value)
1606
1867
  {
1607
 
    life_properties.setProperty(arg, value);
 
1868
    life_properties[arg]= value;
1608
1869
 
1609
1870
    return true;
1610
1871
  }
1624
1885
    return global_system_variables.storage_engine;
1625
1886
  }
1626
1887
 
1627
 
  void get_xid(DrizzleXid *xid); // Innodb only
 
1888
  void get_xid(DRIZZLE_XID *xid); // Innodb only
1628
1889
 
1629
1890
  table::Singular *getInstanceTable();
1630
1891
  table::Singular *getInstanceTable(List<CreateField> &field_list);
1639
1900
 
1640
1901
    return true;
1641
1902
  }
1642
 
 
1643
1903
public:
1644
1904
 
1645
1905
  void setUsage(bool arg)
1667
1927
 
1668
1928
  // This lives throughout the life of Session
1669
1929
  bool use_usage;
1670
 
  session::PropertyMap life_properties;
 
1930
  PropertyMap life_properties;
1671
1931
  std::vector<table::Singular *> temporary_shares;
1672
1932
  struct rusage usage;
1673
1933
};
1674
1934
 
 
1935
class Join;
 
1936
 
1675
1937
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
1676
1938
 
 
1939
} /* namespace drizzled */
 
1940
 
 
1941
/** @TODO why is this in the middle of the file */
 
1942
#include <drizzled/select_to_file.h>
 
1943
#include <drizzled/select_export.h>
 
1944
#include <drizzled/select_dump.h>
 
1945
#include <drizzled/select_insert.h>
 
1946
#include <drizzled/select_create.h>
 
1947
#include <drizzled/tmp_table_param.h>
 
1948
#include <drizzled/select_union.h>
 
1949
#include <drizzled/select_subselect.h>
 
1950
#include <drizzled/select_singlerow_subselect.h>
 
1951
#include <drizzled/select_max_min_finder_subselect.h>
 
1952
#include <drizzled/select_exists_subselect.h>
 
1953
 
 
1954
namespace drizzled
 
1955
{
 
1956
 
 
1957
/**
 
1958
 * A structure used to describe sort information
 
1959
 * for a field or item used in ORDER BY.
 
1960
 */
 
1961
class SortField 
 
1962
{
 
1963
public:
 
1964
  Field *field; /**< Field to sort */
 
1965
  Item  *item; /**< Item if not sorting fields */
 
1966
  size_t length; /**< Length of sort field */
 
1967
  uint32_t suffix_length; /**< Length suffix (0-4) */
 
1968
  Item_result result_type; /**< Type of item */
 
1969
  bool reverse; /**< if descending sort */
 
1970
  bool need_strxnfrm;   /**< If we have to use strxnfrm() */
 
1971
 
 
1972
  SortField() :
 
1973
    field(0),
 
1974
    item(0),
 
1975
    length(0),
 
1976
    suffix_length(0),
 
1977
    result_type(STRING_RESULT),
 
1978
    reverse(0),
 
1979
    need_strxnfrm(0)
 
1980
  { }
 
1981
 
 
1982
};
 
1983
 
 
1984
} /* namespace drizzled */
 
1985
 
 
1986
/** @TODO why is this in the middle of the file */
 
1987
 
 
1988
#include <drizzled/table_ident.h>
 
1989
#include <drizzled/user_var_entry.h>
 
1990
#include <drizzled/unique.h>
 
1991
#include <drizzled/var.h>
 
1992
#include <drizzled/select_dumpvar.h>
 
1993
 
 
1994
namespace drizzled
 
1995
{
 
1996
 
1677
1997
/* Bits in sql_command_flags */
1678
1998
 
1679
1999
enum sql_command_flag_bits 
1695
2015
namespace display  {
1696
2016
const std::string &type(drizzled::Session::global_read_lock_t type);
1697
2017
size_t max_string_length(drizzled::Session::global_read_lock_t type);
1698
 
 
1699
2018
} /* namespace display */
1700
2019
 
1701
2020
} /* namespace drizzled */