22
22
#include <algorithm>
24
24
#include <boost/make_shared.hpp>
25
#include <boost/scoped_ptr.hpp>
25
26
#include <boost/thread/condition_variable.hpp>
26
27
#include <boost/thread/mutex.hpp>
27
28
#include <boost/thread/shared_mutex.hpp>
32
33
#include <sys/resource.h>
33
34
#include <sys/time.h>
35
#include <drizzled/catalog/instance.h>
36
#include <drizzled/catalog/local.h>
37
#include <drizzled/copy_info.h>
38
#include <drizzled/cursor.h>
39
#include <drizzled/diagnostics_area.h>
36
#include <drizzled/global_charset_info.h>
37
#include <drizzled/base.h>
38
#include <drizzled/discrete_interval.h>
40
39
#include <drizzled/error.h>
41
#include <drizzled/file_exchange.h>
42
#include <drizzled/ha_data.h>
43
#include <drizzled/identifier.h>
44
#include <drizzled/named_savepoint.h>
45
40
#include <drizzled/open_tables_state.h>
46
#include <drizzled/plugin.h>
47
#include <drizzled/plugin/authorization.h>
48
41
#include <drizzled/pthread_globals.h>
49
42
#include <drizzled/query_id.h>
50
#include <drizzled/resource_context.h>
51
43
#include <drizzled/session/property_map.h>
52
#include <drizzled/session/state.h>
53
44
#include <drizzled/session/table_messages.h>
54
45
#include <drizzled/session/transactions.h>
46
#include <drizzled/sql_list.h>
55
47
#include <drizzled/sql_error.h>
56
48
#include <drizzled/sql_locale.h>
57
49
#include <drizzled/statistics_variables.h>
58
50
#include <drizzled/system_variables.h>
59
#include <drizzled/system_variables.h>
60
#include <drizzled/table_ident.h>
61
51
#include <drizzled/transaction_context.h>
62
52
#include <drizzled/util/storable.h>
63
53
#include <drizzled/var.h>
87
78
namespace internal { struct st_my_thread_var; }
92
typedef class Item COND;
96
class Diagnostics_area;
97
99
class Internal_error_handler;
98
102
class Lex_input_stream;
103
class ResourceContext;
99
104
class TableShareInstance;
100
105
class Table_ident;
102
107
class select_result;
103
108
class user_var_entry;
105
111
extern char internal_table_name[2];
106
112
extern char empty_c_string[1];
334
341
drizzle_system_variables variables; /**< Mutable local variables local to the session */
336
enum_tx_isolation getTxIsolation()
338
return (enum_tx_isolation)variables.tx_isolation;
341
system_status_var status_var; /**< Session-local status counters */
342
enum_tx_isolation getTxIsolation();
343
system_status_var status_var;
345
system_status_var status_var0; /**< Session-local status counters */
342
346
THR_LOCK_INFO lock_info; /**< Locking information for this session */
343
347
THR_LOCK_OWNER main_lock_id; /**< To use for conventional queries */
344
348
THR_LOCK_OWNER *lock_id; /**< If not main_lock_id, points to the lock_id of a cursor. */
1041
1044
utime_after_lock= (boost::posix_time::microsec_clock::universal_time() - _epoch).total_microseconds();
1044
void set_end_timer()
1046
_end_timer= boost::posix_time::microsec_clock::universal_time();
1047
status_var.execution_time_nsec+=(_end_timer - _start_timer).total_microseconds();
1047
void set_end_timer();
1050
1049
uint64_t getElapsedTime() const
1100
1099
int send_explain_fields(select_result *result);
1103
Clear the current error, if any.
1104
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
1105
assume this is never called if the fatal error is set.
1106
@todo: To silence an error, one should use Internal_error_handler
1107
mechanism. In future this function will be removed.
1109
inline void clear_error(bool full= false)
1111
if (main_da.is_error())
1112
main_da.reset_diagnostics_area();
1116
drizzle_reset_errors(this, true);
1120
void clearDiagnostics()
1122
main_da.reset_diagnostics_area();
1126
Mark the current error as fatal. Warning: this does not
1127
set any error, it sets a property of the error, so must be
1128
followed or prefixed with my_error().
1130
inline void fatal_error()
1132
assert(main_da.is_error());
1133
is_fatal_error= true;
1136
true if there is an error in the error stack.
1138
Please use this method instead of direct access to
1141
If true, the current (sub)-statement should be aborted.
1142
The main difference between this member and is_fatal_error
1143
is that a fatal error can not be handled by a stored
1144
procedure continue handler, whereas a normal error can.
1146
To raise this flag, use my_error().
1148
inline bool is_error() const { return main_da.is_error(); }
1101
void clear_error(bool full= false);
1102
void clearDiagnostics();
1104
bool is_error() const;
1149
1106
inline const CHARSET_INFO *charset() { return default_charset_info; }
1409
1366
void mark_used_tables_as_free_for_reuse(Table *table);
1413
/** A short cut for session->main_da.set_ok_status(). */
1414
inline void my_ok(ha_rows affected_rows= 0, ha_rows found_rows_arg= 0,
1415
uint64_t passed_id= 0, const char *message= NULL)
1417
main_da.set_ok_status(this, affected_rows, found_rows_arg, passed_id, message);
1421
/** A short cut for session->main_da.set_eof_status(). */
1423
inline void my_eof()
1425
main_da.set_eof_status(this);
1369
void my_ok(ha_rows affected_rows= 0, ha_rows found_rows_arg= 0, uint64_t passed_id= 0, const char *message= NULL);
1428
1371
bool add_item_to_list(Item *item);
1429
1372
bool add_value_to_list(Item *value);
1430
1373
bool add_order_to_list(Item *item, bool asc);
1483
1426
table::Placeholder *table_cache_insert_placeholder(const identifier::Table &identifier);
1484
1427
bool lock_table_name_if_not_cached(const identifier::Table &identifier, Table **table);
1486
session::TableMessages &getMessageCache()
1488
return _table_message_cache;
1429
session::TableMessages &getMessageCache();
1491
1431
/* Reopen operations */
1492
1432
bool reopen_tables();
1516
1456
pointer to plugin::StorageEngine
1518
plugin::StorageEngine *getDefaultStorageEngine()
1520
if (variables.storage_engine)
1521
return variables.storage_engine;
1522
return global_system_variables.storage_engine;
1458
plugin::StorageEngine *getDefaultStorageEngine();
1525
1459
void get_xid(DrizzleXid *xid); // Innodb only
1527
1461
table::Singular *getInstanceTable();
1558
1492
return not getrusage(RUSAGE_THREAD, &usage);
1561
session::TableMessages _table_message_cache;
1562
1495
boost::scoped_ptr<impl_c> impl_;
1563
1496
catalog::Instance::shared_ptr _catalog;