~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/definition/table.h

  • Committer: Brian Aker
  • Date: 2010-11-08 18:24:58 UTC
  • mto: (1921.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 1916.
  • Revision ID: brian@tangent.org-20101108182458-twv4hyix43ojno80
Merge in changes such that lock is now broken out into its own directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
39
39
#include "drizzled/util/string.h"
40
40
 
41
41
#include "drizzled/table/cache.h"
 
42
#include "drizzled/definition/cache.h"
42
43
 
43
44
namespace drizzled
44
45
{
45
46
 
46
47
extern uint64_t refresh_version;
47
48
 
 
49
typedef boost::shared_ptr<TableShare> TableSharePtr;
 
50
 
48
51
const static std::string STANDARD_STRING("STANDARD");
49
52
const static std::string TEMPORARY_STRING("TEMPORARY");
50
53
const static std::string INTERNAL_STRING("INTERNAL");
61
64
class TableShare
62
65
{
63
66
  typedef std::vector<std::string> StringVector;
64
 
 
65
67
public:
66
 
  typedef boost::shared_ptr<TableShare> shared_ptr;
67
 
  typedef std::vector <shared_ptr> vector;
68
 
 
69
 
  TableShare(const TableIdentifier::Type type_arg);
70
 
 
71
 
  TableShare(const TableIdentifier &identifier, const TableIdentifier::Key &key); // Used by placeholder
 
68
  TableShare(TableIdentifier::Type type_arg);
 
69
 
 
70
  TableShare(TableIdentifier &identifier, const TableIdentifier::Key &key); // Used by placeholder
72
71
 
73
72
  TableShare(const TableIdentifier &identifier); // Just used during createTable()
74
73
 
75
 
  TableShare(const TableIdentifier::Type type_arg,
76
 
             const TableIdentifier &identifier,
 
74
  TableShare(TableIdentifier::Type type_arg,
 
75
             TableIdentifier &identifier,
77
76
             char *path_arg= NULL, uint32_t path_length_arg= 0); // Shares for cache
78
77
 
79
78
  ~TableShare();
501
500
    unlock();
502
501
  }
503
502
 
 
503
  uint32_t decrementTableCount()
 
504
  {
 
505
    return --ref_count;
 
506
  }
 
507
 
504
508
  uint32_t null_bytes;
505
509
  uint32_t last_null_bit_pos;
506
510
  uint32_t fields;                              /* Number of fields */
522
526
  uint32_t uniques;                         /* Number of UNIQUE index */
523
527
  uint32_t null_fields;                 /* number of null fields */
524
528
  uint32_t blob_fields;                 /* number of blob fields */
 
529
  uint32_t timestamp_field_offset;              /* Field number for timestamp field */
525
530
private:
526
531
  bool has_variable_width;                  /* number of varchar fields */
527
532
public:
569
574
  uint8_t blob_ptr_size;                        /* 4 or 8 */
570
575
  bool db_low_byte_first;               /* Portable row format */
571
576
 
 
577
private:
 
578
  bool name_lock;
 
579
public:
 
580
  bool isNameLock() const
 
581
  {
 
582
    return name_lock;
 
583
  }
 
584
 
 
585
  bool replace_with_name_lock;
 
586
 
 
587
private:
 
588
  bool waiting_on_cond;                 /* Protection against free */
 
589
public:
 
590
  bool isWaitingOnCondition()
 
591
  {
 
592
    return waiting_on_cond;
 
593
  }
 
594
 
572
595
  /*
573
596
    Set of keys in use, implemented as a Bitmap.
574
597
    Excludes keys disabled by ALTER Table ... DISABLE KEYS.
602
625
    NOTES
603
626
  */
604
627
 
605
 
  void setIdentifier(const TableIdentifier &identifier_arg);
 
628
  void setIdentifier(TableIdentifier &identifier_arg);
606
629
 
607
630
  /*
608
631
    Initialize share for temporary tables
628
651
  void open_table_error(int pass_error, int db_errno, int pass_errarg);
629
652
 
630
653
  static void release(TableShare *share);
631
 
  static void release(TableShare::shared_ptr &share);
632
 
  static void release(const TableIdentifier &identifier);
633
 
  static TableShare::shared_ptr getShareCreate(Session *session, 
634
 
                                               const TableIdentifier &identifier,
635
 
                                               int &error);
 
654
  static void release(TableSharePtr &share);
 
655
  static void release(TableIdentifier &identifier);
 
656
  static TableSharePtr getShare(TableIdentifier &identifier);
 
657
  static TableSharePtr getShareCreate(Session *session, 
 
658
                                      TableIdentifier &identifier,
 
659
                                      int *error);
636
660
 
637
661
  friend std::ostream& operator<<(std::ostream& output, const TableShare &share)
638
662
  {
661
685
                    TYPELIB *interval,
662
686
                    const char *field_name);
663
687
 
664
 
  int open_table_def(Session& session, const TableIdentifier &identifier);
 
688
  int open_table_def(Session& session, TableIdentifier &identifier);
665
689
 
666
690
  int open_table_from_share(Session *session,
667
691
                            const TableIdentifier &identifier,