~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/table_function.h

  • Committer: Monty Taylor
  • Date: 2010-06-20 03:22:53 UTC
  • mfrom: (1618.1.1 drizzle)
  • mto: This revision was merged to the branch mainline in revision 1629.
  • Revision ID: mordred@inaugust.com-20100620032253-dyee0nb0195lnakd
Merged in constification of TableIdentifier from Brian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <drizzled/definitions.h>
27
27
#include "drizzled/plugin.h"
28
28
#include "drizzled/plugin/plugin.h"
29
 
#include "drizzled/identifier.h"
 
29
#include "drizzled/table_identifier.h"
30
30
#include "drizzled/message/table.pb.h"
31
31
#include "drizzled/charset.h"
32
32
#include "drizzled/field.h"
44
44
namespace plugin
45
45
{
46
46
 
47
 
#define TABLE_FUNCTION_BLOB_SIZE 2049
48
 
 
49
47
// Not thread safe, but plugins are just loaded in a single thread right
50
48
// now.
51
49
static const char *local_string_append(const char *arg1, const char *arg2)
70
68
  message::Table proto;
71
69
  TableIdentifier identifier;
72
70
  std::string local_path;
 
71
  std::string local_schema;
 
72
  std::string local_table_name;
73
73
  std::string original_table_label;
74
74
 
75
75
  void setName(); // init name
76
76
 
77
77
  void init();
78
78
 
79
 
 
80
79
public:
81
80
  TableFunction(const char *schema_arg, const char *table_arg) :
82
81
    Plugin(local_string_append(schema_arg, table_arg) , "TableFunction"),
154
153
 
155
154
  const std::string &getIdentifierTableName()
156
155
  { 
157
 
    return identifier.getTableName();
 
156
    if (local_table_name.empty())
 
157
    {
 
158
      local_table_name= identifier.getTableName();
 
159
      std::transform(local_table_name.begin(), local_table_name.end(),
 
160
                     local_table_name.begin(), ::tolower);
 
161
    }
 
162
 
 
163
    return local_table_name;
158
164
  }
159
165
 
160
166
  const std::string &getSchemaHome()
161
167
  { 
162
 
    return identifier.getSchemaName();
 
168
    if (local_schema.empty())
 
169
    {
 
170
      local_schema= identifier.getSchemaName();
 
171
      std::transform(local_schema.begin(), local_schema.end(),
 
172
                     local_schema.begin(), ::tolower);
 
173
    }
 
174
 
 
175
    return local_schema;
163
176
  }
164
177
 
165
178
  const std::string &getPath()
166
179
  { 
167
 
    return identifier.getPath();
 
180
    if (local_path.empty())
 
181
    {
 
182
      local_path= identifier.getPath();
 
183
      std::transform(local_path.begin(), local_path.end(),
 
184
                     local_path.begin(), ::tolower);
 
185
    }
 
186
 
 
187
    return local_path;
168
188
  }
169
189
 
170
190
  virtual Generator *generator(Field **arg);
184
204
                 TableFunction::ColumnType type,
185
205
                 uint32_t field_length,
186
206
                 bool is_default_null= false);
187
 
 
188
 
  virtual bool visable() { return true; }
189
207
};
190
208
 
191
209
} /* namespace plugin */