~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/function_engine/function.cc

  • Committer: Mark Atwood
  • Date: 2011-08-11 03:05:03 UTC
  • mfrom: (2385.1.12 refactor4)
  • Revision ID: me@mark.atwood.name-20110811030503-rp9xjihc5x3y0x4q
mergeĀ lp:~olafvdspek/drizzle/refactor4

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
22
 
 
 
21
#include <config.h>
 
22
#include <boost/foreach.hpp>
23
23
#include <plugin/function_engine/function.h>
24
24
#include <plugin/function_engine/cursor.h>
25
 
 
26
25
#include <string>
27
26
 
28
27
using namespace std;
34
33
                                  HTON_HAS_SCHEMA_DICTIONARY |
35
34
                                  HTON_SKIP_STORE_LOCK |
36
35
                                  HTON_TEMPORARY_NOT_SUPPORTED),
37
 
  information_message(new(message::Schema)),
38
 
  data_dictionary_message(new(message::Schema))
 
36
  information_message(new message::Schema),
 
37
  data_dictionary_message(new message::Schema)
39
38
 
40
39
{
41
40
  information_message->set_name(INFORMATION_SCHEMA_IDENTIFIER.getSchemaName());
42
 
  data_dictionary_message->set_collation("utf8_general_ci");
 
41
  information_message->set_collation("utf8_general_ci");
 
42
  message::set_is_replicated(*information_message, false);
43
43
 
44
44
  data_dictionary_message->set_name(DATA_DICTIONARY_IDENTIFIER.getSchemaName());
45
45
  data_dictionary_message->set_collation("utf8_general_ci");
 
46
  message::set_is_replicated(*data_dictionary_message, false);
46
47
}
47
48
 
48
49
 
67
68
  return EEXIST;
68
69
}
69
70
 
70
 
void Function::doGetSchemaIdentifiers(identifier::Schema::vector& schemas)
 
71
void Function::doGetSchemaIdentifiers(identifier::schema::vector& schemas)
71
72
{
72
73
  schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER);
73
74
  schemas.push_back(DATA_DICTIONARY_IDENTIFIER);
74
75
}
75
76
 
76
 
bool Function::doGetSchemaDefinition(const identifier::Schema &schema_identifier, message::schema::shared_ptr &schema_message)
 
77
drizzled::message::schema::shared_ptr Function::doGetSchemaDefinition(const identifier::Schema &schema_identifier)
77
78
{
78
 
  schema_message.reset(new message::Schema); // This should be fixed, we could just be using ones we built on startup.
 
79
  drizzled::message::schema::shared_ptr schema_message;
79
80
 
80
81
  if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER)
81
82
  {
87
88
  }
88
89
  else
89
90
  {
90
 
    return false;
 
91
    return drizzled::message::schema::shared_ptr();
91
92
  }
92
93
 
93
 
  return true;
 
94
  return schema_message;
94
95
}
95
96
 
96
97
bool Function::doCanCreateTable(const drizzled::identifier::Table &table_identifier)
110
111
 
111
112
bool Function::doDoesTableExist(Session&, const identifier::Table &identifier)
112
113
{
113
 
  drizzled::plugin::TableFunction *function= getFunction(identifier.getPath());
114
 
 
115
 
  if (function)
116
 
    return true;
117
 
 
118
 
  return false;
 
114
  return getFunction(identifier.getPath());
119
115
}
120
116
 
121
117
 
122
118
void Function::doGetTableIdentifiers(drizzled::CachedDirectory&,
123
119
                                     const drizzled::identifier::Schema &schema_identifier,
124
 
                                     drizzled::identifier::Table::vector &set_of_identifiers)
 
120
                                     drizzled::identifier::table::vector &set_of_identifiers)
125
121
{
126
122
  set<std::string> set_of_names;
127
123
  drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names);
128
124
 
129
 
  for (set<std::string>::iterator iter= set_of_names.begin(); iter != set_of_names.end(); iter++)
 
125
  BOOST_FOREACH(const std::string& iter, set_of_names)
130
126
  {
131
 
    set_of_identifiers.push_back(identifier::Table(schema_identifier, *iter, drizzled::message::Table::FUNCTION));
 
127
    set_of_identifiers.push_back(identifier::Table(schema_identifier, iter, drizzled::message::Table::FUNCTION));
132
128
  }
133
129
}
134
130