~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/identifier/schema.h

  • Committer: Stewart Smith
  • Date: 2010-11-07 04:22:31 UTC
  • mto: (1911.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: stewart@flamingspork.com-20101107042231-ola4sl7j0qvg58tz
fix ARCHIVE storage engine calling exit (lintian warning). Was because we were linking in libinternal into libazio, which links into archive plugin. Just link libinternal into the command line utilities.

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
29
29
  This will replace Table_ident.
30
30
  */
31
31
 
32
 
 
33
 
 
34
32
#ifndef DRIZZLED_IDENTIFIER_SCHEMA_H
35
33
#define DRIZZLED_IDENTIFIER_SCHEMA_H
36
34
 
37
35
#include <drizzled/enum.h>
38
 
#include <drizzled/definitions.h>
39
 
#include <drizzled/message/table.pb.h>
40
 
#include <drizzled/catalog/local.h>
 
36
#include "drizzled/definitions.h"
 
37
#include "drizzled/message/table.pb.h"
41
38
#include <string.h>
42
39
 
43
40
#include <assert.h>
50
47
 
51
48
#include <boost/algorithm/string.hpp>
52
49
 
53
 
#include <drizzled/visibility.h>
54
 
 
55
50
namespace drizzled {
56
 
namespace identifier {
57
 
 
58
 
class DRIZZLED_API Schema : public Identifier
 
51
 
 
52
static std::string catalog("local");
 
53
 
 
54
class SchemaIdentifier
59
55
{
60
56
  std::string db;
61
57
  std::string db_path;
62
 
 
63
 
public:
64
 
  typedef std::vector <Schema> vector;
65
 
  typedef const Schema& const_reference;
66
 
 
67
 
  Schema(const std::string &db_arg);
68
 
 
69
 
  virtual ~Schema()
 
58
  std::string catalog;
 
59
 
 
60
 
 
61
  // @note this should be changed to protected once Session contains an
 
62
  // identifier for current db.
 
63
public:
 
64
 
 
65
public:
 
66
  SchemaIdentifier(const std::string &db_arg);
 
67
 
 
68
  virtual ~SchemaIdentifier()
70
69
  { }
71
70
 
72
 
  virtual void getSQLPath(std::string &arg) const;
73
 
 
 
71
  virtual const std::string &getSQLPath();
74
72
  const std::string &getPath() const;
75
73
 
76
74
  const std::string &getSchemaName() const
78
76
    return db;
79
77
  }
80
78
 
81
 
  const std::string &getCatalogName() const;
82
 
 
83
 
  virtual bool isValid() const;
84
 
 
85
 
  inline virtual bool isSystem() const
 
79
  const std::string &getCatalogName() const
86
80
  {
87
 
    return false;
 
81
    return catalog;
88
82
  }
89
83
 
 
84
  bool isValid() const;
90
85
  bool compare(const std::string &arg) const;
91
 
  bool compare(Schema::const_reference) const;
92
86
 
93
 
  friend bool operator<(Schema::const_reference left, Schema::const_reference right)
 
87
  friend bool operator<(const SchemaIdentifier &left, const SchemaIdentifier &right)
94
88
  {
95
89
    return  boost::algorithm::to_upper_copy(left.getSchemaName()) < boost::algorithm::to_upper_copy(right.getSchemaName());
96
90
  }
97
91
 
98
 
  friend bool operator==(Schema::const_reference left,
99
 
                         Schema::const_reference right)
 
92
  friend std::ostream& operator<<(std::ostream& output,
 
93
                                  SchemaIdentifier &identifier)
 
94
  {
 
95
    output << "SchemaIdentifier:(";
 
96
    output <<  identifier.catalog;
 
97
    output << ", ";
 
98
    output <<  identifier.db;
 
99
    output << ", ";
 
100
    output << identifier.getPath();
 
101
    output << ")";
 
102
 
 
103
    return output;  // for multiple << operators.
 
104
  }
 
105
 
 
106
  friend bool operator==(const SchemaIdentifier &left,
 
107
                         const SchemaIdentifier &right)
100
108
  {
101
109
    return boost::iequals(left.getSchemaName(), right.getSchemaName());
102
110
  }
 
111
 
103
112
};
104
113
 
105
 
std::ostream& operator<<(std::ostream& output, const Schema&identifier);
106
 
 
107
 
 
108
 
} /* namespace identifier */
 
114
typedef std::vector <SchemaIdentifier> SchemaIdentifiers;
 
115
 
109
116
} /* namespace drizzled */
110
117
 
111
118
#endif /* DRIZZLED_IDENTIFIER_SCHEMA_H */