17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
21
#ifndef DRIZZLED_SESSION_H
21
22
#define DRIZZLED_SESSION_H
25
#include <boost/make_shared.hpp>
26
#include <boost/thread/condition_variable.hpp>
27
#include <boost/thread/mutex.hpp>
28
#include <boost/thread/shared_mutex.hpp>
29
#include <boost/thread/thread.hpp>
24
/* Classes in mysql */
26
#include "drizzled/plugin.h"
27
#include <drizzled/sql_locale.h>
28
#include "drizzled/resource_context.h"
29
#include <drizzled/cursor.h>
30
#include <drizzled/current_session.h>
31
#include <drizzled/sql_error.h>
32
#include <drizzled/file_exchange.h>
33
#include <drizzled/select_result_interceptor.h>
34
#include <drizzled/statistics_variables.h>
35
#include <drizzled/xid.h>
36
#include "drizzled/query_id.h"
37
#include "drizzled/named_savepoint.h"
38
#include "drizzled/transaction_context.h"
40
#include "drizzled/my_hash.h"
33
#include <sys/resource.h>
36
#include <drizzled/catalog/instance.h>
37
#include <drizzled/catalog/local.h>
38
#include <drizzled/copy_info.h>
39
#include <drizzled/cursor.h>
48
#include <drizzled/security_context.h>
49
#include <drizzled/open_tables_state.h>
51
#include <drizzled/internal_error_handler.h>
40
52
#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
54
#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>
56
#include <boost/unordered_map.hpp>
57
#include <boost/thread/mutex.hpp>
69
59
#define MIN_HANDSHAKE_SIZE 6
106
93
#define TC_HEURISTIC_RECOVER_ROLLBACK 2
107
94
extern uint32_t tc_heuristic_recover;
98
Local storage for proto that are tmp table. This should be enlarged
99
to hande the entire table-share for a local table. Once Hash is done,
100
we should consider exchanging the map for it.
102
typedef std::map <std::string, message::Table> ProtoCache;
105
The COPY_INFO structure is used by INSERT/REPLACE code.
106
The schema of the row counting by the INSERT/INSERT ... ON DUPLICATE KEY
108
If a row is inserted then the copied variable is incremented.
109
If a row is updated by the INSERT ... ON DUPLICATE KEY UPDATE and the
110
new data differs from the old one then the copied and the updated
111
variables are incremented.
112
The touched variable is incremented if a row was touched by the update part
113
of the INSERT ... ON DUPLICATE KEY UPDATE no matter whether the row
114
was actually changed or not.
116
typedef struct st_copy_info
118
ha_rows records; /**< Number of processed records */
119
ha_rows deleted; /**< Number of deleted records */
120
ha_rows updated; /**< Number of updated records */
121
ha_rows copied; /**< Number of copied records */
123
ha_rows touched; /* Number of touched records */
124
enum enum_duplicates handle_duplicates;
125
int escape_char, last_errno;
127
/* for INSERT ... UPDATE */
128
List<Item> *update_fields;
129
List<Item> *update_values;
130
/* for VIEW ... WITH CHECK OPTION */
133
typedef struct drizzled_lock_st
136
uint32_t table_count;
138
THR_LOCK_DATA **locks;
141
} /* namespace drizzled */
143
/** @TODO why is this in the middle of the file */
144
#include <drizzled/lex_column.h>
109
152
#define Session_SENTRY_MAGIC 0xfeedd1ff
110
153
#define Session_SENTRY_GONE 0xdeadbeef
112
extern DRIZZLED_API struct drizzle_system_variables global_system_variables;
155
struct system_variables
157
system_variables() {};
159
How dynamically allocated system variables are handled:
161
The global_system_variables and max_system_variables are "authoritative"
162
They both should have the same 'version' and 'size'.
163
When attempting to access a dynamic variable, if the session version
164
is out of date, then the session version is updated and realloced if
165
neccessary and bytes copied from global to make up for missing data.
167
ulong dynamic_variables_version;
168
char * dynamic_variables_ptr;
169
uint32_t dynamic_variables_head; /* largest valid variable offset */
170
uint32_t dynamic_variables_size; /* how many bytes are in use */
172
uint64_t myisam_max_extra_sort_file_size;
173
uint64_t max_heap_table_size;
174
uint64_t tmp_table_size;
175
ha_rows select_limit;
176
ha_rows max_join_size;
177
uint64_t auto_increment_increment;
178
uint64_t auto_increment_offset;
179
uint64_t bulk_insert_buff_size;
180
uint64_t join_buff_size;
181
uint32_t max_allowed_packet;
182
uint64_t max_error_count;
183
uint64_t max_length_for_sort_data;
184
size_t max_sort_length;
185
uint64_t min_examined_row_limit;
186
bool optimizer_prune_level;
189
uint32_t optimizer_search_depth;
190
uint32_t div_precincrement;
191
uint64_t preload_buff_size;
192
uint32_t read_buff_size;
193
uint32_t read_rnd_buff_size;
194
size_t sortbuff_size;
195
uint32_t thread_handling;
196
uint32_t tx_isolation;
197
uint32_t completion_type;
198
/* Determines which non-standard SQL behaviour should be enabled */
200
uint64_t max_seeks_for_key;
201
size_t range_alloc_block_size;
202
uint32_t query_alloc_block_size;
203
uint32_t query_prealloc_size;
204
uint64_t group_concat_max_len;
205
uint64_t pseudo_thread_id;
207
plugin::StorageEngine *storage_engine;
209
/* Only charset part of these variables is sensible */
210
const CHARSET_INFO *character_set_filesystem;
212
/* Both charset and collation parts of these variables are important */
213
const CHARSET_INFO *collation_server;
215
inline const CHARSET_INFO *getCollation(void)
217
return collation_server;
221
MY_LOCALE *lc_time_names;
223
Time_zone *time_zone;
226
extern struct system_variables global_system_variables;
228
} /* namespace drizzled */
230
#include "drizzled/sql_lex.h"
235
void mark_transaction_to_rollback(Session *session, bool all);
238
Storage engine specific thread local data.
243
Storage engine specific thread local data.
244
Lifetime: one user connection.
248
* Resource contexts for both the "statement" and "normal"
251
* Resource context at index 0:
253
* Life time: one statement within a transaction. If @@autocommit is
254
* on, also represents the entire transaction.
256
* Resource context at index 1:
258
* Life time: one transaction within a connection.
262
* If the storage engine does not participate in a transaction,
263
* there will not be a resource context.
265
drizzled::ResourceContext resource_context[2];
267
Ha_data() :ha_ptr(NULL) {}
115
271
* Represents a client connection to the database server.
213
352
* @todo should be const
217
355
LEX *lex; /**< parse tree descriptor */
225
enum_sql_command getSqlCommand() const
227
return lex->sql_command;
230
356
/** query associated with this statement */
231
typedef boost::shared_ptr<const std::string> QueryString;
234
boost::shared_ptr<std::string> query;
236
// Never allow for a modification of this outside of the class. c_str()
237
// requires under some setup non const, you must copy the QueryString in
240
QueryString getQueryString() const
245
void resetQueryString()
252
We need to copy the lock on the string in order to make sure we have a stable string.
253
Once this is done we can use it to build a const char* which can be handed off for
254
a method to use (Innodb is currently the only engine using this).
256
const char *getQueryStringCopy(size_t &length)
258
QueryString tmp_string(getQueryString());
266
length= tmp_string->length();
267
char *to_return= strmake(tmp_string->c_str(), tmp_string->length());
272
session::State::shared_ptr _state;
276
session::State::const_shared_ptr state()
282
360
Name of the current (default) database.
314
379
static const char * const DEFAULT_WHERE;
316
381
memory::Root warn_root; /**< Allocation area for warnings and errors */
318
382
plugin::Client *client; /**< Pointer to client object */
322
void setClient(plugin::Client *client_arg);
324
plugin::Client *getClient()
329
plugin::Client *getClient() const
334
383
plugin::Scheduler *scheduler; /**< Pointer to scheduler object */
335
384
void *scheduler_arg; /**< Pointer to the optional scheduler argument */
337
386
typedef boost::unordered_map< std::string, user_var_entry *, util::insensitive_hash, util::insensitive_equal_to> UserVars;
340
387
typedef std::pair< UserVars::iterator, UserVars::iterator > UserVarsRange;
341
388
UserVars user_vars; /**< Hash of user variables defined during the session's lifetime */
344
const UserVars &getUserVariables() const
349
drizzle_system_variables variables; /**< Mutable local variables local to the session */
351
enum_tx_isolation getTxIsolation()
353
return (enum_tx_isolation)variables.tx_isolation;
391
struct system_variables variables; /**< Mutable local variables local to the session */
356
392
struct system_status_var status_var; /**< Session-local status counters */
357
393
THR_LOCK_INFO lock_info; /**< Locking information for this session */
358
394
THR_LOCK_OWNER main_lock_id; /**< To use for conventional queries */
359
395
THR_LOCK_OWNER *lock_id; /**< If not main_lock_id, points to the lock_id of a cursor. */
397
boost::mutex LOCK_delete; /**< Locked before session is deleted */
405
void unlockForDelete()
407
LOCK_delete.unlock();
411
* A peek into the query string for the session. This is a best effort
412
* delivery, there is no guarantee whether the content is meaningful.
414
char process_list_info[PROCESS_LIST_WIDTH+1];
362
417
* A pointer to the stack frame of the scheduler thread
466
481
uint32_t file_id; /**< File ID for LOAD DATA INFILE */
467
482
/* @note the following three members should likely move to Client */
468
483
uint32_t max_client_packet_length; /**< Maximum number of bytes a client can send in a single packet */
471
boost::posix_time::ptime _epoch;
472
boost::posix_time::ptime _connect_time;
473
boost::posix_time::ptime _start_timer;
474
boost::posix_time::ptime _end_timer;
476
boost::posix_time::ptime _user_time;
478
uint64_t utime_after_lock; // This used by Innodb.
482
_user_time= boost::posix_time::not_a_date_time;
485
const boost::posix_time::ptime &start_timer() const
490
void getTimeDifference(boost::posix_time::time_duration &result_arg, const boost::posix_time::ptime &arg) const
492
result_arg= arg - _start_timer;
486
uint64_t thr_create_utime; /**< track down slow pthread_create */
487
uint64_t start_utime;
488
uint64_t utime_after_lock;
495
490
thr_lock_type update_lock_default;
512
507
query_id_t query_id;
513
508
query_id_t warn_query_id;
516
510
void **getEngineData(const plugin::MonitoredInTransaction *monitored);
517
511
ResourceContext *getResourceContext(const plugin::MonitoredInTransaction *monitored,
518
512
size_t index= 0);
520
session::Transactions transaction;
514
struct st_transactions {
515
std::deque<NamedSavepoint> savepoints;
516
TransactionContext all; ///< Trans since BEGIN WORK
517
TransactionContext stmt; ///< Trans for current statement
522
532
Field *dup_field;
523
533
sigset_t signals;
525
// As of right now we do not allow a concurrent execute to launch itself
527
bool concurrent_execute_allowed;
531
void setConcurrentExecute(bool arg)
533
concurrent_execute_allowed= arg;
536
bool isConcurrentExecuteAllowed() const
538
return concurrent_execute_allowed;
541
535
/* Tells if LAST_INSERT_ID(#) was called for the current statement */
542
536
bool arg_of_last_insert_id_function;
545
538
ALL OVER THIS FILE, "insert_id" means "*automatically generated* value for
546
539
insertion into an auto_increment column".
648
635
create_sort_index(); may differ from examined_row_count.
650
637
uint32_t row_count;
652
uint32_t getRowCount() const
657
session_id_t thread_id;
638
pthread_t real_id; /**< For debugging */
658
640
uint32_t tmp_table;
659
enum global_read_lock_t
662
GOT_GLOBAL_READ_LOCK= 1,
663
MADE_GLOBAL_READ_LOCK_BLOCK_COMMIT= 2
666
global_read_lock_t _global_read_lock;
670
global_read_lock_t isGlobalReadLock() const
672
return _global_read_lock;
675
void setGlobalReadLock(global_read_lock_t arg)
677
_global_read_lock= arg;
680
DrizzleLock *lockTables(Table **tables, uint32_t count, uint32_t flags);
681
bool lockGlobalReadLock();
682
bool lock_table_names(TableList *table_list);
683
bool lock_table_names_exclusively(TableList *table_list);
684
bool makeGlobalReadLockBlockCommit();
685
bool abortLockForThread(Table *table);
686
bool wait_if_global_read_lock(bool abort_on_refresh, bool is_not_commit);
687
int lock_table_name(TableList *table_list);
688
void abortLock(Table *table);
689
void removeLock(Table *table);
690
void unlockReadTables(DrizzleLock *sql_lock);
691
void unlockSomeTables(Table **table, uint32_t count);
692
void unlockTables(DrizzleLock *sql_lock);
693
void startWaitingGlobalReadLock();
694
void unlockGlobalReadLock();
697
int unlock_external(Table **table, uint32_t count);
698
int lock_external(Table **tables, uint32_t count);
699
bool wait_for_locked_table_names(TableList *table_list);
700
DrizzleLock *get_lock_data(Table **table_ptr, uint32_t count,
701
bool should_lock, Table **write_lock_used);
641
uint32_t global_read_lock;
704
642
uint32_t server_status;
705
643
uint32_t open_options;
706
644
uint32_t select_number; /**< number of select (used for EXPLAIN) */
1034
953
* Schedule a session to be run on the default scheduler.
1036
static bool schedule(Session::shared_ptr&);
1038
static void unlink(session_id_t &session_id);
1039
static void unlink(Session::shared_ptr&);
1042
958
For enter_cond() / exit_cond() to work the mutex must be got before
1043
959
enter_cond(); this mutex is then released by exit_cond().
1044
960
Usage must be: lock mutex; enter_cond(); your code; exit_cond().
1046
const char* enter_cond(boost::condition_variable_any &cond, boost::mutex &mutex, const char* msg);
962
const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg);
1047
963
void exit_cond(const char* old_msg);
1049
type::Time::epoch_t query_start()
1051
return getCurrentTimestampEpoch();
1056
_end_timer= _start_timer= boost::posix_time::microsec_clock::universal_time();
1057
utime_after_lock= (_start_timer - _epoch).total_microseconds();
1060
void set_time(time_t t) // This is done by a sys_var, as long as user_time is set, we will use that for all references to time
1062
_user_time= boost::posix_time::from_time_t(t);
1065
void set_time_after_lock()
1067
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::universal_time());
1068
utime_after_lock= (mytime - _epoch).total_microseconds();
1071
void set_end_timer()
1073
_end_timer= boost::posix_time::microsec_clock::universal_time();
1074
status_var.execution_time_nsec+=(_end_timer - _start_timer).total_microseconds();
1077
uint64_t getElapsedTime() const
1079
return (_end_timer - _start_timer).total_microseconds();
965
inline time_t query_start() { return start_time; }
966
inline void set_time()
970
start_time= user_time;
971
connect_microseconds= start_utime= utime_after_lock= my_micro_time();
974
start_utime= utime_after_lock= my_micro_time_and_time(&start_time);
976
inline void set_current_time() { start_time= time(NULL); }
977
inline void set_time(time_t t)
979
start_time= user_time= t;
980
start_utime= utime_after_lock= my_micro_time();
982
void set_time_after_lock() { utime_after_lock= my_micro_time(); }
1083
984
* Returns the current micro-timestamp
1085
type::Time::epoch_t getCurrentTimestamp(bool actual= true) const
1087
type::Time::epoch_t t_mark;
1091
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::universal_time());
1092
t_mark= (mytime - _epoch).total_microseconds();
1096
t_mark= (_end_timer - _epoch).total_microseconds();
1102
// We may need to set user on this
1103
type::Time::epoch_t getCurrentTimestampEpoch() const
1105
if (not _user_time.is_not_a_date_time())
1106
return (_user_time - _epoch).total_seconds();
1108
return (_start_timer - _epoch).total_seconds();
1111
type::Time::epoch_t getCurrentTimestampEpoch(type::Time::usec_t &fraction_arg) const
1113
if (not _user_time.is_not_a_date_time())
1116
return (_user_time - _epoch).total_seconds();
1119
fraction_arg= _start_timer.time_of_day().fractional_seconds() % 1000000;
1120
return (_start_timer - _epoch).total_seconds();
1123
uint64_t found_rows(void) const
986
inline uint64_t getCurrentTimestamp()
988
return my_micro_time();
990
inline uint64_t found_rows(void)
1125
992
return limit_found_rows;
1128
994
/** Returns whether the session is currently inside a transaction */
1129
bool inTransaction() const
995
inline bool inTransaction()
1131
997
return server_status & SERVER_STATUS_IN_TRANS;
999
inline bool fill_derived_tables()
1001
return !lex->only_view_structure();
1134
1004
LEX_STRING *make_lex_string(LEX_STRING *lex_str,
1135
1005
const char* str, uint32_t length,
1136
1006
bool allocate_lex_string);
1138
1007
LEX_STRING *make_lex_string(LEX_STRING *lex_str,
1139
1008
const std::string &str,
1140
1009
bool allocate_lex_string);
1142
1011
int send_explain_fields(select_result *result);
1145
1013
Clear the current error, if any.
1146
1014
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
1305
1161
* Current implementation does not depend on that, but future changes
1306
1162
* should be done with this in mind;
1308
* @param passwd Scrambled password received from client
1309
* @param db Database name to connect to, may be NULL
1164
* @param Scrambled password received from client
1165
* @param Length of scrambled password
1166
* @param Database name to connect to, may be NULL
1311
bool checkUser(const std::string &passwd, const std::string &db);
1168
bool checkUser(const char *passwd, uint32_t passwd_len, const char *db);
1314
1171
* Returns the timestamp (in microseconds) of when the Session
1315
1172
* connected to the server.
1317
uint64_t getConnectMicroseconds() const
1319
return (_connect_time - _epoch).total_microseconds();
1322
uint64_t getConnectSeconds() const
1324
return (_connect_time - _epoch).total_seconds();
1174
inline uint64_t getConnectMicroseconds() const
1176
return connect_microseconds;
1567
1397
bool openTablesLock(TableList *tables);
1400
* Open all tables in list and process derived tables
1402
* @param Pointer to a list of tables for open
1403
* @param Bitmap of flags to modify how the tables will be open:
1404
* DRIZZLE_LOCK_IGNORE_FLUSH - open table even if someone has
1405
* done a flush or namelock on it.
1414
* This is to be used on prepare stage when you don't read any
1415
* data from the tables.
1417
bool openTables(TableList *tables, uint32_t flags= 0);
1569
1419
int open_tables_from_list(TableList **start, uint32_t *counter, uint32_t flags= 0);
1571
1421
Table *openTableLock(TableList *table_list, thr_lock_type lock_type);
1572
1422
Table *openTable(TableList *table_list, bool *refresh, uint32_t flags= 0);
1574
1424
void unlink_open_table(Table *find);
1575
void drop_open_table(Table *table, const identifier::Table &identifier);
1425
void drop_open_table(Table *table, TableIdentifier &identifier);
1576
1426
void close_cached_table(Table *table);
1578
1428
/* Create a lock in the cache */
1579
table::Placeholder *table_cache_insert_placeholder(const identifier::Table &identifier);
1580
bool lock_table_name_if_not_cached(const identifier::Table &identifier, Table **table);
1429
Table *table_cache_insert_placeholder(const char *db_name, const char *table_name);
1430
bool lock_table_name_if_not_cached(TableIdentifier &identifier, Table **table);
1432
typedef boost::unordered_map<std::string, message::Table, util::insensitive_hash, util::insensitive_equal_to> TableMessageCache;
1433
TableMessageCache table_message_cache;
1435
bool storeTableMessage(const TableIdentifier &identifier, message::Table &table_message);
1436
bool removeTableMessage(const TableIdentifier &identifier);
1437
bool getTableMessage(const TableIdentifier &identifier, message::Table &table_message);
1438
bool doesTableMessageExist(const TableIdentifier &identifier);
1439
bool renameTableMessage(const TableIdentifier &from, const TableIdentifier &to);
1441
/* Work with temporary tables */
1442
Table *find_temporary_table(TableList *table_list);
1443
Table *find_temporary_table(const char *db, const char *table_name);
1444
Table *find_temporary_table(TableIdentifier &identifier);
1446
void doGetTableNames(CachedDirectory &directory,
1447
const SchemaIdentifier &schema_identifier,
1448
std::set<std::string>& set_of_names);
1449
void doGetTableNames(const SchemaIdentifier &schema_identifier,
1450
std::set<std::string>& set_of_names);
1452
void doGetTableIdentifiers(CachedDirectory &directory,
1453
const SchemaIdentifier &schema_identifier,
1454
TableIdentifiers &set_of_identifiers);
1455
void doGetTableIdentifiers(const SchemaIdentifier &schema_identifier,
1456
TableIdentifiers &set_of_identifiers);
1458
int doGetTableDefinition(const drizzled::TableIdentifier &identifier,
1459
message::Table &table_proto);
1460
bool doDoesTableExist(const drizzled::TableIdentifier &identifier);
1462
void close_temporary_tables();
1463
void close_temporary_table(Table *table);
1464
// The method below just handles the de-allocation of the table. In
1465
// a better memory type world, this would not be needed.
1583
session::TableMessages _table_message_cache;
1467
void nukeTable(Table *table);
1586
session::TableMessages &getMessageCache()
1588
return _table_message_cache;
1470
void dumpTemporaryTableNames(const char *id);
1471
int drop_temporary_table(TableList *table_list);
1472
bool rm_temporary_table(plugin::StorageEngine *base, TableIdentifier &identifier);
1473
bool rm_temporary_table(TableIdentifier &identifier, bool best_effort= false);
1474
Table *open_temporary_table(TableIdentifier &identifier,
1475
bool link_in_list= true);
1591
1477
/* Reopen operations */
1592
bool reopen_tables();
1478
bool reopen_tables(bool get_locks, bool mark_share_as_old);
1479
bool reopen_name_locked_table(TableList* table_list, bool link_in);
1593
1480
bool close_cached_tables(TableList *tables, bool wait_for_refresh, bool wait_for_placeholders);
1595
void wait_for_condition(boost::mutex &mutex, boost::condition_variable_any &cond);
1482
void wait_for_condition(pthread_mutex_t *mutex, pthread_cond_t *cond);
1596
1483
int setup_conds(TableList *leaves, COND **conds);
1597
1484
int lock_tables(TableList *tables, uint32_t count, bool *need_reopen);
1599
drizzled::util::Storable *getProperty(const std::string &arg)
1601
return life_properties.getProperty(arg);
1605
bool setProperty(const std::string &arg, T *value)
1607
life_properties.setProperty(arg, value);
1486
Table *create_virtual_tmp_table(List<CreateField> &field_list);
1613
1491
Return the default storage engine
1622
1500
if (variables.storage_engine)
1623
1501
return variables.storage_engine;
1624
1502
return global_system_variables.storage_engine;
1627
void get_xid(DrizzleXid *xid); // Innodb only
1629
table::Singular *getInstanceTable();
1630
table::Singular *getInstanceTable(List<CreateField> &field_list);
1505
static void unlink(Session *session);
1507
void get_xid(DRIZZLE_XID *xid); // Innodb only
1635
if (getrusage(RUSAGE_THREAD, &usage))
1510
std::vector<TableShareInstance *> temporary_shares;
1645
void setUsage(bool arg)
1650
const struct rusage &getUsage()
1655
catalog::Instance::const_reference catalog() const
1657
return *(_catalog.get());
1660
catalog::Instance::reference catalog()
1662
return *(_catalog.get());
1666
catalog::Instance::shared_ptr _catalog;
1668
// This lives throughout the life of Session
1670
session::PropertyMap life_properties;
1671
std::vector<table::Singular *> temporary_shares;
1672
struct rusage usage;
1513
TableShareInstance *getTemporaryShare(TableIdentifier::Type type_arg);
1675
1518
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
1520
} /* namespace drizzled */
1522
/** @TODO why is this in the middle of the file */
1523
#include <drizzled/select_to_file.h>
1524
#include <drizzled/select_export.h>
1525
#include <drizzled/select_dump.h>
1526
#include <drizzled/select_insert.h>
1527
#include <drizzled/select_create.h>
1528
#include <drizzled/tmp_table_param.h>
1529
#include <drizzled/select_union.h>
1530
#include <drizzled/select_subselect.h>
1531
#include <drizzled/select_singlerow_subselect.h>
1532
#include <drizzled/select_max_min_finder_subselect.h>
1533
#include <drizzled/select_exists_subselect.h>
1539
* A structure used to describe sort information
1540
* for a field or item used in ORDER BY.
1542
typedef struct st_sort_field
1544
Field *field; /**< Field to sort */
1545
Item *item; /**< Item if not sorting fields */
1546
size_t length; /**< Length of sort field */
1547
uint32_t suffix_length; /**< Length suffix (0-4) */
1548
Item_result result_type; /**< Type of item */
1549
bool reverse; /**< if descending sort */
1550
bool need_strxnfrm; /**< If we have to use strxnfrm() */
1553
typedef struct st_sort_buffer
1555
uint32_t index; /* 0 or 1 */
1556
uint32_t sort_orders;
1557
uint32_t change_pos; /* If sort-fields changed */
1559
SORT_FIELD *sortorder;
1562
} /* namespace drizzled */
1564
/** @TODO why is this in the middle of the file */
1566
#include <drizzled/table_ident.h>
1567
#include <drizzled/user_var_entry.h>
1568
#include <drizzled/unique.h>
1569
#include <drizzled/var.h>
1570
#include <drizzled/select_dumpvar.h>
1677
1575
/* Bits in sql_command_flags */
1679
1577
enum sql_command_flag_bits