~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

  • Committer: lbieber
  • Date: 2010-09-23 20:19:20 UTC
  • mfrom: (1789.1.2 session_usage)
  • Revision ID: lbieber@orisndriz08-20100923201920-helm9tnadwf8p9dg
Merge Brian - Merge in session performance table (this is not built by default)

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
1560
1566
  int lock_tables(TableList *tables, uint32_t count, bool *need_reopen);
1561
1567
 
1562
1568
  Table *create_virtual_tmp_table(List<CreateField> &field_list);
1563
 
 
1564
 
 
 
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
  }
1565
1582
 
1566
1583
  /**
1567
1584
    Return the default storage engine
1582
1599
 
1583
1600
  void get_xid(DRIZZLE_XID *xid); // Innodb only
1584
1601
 
1585
 
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;
1586
1630
  std::vector<TableShareInstance *> temporary_shares;
1587
 
 
1588
 
public:
1589
 
  TableShareInstance *getTemporaryShare(TableIdentifier::Type type_arg);
 
1631
  struct rusage usage;
1590
1632
};
1591
1633
 
1592
1634
class Join;