~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/table_function.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <config.h>
21
21
 
 
22
#include <drizzled/current_session.h>
 
23
#include <drizzled/gettext.h>
 
24
#include <drizzled/global_charset_info.h>
22
25
#include <drizzled/plugin/table_function.h>
 
26
#include <drizzled/session.h>
 
27
#include <drizzled/show.h>
23
28
#include <drizzled/table_function_container.h>
24
 
#include <drizzled/gettext.h>
25
 
#include "drizzled/global_charset_info.h"
26
 
#include "drizzled/session.h"
27
 
#include "drizzled/current_session.h"
28
29
 
29
30
#include <vector>
30
31
 
35
36
 
36
37
void plugin::TableFunction::init()
37
38
{
38
 
  drizzled::message::Engine *engine;
39
 
  drizzled::message::Table::TableOptions *table_options;
40
 
 
41
 
  proto.set_name(getTableLabel());
42
 
  proto.set_schema(identifier.getSchemaName());
 
39
  drizzled::message::table::init(proto, getTableLabel(), identifier.getSchemaName(), "FunctionEngine");
43
40
  proto.set_type(drizzled::message::Table::FUNCTION);
44
41
  proto.set_creation_timestamp(0);
45
42
  proto.set_update_timestamp(0);
46
43
 
47
 
  table_options= proto.mutable_options();
48
 
  table_options->set_collation_id(default_charset_info->number);
49
 
  table_options->set_collation(default_charset_info->name);
50
 
 
51
 
  engine= proto.mutable_engine();
52
 
  engine->set_name("FunctionEngine");
 
44
  proto.mutable_options()->set_dont_replicate(true);
53
45
}
54
46
 
55
47
bool plugin::TableFunction::addPlugin(plugin::TableFunction *tool)
103
95
  field_options= field->mutable_options();
104
96
  field_constraints= field->mutable_constraints();
105
97
  field_options->set_default_null(is_default_null);
106
 
  field_constraints->set_is_nullable(is_default_null);
 
98
  field_constraints->set_is_notnull(not is_default_null);
107
99
 
108
100
  switch (type) 
109
101
  {
110
 
  default:
111
 
  case TableFunction::BOOLEAN: // Currently BOOLEAN always has a value
112
 
    field_length= 5;
113
102
  case TableFunction::STRING:
114
103
    {
115
104
      drizzled::message::Table::Field::StringFieldOptions *string_field_options;
146
135
    field->set_type(drizzled::message::Table::Field::BIGINT);
147
136
    field_constraints->set_is_unsigned(true);
148
137
    break;
 
138
  case TableFunction::BOOLEAN: // Currently BOOLEAN always has a value
 
139
    field->set_type(drizzled::message::Table::Field::BOOLEAN);
 
140
    field_constraints->set_is_unsigned(true);
 
141
    break;
149
142
  }
150
143
}
151
144
 
231
224
 
232
225
bool plugin::TableFunction::Generator::isWild(const std::string &predicate)
233
226
{
234
 
  if (not getSession().lex->wild)
 
227
  if (not getSession().getLex()->wild)
235
228
    return false;
236
229
 
237
230
  bool match= wild_case_compare(system_charset_info,
238
231
                                predicate.c_str(),
239
 
                                getSession().lex->wild->ptr());
 
232
                                getSession().getLex()->wild->ptr());
240
233
 
241
234
  return match;
242
235
}