319
321
typedef boost::unordered_map<std::string, util::Storable *, util::insensitive_hash, util::insensitive_equal_to> PropertyMap;
320
322
typedef Session* Ptr;
321
323
typedef boost::shared_ptr<Session> shared_ptr;
324
typedef Session& reference;
322
325
typedef const Session& const_reference;
323
326
typedef const Session* const_pointer;
324
327
typedef Session* pointer;
329
static shared_ptr make_shared(plugin::Client *client, catalog::Instance::shared_ptr instance_arg)
331
assert(instance_arg);
332
return boost::make_shared<Session>(client, instance_arg);
327
336
MARK_COLUMNS_NONE: Means mark_used_colums is not set and no indicator to
328
337
handler of fields used is set
659
668
uint32_t file_id; /**< File ID for LOAD DATA INFILE */
660
669
/* @note the following three members should likely move to Client */
661
670
uint32_t max_client_packet_length; /**< Maximum number of bytes a client can send in a single packet */
664
uint64_t thr_create_utime; /**< track down slow pthread_create */
665
uint64_t start_utime;
666
uint64_t utime_after_lock;
673
boost::posix_time::ptime _epoch;
674
boost::posix_time::ptime _connect_time;
675
boost::posix_time::ptime _start_timer;
676
boost::posix_time::ptime _end_timer;
678
boost::posix_time::ptime _user_time;
680
uint64_t utime_after_lock; // This used by Innodb.
684
_user_time= boost::posix_time::not_a_date_time;
687
const boost::posix_time::ptime &start_timer() const
692
void getTimeDifference(boost::posix_time::time_duration &result_arg, const boost::posix_time::ptime &arg) const
694
result_arg= arg - _start_timer;
668
697
thr_lock_type update_lock_default;
1240
1270
const char* enter_cond(boost::condition_variable_any &cond, boost::mutex &mutex, const char* msg);
1241
1271
void exit_cond(const char* old_msg);
1243
inline time_t query_start() { return start_time; }
1244
inline void set_time()
1246
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
1247
boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
1248
start_utime= utime_after_lock= (mytime-epoch).total_microseconds();
1252
start_time= user_time;
1253
connect_microseconds= start_utime;
1256
start_time= (mytime-epoch).total_seconds();
1258
inline void set_current_time() { start_time= time(NULL); }
1259
inline void set_time(time_t t)
1261
start_time= user_time= t;
1262
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
1263
boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
1264
uint64_t t_mark= (mytime-epoch).total_microseconds();
1266
start_utime= utime_after_lock= t_mark;
1268
void set_time_after_lock() {
1269
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
1270
boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
1271
utime_after_lock= (mytime-epoch).total_microseconds();
1273
time_t query_start()
1275
return getCurrentTimestampEpoch();
1280
_end_timer= _start_timer= boost::posix_time::microsec_clock::universal_time();
1281
utime_after_lock= (_start_timer - _epoch).total_microseconds();
1284
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
1286
_user_time= boost::posix_time::from_time_t(t);
1289
void set_time_after_lock()
1291
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::universal_time());
1292
utime_after_lock= (mytime - _epoch).total_microseconds();
1295
void set_end_timer()
1297
_end_timer= boost::posix_time::microsec_clock::universal_time();
1298
status_var.execution_time_nsec+=(_end_timer - _start_timer).total_microseconds();
1301
uint64_t getElapsedTime() const
1303
return (_end_timer - _start_timer).total_microseconds();
1274
1307
* Returns the current micro-timestamp
1276
inline uint64_t getCurrentTimestamp()
1309
uint64_t getCurrentTimestamp(bool actual= true) const
1278
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::local_time());
1279
boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
1280
uint64_t t_mark= (mytime-epoch).total_microseconds();
1315
boost::posix_time::ptime mytime(boost::posix_time::microsec_clock::universal_time());
1316
t_mark= (mytime - _epoch).total_microseconds();
1320
t_mark= (_end_timer - _epoch).total_microseconds();
1284
inline uint64_t found_rows(void)
1326
// We may need to set user on this
1327
time_t getCurrentTimestampEpoch() const
1329
if (not _user_time.is_not_a_date_time())
1330
return (_user_time - _epoch).total_seconds();
1332
return (_start_timer - _epoch).total_seconds();
1335
time_t getCurrentTimestampEpoch(uint32_t &fraction_arg) const
1337
if (not _user_time.is_not_a_date_time())
1340
return (_user_time - _epoch).total_seconds();
1343
fraction_arg= _start_timer.time_of_day().fractional_seconds() % 1000000;
1344
return (_start_timer - _epoch).total_seconds();
1347
uint64_t found_rows(void) const
1286
1349
return limit_found_rows;
1288
1352
/** Returns whether the session is currently inside a transaction */
1289
inline bool inTransaction()
1353
bool inTransaction() const
1291
1355
return server_status & SERVER_STATUS_IN_TRANS;
1293
1358
LEX_STRING *make_lex_string(LEX_STRING *lex_str,
1294
1359
const char* str, uint32_t length,
1295
1360
bool allocate_lex_string);
1296
1362
LEX_STRING *make_lex_string(LEX_STRING *lex_str,
1297
1363
const std::string &str,
1298
1364
bool allocate_lex_string);
1300
1366
int send_explain_fields(select_result *result);
1302
1369
Clear the current error, if any.
1303
1370
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we