~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/table_function.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
22
#include <drizzled/current_session.h>
23
23
#include <drizzled/gettext.h>
24
 
#include <drizzled/charset.h>
 
24
#include <drizzled/global_charset_info.h>
25
25
#include <drizzled/plugin/table_function.h>
26
26
#include <drizzled/session.h>
27
27
#include <drizzled/show.h>
28
28
#include <drizzled/table_function_container.h>
29
 
#include <drizzled/sql_lex.h>
30
29
 
31
30
#include <vector>
32
31
 
33
 
namespace drizzled {
 
32
namespace drizzled
 
33
{
34
34
 
35
35
static TableFunctionContainer table_functions;
36
36
 
40
40
  proto.set_type(drizzled::message::Table::FUNCTION);
41
41
  proto.set_creation_timestamp(0);
42
42
  proto.set_update_timestamp(0);
43
 
  message::set_is_replicated(proto, false);
44
 
  message::set_definer(proto, SYSTEM_USER);
45
43
}
46
44
 
47
45
bool plugin::TableFunction::addPlugin(plugin::TableFunction *tool)
48
46
{
49
47
  assert(tool != NULL);
50
 
  table_functions.addFunction(tool);
 
48
  table_functions.addFunction(tool); 
51
49
  return false;
52
50
}
53
51
 
62
60
  table_functions.getNames(arg, set_of_names);
63
61
}
64
62
 
65
 
LEX& plugin::TableFunction::Generator::lex()
66
 
{
67
 
        return getSession().lex();
68
 
}
69
 
 
70
 
statement::Statement& plugin::TableFunction::Generator::statement()
71
 
{
72
 
        return *lex().statement;
73
 
}
74
 
 
75
63
plugin::TableFunction::Generator *plugin::TableFunction::generator(Field **arg)
76
64
{
77
65
  return new Generator(arg);
107
95
  field_options->set_default_null(is_default_null);
108
96
  field_constraints->set_is_notnull(not is_default_null);
109
97
 
110
 
  switch (type)
 
98
  switch (type) 
111
99
  {
112
100
  case TableFunction::STRING:
113
101
    {
161
149
 
162
150
bool plugin::TableFunction::Generator::sub_populate(uint32_t field_size)
163
151
{
 
152
  bool ret;
 
153
  uint64_t difference;
 
154
 
164
155
  columns_iterator= columns;
165
 
  bool ret= populate();
166
 
  uint64_t difference= columns_iterator - columns;
 
156
  ret= populate();
 
157
  difference= columns_iterator - columns;
167
158
 
168
 
  if (ret)
 
159
  if (ret == true)
 
160
  {
169
161
    assert(difference == field_size);
 
162
  }
 
163
 
170
164
  return ret;
171
165
}
172
166
 
215
209
void plugin::TableFunction::Generator::push(bool arg)
216
210
{
217
211
  if (arg)
 
212
  {
218
213
    (*columns_iterator)->store("YES", 3, scs);
 
214
  }
219
215
  else
 
216
  {
220
217
    (*columns_iterator)->store("NO", 2, scs);
 
218
  }
 
219
 
221
220
  columns_iterator++;
222
221
}
223
222
 
224
223
bool plugin::TableFunction::Generator::isWild(const std::string &predicate)
225
224
{
226
 
  return lex().wild ? wild_case_compare(system_charset_info, predicate.c_str(), lex().wild->ptr()) : false;
 
225
  if (not getSession().lex->wild)
 
226
    return false;
 
227
 
 
228
  bool match= wild_case_compare(system_charset_info,
 
229
                                predicate.c_str(),
 
230
                                getSession().lex->wild->ptr());
 
231
 
 
232
  return match;
227
233
}
228
234
 
229
235
} /* namespace drizzled */