~mordred/ubuntu/maverick/drizzle/prerelease

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: Monty Taylor
  • Date: 2010-09-26 16:09:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1383.
  • Revision ID: mordred@inaugust.com-20100926160902-r30v5hegk16cjk22
Tags: upstream-2010.09.1794
ImportĀ upstreamĀ versionĀ 2010.09.1794

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "drizzled/query_id.h"
37
37
#include "drizzled/named_savepoint.h"
38
38
#include "drizzled/transaction_context.h"
 
39
#include "drizzled/util/storable.h"
39
40
 
40
41
#include "drizzled/my_hash.h"
41
42
 
45
46
#include <bitset>
46
47
#include <deque>
47
48
 
 
49
#include "drizzled/internal/getrusage.h"
 
50
 
48
51
#include <drizzled/security_context.h>
49
52
#include <drizzled/open_tables_state.h>
50
53
 
314
317
class Session : public Open_tables_state
315
318
{
316
319
public:
 
320
  // Plugin storage in Session.
 
321
  typedef boost::unordered_map<std::string, util::Storable *, util::insensitive_hash, util::insensitive_equal_to> PropertyMap;
 
322
 
317
323
  /*
318
324
    MARK_COLUMNS_NONE:  Means mark_used_colums is not set and no indicator to
319
325
                        handler of fields used is set
503
509
    chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
504
510
  */
505
511
  uint32_t dbug_sentry; /**< watch for memory corruption */
 
512
private:
506
513
  internal::st_my_thread_var *mysys_var;
 
514
public:
 
515
 
 
516
  internal::st_my_thread_var *getThreadVar()
 
517
  {
 
518
    return mysys_var;
 
519
  }
 
520
 
 
521
  void resetThreadVar()
 
522
  {
 
523
    mysys_var= NULL;
 
524
  }
507
525
  /**
508
526
   * Type of current query: COM_STMT_PREPARE, COM_QUERY, etc. Set from
509
527
   * first byte of the packet in executeStatement()
666
684
    create_sort_index(); may differ from examined_row_count.
667
685
  */
668
686
  uint32_t row_count;
669
 
  pthread_t real_id; /**< For debugging */
670
687
  uint64_t thread_id;
671
688
  uint32_t tmp_table;
672
689
  uint32_t global_read_lock;
1549
1566
  int lock_tables(TableList *tables, uint32_t count, bool *need_reopen);
1550
1567
 
1551
1568
  Table *create_virtual_tmp_table(List<CreateField> &field_list);
1552
 
 
1553
 
 
 
1569
  
 
1570
  drizzled::util::Storable *getProperty(const std::string &arg)
 
1571
  {
 
1572
    return life_properties[arg];
 
1573
  }
 
1574
 
 
1575
  template<class T>
 
1576
  bool setProperty(const std::string &arg, T *value)
 
1577
  {
 
1578
    life_properties[arg]= value;
 
1579
 
 
1580
    return true;
 
1581
  }
1554
1582
 
1555
1583
  /**
1556
1584
    Return the default storage engine
1571
1599
 
1572
1600
  void get_xid(DRIZZLE_XID *xid); // Innodb only
1573
1601
 
1574
 
private:
 
1602
  TableShareInstance *getTemporaryShare(TableIdentifier::Type type_arg);
 
1603
 
 
1604
private:
 
1605
  bool resetUsage()
 
1606
  {
 
1607
    if (getrusage(RUSAGE_THREAD, &usage))
 
1608
    {
 
1609
      return false;
 
1610
    }
 
1611
 
 
1612
    return true;
 
1613
  }
 
1614
public:
 
1615
 
 
1616
  void setUsage(bool arg)
 
1617
  {
 
1618
    use_usage= arg;
 
1619
  }
 
1620
 
 
1621
  const struct rusage &getUsage()
 
1622
  {
 
1623
    return usage;
 
1624
  }
 
1625
 
 
1626
private:
 
1627
  // This lives throughout the life of Session
 
1628
  bool use_usage;
 
1629
  PropertyMap life_properties;
1575
1630
  std::vector<TableShareInstance *> temporary_shares;
1576
 
 
1577
 
public:
1578
 
  TableShareInstance *getTemporaryShare(TableIdentifier::Type type_arg);
 
1631
  struct rusage usage;
1579
1632
};
1580
1633
 
1581
1634
class Join;