~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Stewart Smith
  • Date: 2011-02-10 01:03:48 UTC
  • mto: (2154.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2155.
  • Revision ID: stewart@flamingspork.com-20110210010348-5l0zh0akjahvx3vi
fix Session::tx_isolation to be getTxIsolation to follow coding style, but look weird

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
  size_t transaction_message_threshold;
 
226
  uint32_t completion_type;
 
227
  /* Determines which non-standard SQL behaviour should be enabled */
 
228
  uint32_t sql_mode;
 
229
  uint64_t max_seeks_for_key;
 
230
  size_t range_alloc_block_size;
 
231
  uint32_t query_alloc_block_size;
 
232
  uint32_t query_prealloc_size;
 
233
  uint64_t group_concat_max_len;
 
234
  uint64_t pseudo_thread_id;
 
235
 
 
236
  plugin::StorageEngine *storage_engine;
 
237
 
 
238
  /* Only charset part of these variables is sensible */
 
239
  const CHARSET_INFO  *character_set_filesystem;
 
240
 
 
241
  /* Both charset and collation parts of these variables are important */
 
242
  const CHARSET_INFO    *collation_server;
 
243
 
 
244
  inline const CHARSET_INFO  *getCollation(void) 
 
245
  {
 
246
    return collation_server;
 
247
  }
 
248
 
 
249
  /* Locale Support */
 
250
  MY_LOCALE *lc_time_names;
 
251
 
 
252
  Time_zone *time_zone;
 
253
};
 
254
 
112
255
extern DRIZZLED_API struct drizzle_system_variables global_system_variables;
113
256
 
 
257
} /* namespace drizzled */
 
258
 
 
259
#include "drizzled/sql_lex.h"
 
260
 
 
261
namespace drizzled
 
262
{
 
263
 
 
264
DRIZZLED_API void mark_transaction_to_rollback(Session *session, bool all);
 
265
 
 
266
/**
 
267
  Storage engine specific thread local data.
 
268
*/
 
269
struct Ha_data
 
270
{
 
271
  /**
 
272
    Storage engine specific thread local data.
 
273
    Lifetime: one user connection.
 
274
  */
 
275
  void *ha_ptr;
 
276
  /**
 
277
   * Resource contexts for both the "statement" and "normal"
 
278
   * transactions.
 
279
   *
 
280
   * Resource context at index 0:
 
281
   *
 
282
   * Life time: one statement within a transaction. If @@autocommit is
 
283
   * on, also represents the entire transaction.
 
284
   *
 
285
   * Resource context at index 1:
 
286
   *
 
287
   * Life time: one transaction within a connection. 
 
288
   *
 
289
   * @note
 
290
   *
 
291
   * If the storage engine does not participate in a transaction, 
 
292
   * there will not be a resource context.
 
293
   */
 
294
  drizzled::ResourceContext resource_context[2];
 
295
 
 
296
  Ha_data() :ha_ptr(NULL) {}
 
297
};
 
298
 
114
299
/**
115
300
 * Represents a client connection to the database server.
116
301
 *
131
316
 * session object.
132
317
 */
133
318
 
134
 
class DRIZZLED_API Session : public Open_tables_state
 
319
class DRIZZLED_API Session :
 
320
  public Open_tables_state
135
321
{
136
322
public:
137
323
  // Plugin storage in Session.
 
324
  typedef boost::unordered_map<std::string, util::Storable *, util::insensitive_hash, util::insensitive_equal_to> PropertyMap;
 
325
  typedef Session* Ptr;
138
326
  typedef boost::shared_ptr<Session> shared_ptr;
139
327
  typedef Session& reference;
140
328
  typedef const Session& const_reference;
159
347
                        and update_row.
160
348
  */
161
349
  enum enum_mark_columns mark_used_columns;
 
350
  inline void* alloc(size_t size)
 
351
  {
 
352
    return mem_root->alloc_root(size);
 
353
  }
162
354
  inline void* calloc(size_t size)
163
355
  {
164
356
    void *ptr;
166
358
      memset(ptr, 0, size);
167
359
    return ptr;
168
360
  }
 
361
  inline char *strdup(const char *str)
 
362
  {
 
363
    return mem_root->strdup_root(str);
 
364
  }
169
365
  inline char *strmake(const char *str, size_t size)
170
366
  {
171
367
    return mem_root->strmake_root(str,size);
172
368
  }
173
 
 
 
369
  inline void *memdup(const void *str, size_t size)
 
370
  {
 
371
    return mem_root->memdup_root(str, size);
 
372
  }
174
373
  inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
175
374
  {
176
375
    void *ptr;
180
379
  }
181
380
  /** Frees all items attached to this Statement */
182
381
  void free_items();
183
 
 
184
382
  /**
185
383
   * List of items created in the parser for this query. Every item puts
186
384
   * itself to the list on creation (see Item::Item() for details))
213
411
   * @todo should be const
214
412
   */
215
413
  uint32_t id;
216
 
private:
217
414
  LEX *lex; /**< parse tree descriptor */
218
415
 
219
 
public:
220
416
  LEX *getLex() 
221
417
  {
222
418
    return lex;
229
425
 
230
426
  /** query associated with this statement */
231
427
  typedef boost::shared_ptr<const std::string> QueryString;
232
 
 
233
428
private:
234
429
  boost::shared_ptr<std::string> query;
235
430
 
268
463
    return to_return;
269
464
  }
270
465
 
 
466
  class State {
 
467
    std::vector <char> _query;
 
468
 
 
469
  public:
 
470
    typedef boost::shared_ptr<State> const_shared_ptr;
 
471
 
 
472
    State(const char *in_packet, size_t in_packet_length)
 
473
    {
 
474
      if (in_packet_length)
 
475
      {
 
476
        size_t minimum= std::min(in_packet_length, static_cast<size_t>(PROCESS_LIST_WIDTH));
 
477
        _query.resize(minimum + 1);
 
478
        memcpy(&_query[0], in_packet, minimum);
 
479
      }
 
480
      else
 
481
      {
 
482
        _query.resize(0);
 
483
      }
 
484
    }
 
485
 
 
486
    const char *query() const
 
487
    {
 
488
      if (_query.size())
 
489
        return &_query[0];
 
490
 
 
491
      return "";
 
492
    }
 
493
 
 
494
    const char *query(size_t &size) const
 
495
    {
 
496
      if (_query.size())
 
497
      {
 
498
        size= _query.size() -1;
 
499
        return &_query[0];
 
500
      }
 
501
 
 
502
      size= 0;
 
503
      return "";
 
504
    }
 
505
  protected:
 
506
    friend class Session;
 
507
    typedef boost::shared_ptr<State> shared_ptr;
 
508
  };
271
509
private:
272
 
  session::State::shared_ptr  _state; 
273
 
 
 
510
  State::shared_ptr  _state; 
274
511
public:
275
512
 
276
 
  session::State::const_shared_ptr state()
 
513
  State::const_shared_ptr state()
277
514
  {
278
515
    return _state;
279
516
  }
292
529
  */
293
530
private:
294
531
  util::string::shared_ptr _schema;
295
 
 
296
532
public:
297
533
 
298
534
  util::string::const_shared_ptr schema() const
335
571
  void *scheduler_arg; /**< Pointer to the optional scheduler argument */
336
572
 
337
573
  typedef boost::unordered_map< std::string, user_var_entry *, util::insensitive_hash, util::insensitive_equal_to> UserVars;
338
 
 
339
574
private:
340
575
  typedef std::pair< UserVars::iterator, UserVars::iterator > UserVarsRange;
341
576
  UserVars user_vars; /**< Hash of user variables defined during the session's lifetime */
342
577
 
343
578
public:
 
579
 
344
580
  const UserVars &getUserVariables() const
345
581
  {
346
582
    return user_vars;
373
609
  {
374
610
    assert(this->dbug_sentry == Session_SENTRY_MAGIC);
375
611
  }
376
 
 
377
612
public:
378
613
  identifier::User::const_shared_ptr user() const
379
614
  {
435
670
  boost::this_thread::disable_interruption *interrupt;
436
671
 
437
672
  internal::st_my_thread_var *mysys_var;
 
673
public:
438
674
 
439
 
public:
440
675
  boost_thread_shared_ptr &getThread()
441
676
  {
442
677
    return _thread;
517
752
  ResourceContext *getResourceContext(const plugin::MonitoredInTransaction *monitored,
518
753
                                      size_t index= 0);
519
754
 
520
 
  session::Transactions transaction;
 
755
  /**
 
756
   * Structure used to manage "statement transactions" and
 
757
   * "normal transactions". In autocommit mode, the normal transaction is
 
758
   * equivalent to the statement transaction.
 
759
   *
 
760
   * Storage engines will be registered here when they participate in
 
761
   * a transaction. No engine is registered more than once.
 
762
   */
 
763
  struct st_transactions {
 
764
    std::deque<NamedSavepoint> savepoints;
 
765
 
 
766
    /**
 
767
     * The normal transaction (since BEGIN WORK).
 
768
     *
 
769
     * Contains a list of all engines that have participated in any of the
 
770
     * statement transactions started within the context of the normal
 
771
     * transaction.
 
772
     *
 
773
     * @note In autocommit mode, this is empty.
 
774
     */
 
775
    TransactionContext all;
 
776
 
 
777
    /**
 
778
     * The statment transaction.
 
779
     *
 
780
     * Contains a list of all engines participating in the given statement.
 
781
     *
 
782
     * @note In autocommit mode, this will be used to commit/rollback the
 
783
     * normal transaction.
 
784
     */
 
785
    TransactionContext stmt;
 
786
 
 
787
    XID_STATE xid_state;
 
788
 
 
789
    void cleanup()
 
790
    {
 
791
      savepoints.clear();
 
792
    }
 
793
    st_transactions() :
 
794
      savepoints(),
 
795
      all(),
 
796
      stmt(),
 
797
      xid_state()
 
798
    { }
 
799
  } transaction;
521
800
 
522
801
  Field *dup_field;
523
802
  sigset_t signals;
525
804
  // As of right now we do not allow a concurrent execute to launch itself
526
805
private:
527
806
  bool concurrent_execute_allowed;
528
 
 
529
807
public:
530
808
 
531
809
  void setConcurrentExecute(bool arg)
594
872
  uint64_t limit_found_rows;
595
873
  uint64_t options; /**< Bitmap of options */
596
874
  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
875
  ha_rows cuted_fields; /**< Count of "cut" or truncated fields. @todo Kill this friggin thing. */
604
876
 
605
877
  /** 
785
1057
    return tablespace_op;
786
1058
  }
787
1059
 
788
 
  void setDoingTablespaceOperation(bool doing)
 
1060
  void set_doing_tablespace_operation(bool doing)
789
1061
  {
790
1062
    tablespace_op= doing;
791
1063
  }
1014
1286
  bool endTransaction(enum enum_mysql_completiontype completion);
1015
1287
  bool endActiveTransaction();
1016
1288
  bool startTransaction(start_transaction_option_t opt= START_TRANS_NO_OPTIONS);
1017
 
  void markTransactionForRollback(bool all);
1018
1289
 
1019
1290
  /**
1020
1291
   * Authenticates users, with error reporting.
1579
1850
  table::Placeholder *table_cache_insert_placeholder(const identifier::Table &identifier);
1580
1851
  bool lock_table_name_if_not_cached(const identifier::Table &identifier, Table **table);
1581
1852
 
 
1853
  typedef boost::unordered_map<std::string, message::Table, util::insensitive_hash, util::insensitive_equal_to> TableMessageCache;
 
1854
 
 
1855
  class TableMessages
 
1856
  {
 
1857
    TableMessageCache table_message_cache;
 
1858
 
 
1859
  public:
 
1860
    bool storeTableMessage(const identifier::Table &identifier, message::Table &table_message);
 
1861
    bool removeTableMessage(const identifier::Table &identifier);
 
1862
    bool getTableMessage(const identifier::Table &identifier, message::Table &table_message);
 
1863
    bool doesTableMessageExist(const identifier::Table &identifier);
 
1864
    bool renameTableMessage(const identifier::Table &from, const identifier::Table &to);
 
1865
  };
 
1866
 
1582
1867
private:
1583
 
  session::TableMessages _table_message_cache;
 
1868
  TableMessages _table_message_cache;
1584
1869
 
1585
1870
public:
1586
 
  session::TableMessages &getMessageCache()
 
1871
  TableMessages &getMessageCache()
1587
1872
  {
1588
1873
    return _table_message_cache;
1589
1874
  }
1598
1883
 
1599
1884
  drizzled::util::Storable *getProperty(const std::string &arg)
1600
1885
  {
1601
 
    return life_properties.getProperty(arg);
 
1886
    return life_properties[arg];
1602
1887
  }
1603
1888
 
1604
1889
  template<class T>
1605
1890
  bool setProperty(const std::string &arg, T *value)
1606
1891
  {
1607
 
    life_properties.setProperty(arg, value);
 
1892
    life_properties[arg]= value;
1608
1893
 
1609
1894
    return true;
1610
1895
  }
1624
1909
    return global_system_variables.storage_engine;
1625
1910
  }
1626
1911
 
1627
 
  void get_xid(DrizzleXid *xid); // Innodb only
 
1912
  void get_xid(DRIZZLE_XID *xid); // Innodb only
1628
1913
 
1629
1914
  table::Singular *getInstanceTable();
1630
1915
  table::Singular *getInstanceTable(List<CreateField> &field_list);
1639
1924
 
1640
1925
    return true;
1641
1926
  }
1642
 
 
1643
1927
public:
1644
1928
 
1645
1929
  void setUsage(bool arg)
1667
1951
 
1668
1952
  // This lives throughout the life of Session
1669
1953
  bool use_usage;
1670
 
  session::PropertyMap life_properties;
 
1954
  PropertyMap life_properties;
1671
1955
  std::vector<table::Singular *> temporary_shares;
1672
1956
  struct rusage usage;
1673
1957
};
1674
1958
 
 
1959
class Join;
 
1960
 
1675
1961
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
1676
1962
 
 
1963
} /* namespace drizzled */
 
1964
 
 
1965
/** @TODO why is this in the middle of the file */
 
1966
#include <drizzled/select_to_file.h>
 
1967
#include <drizzled/select_export.h>
 
1968
#include <drizzled/select_dump.h>
 
1969
#include <drizzled/select_insert.h>
 
1970
#include <drizzled/select_create.h>
 
1971
#include <drizzled/tmp_table_param.h>
 
1972
#include <drizzled/select_union.h>
 
1973
#include <drizzled/select_subselect.h>
 
1974
#include <drizzled/select_singlerow_subselect.h>
 
1975
#include <drizzled/select_max_min_finder_subselect.h>
 
1976
#include <drizzled/select_exists_subselect.h>
 
1977
 
 
1978
namespace drizzled
 
1979
{
 
1980
 
 
1981
/**
 
1982
 * A structure used to describe sort information
 
1983
 * for a field or item used in ORDER BY.
 
1984
 */
 
1985
class SortField 
 
1986
{
 
1987
public:
 
1988
  Field *field; /**< Field to sort */
 
1989
  Item  *item; /**< Item if not sorting fields */
 
1990
  size_t length; /**< Length of sort field */
 
1991
  uint32_t suffix_length; /**< Length suffix (0-4) */
 
1992
  Item_result result_type; /**< Type of item */
 
1993
  bool reverse; /**< if descending sort */
 
1994
  bool need_strxnfrm;   /**< If we have to use strxnfrm() */
 
1995
 
 
1996
  SortField() :
 
1997
    field(0),
 
1998
    item(0),
 
1999
    length(0),
 
2000
    suffix_length(0),
 
2001
    result_type(STRING_RESULT),
 
2002
    reverse(0),
 
2003
    need_strxnfrm(0)
 
2004
  { }
 
2005
 
 
2006
};
 
2007
 
 
2008
} /* namespace drizzled */
 
2009
 
 
2010
/** @TODO why is this in the middle of the file */
 
2011
 
 
2012
#include <drizzled/table_ident.h>
 
2013
#include <drizzled/user_var_entry.h>
 
2014
#include <drizzled/unique.h>
 
2015
#include <drizzled/var.h>
 
2016
#include <drizzled/select_dumpvar.h>
 
2017
 
 
2018
namespace drizzled
 
2019
{
 
2020
 
1677
2021
/* Bits in sql_command_flags */
1678
2022
 
1679
2023
enum sql_command_flag_bits 
1695
2039
namespace display  {
1696
2040
const std::string &type(drizzled::Session::global_read_lock_t type);
1697
2041
size_t max_string_length(drizzled::Session::global_read_lock_t type);
1698
 
 
1699
2042
} /* namespace display */
1700
2043
 
1701
2044
} /* namespace drizzled */