1273.13.1
by Brian Aker
First pass through data dictionary. |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2010 Sun Microsystems, Inc.
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
21 |
#include <config.h> |
2318.6.65
by Olaf van der Spek
Refactor |
22 |
#include <boost/foreach.hpp> |
1273.13.55
by Brian Aker
Naming fixes. |
23 |
#include <plugin/function_engine/function.h> |
24 |
#include <plugin/function_engine/cursor.h> |
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
25 |
#include <string> |
26 |
||
27 |
using namespace std; |
|
28 |
using namespace drizzled; |
|
29 |
||
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
30 |
Function::Function(const std::string &name_arg) : |
1273.13.1
by Brian Aker
First pass through data dictionary. |
31 |
drizzled::plugin::StorageEngine(name_arg, |
32 |
HTON_ALTER_NOT_SUPPORTED | |
|
1273.19.30
by Brian Aker
Performance patch... we now only cycle through engines that actually have |
33 |
HTON_HAS_SCHEMA_DICTIONARY | |
1273.13.1
by Brian Aker
First pass through data dictionary. |
34 |
HTON_SKIP_STORE_LOCK | |
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
35 |
HTON_TEMPORARY_NOT_SUPPORTED), |
2318.6.65
by Olaf van der Spek
Refactor |
36 |
information_message(new message::Schema), |
37 |
data_dictionary_message(new message::Schema) |
|
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
38 |
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
39 |
{
|
2114.3.3
by Brian Aker
Fix for show schemas to user generator correctly for output. |
40 |
information_message->set_name(INFORMATION_SCHEMA_IDENTIFIER.getSchemaName()); |
2168.3.2
by Brian Aker
CREATE TABLE/SCHEMA now allow you to add REPLICATION to the list of items |
41 |
information_message->set_collation("utf8_general_ci"); |
2187.7.6
by Brian Aker
This fixes the message such that the table inherits the no replication |
42 |
message::set_is_replicated(*information_message, false); |
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
43 |
|
2114.3.3
by Brian Aker
Fix for show schemas to user generator correctly for output. |
44 |
data_dictionary_message->set_name(DATA_DICTIONARY_IDENTIFIER.getSchemaName()); |
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
45 |
data_dictionary_message->set_collation("utf8_general_ci"); |
2187.7.6
by Brian Aker
This fixes the message such that the table inherits the no replication |
46 |
message::set_is_replicated(*data_dictionary_message, false); |
1273.13.1
by Brian Aker
First pass through data dictionary. |
47 |
}
|
48 |
||
49 |
||
1869.1.4
by Brian Aker
TableShare is no longer in the house (i.e. we no longer directly have a copy |
50 |
Cursor *Function::create(Table &table) |
1273.13.1
by Brian Aker
First pass through data dictionary. |
51 |
{
|
1680.6.1
by Brian Aker
Remove call for using special new for a cursor. |
52 |
return new FunctionCursor(*this, table); |
1273.13.1
by Brian Aker
First pass through data dictionary. |
53 |
}
|
54 |
||
1273.13.18
by Brian Aker
Update code, first pass through cleaner method for recursing through |
55 |
int Function::doGetTableDefinition(Session &, |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
56 |
const identifier::Table &identifier, |
1358.1.1
by Brian Aker
Fixes regression in performance from Exists patch. |
57 |
message::Table &table_proto) |
1273.13.1
by Brian Aker
First pass through data dictionary. |
58 |
{
|
1669.3.3
by Brian Aker
Remove the need for tolower in retrieval of table functions. |
59 |
drizzled::plugin::TableFunction *function= getFunction(identifier.getPath()); |
1273.13.6
by Brian Aker
Updates for interface/etc. |
60 |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
61 |
if (not function) |
1273.13.6
by Brian Aker
Updates for interface/etc. |
62 |
{
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
63 |
return ENOENT; |
64 |
}
|
|
65 |
||
1354.1.1
by Brian Aker
Modify ptr to reference. |
66 |
function->define(table_proto); |
1273.13.6
by Brian Aker
Updates for interface/etc. |
67 |
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
68 |
return EEXIST; |
69 |
}
|
|
70 |
||
2252.1.9
by Olaf van der Spek
Common fwd |
71 |
void Function::doGetSchemaIdentifiers(identifier::schema::vector& schemas) |
1415
by Brian Aker
Mass overhaul to use schema_identifier. |
72 |
{
|
73 |
schemas.push_back(INFORMATION_SCHEMA_IDENTIFIER); |
|
74 |
schemas.push_back(DATA_DICTIONARY_IDENTIFIER); |
|
75 |
}
|
|
76 |
||
2159.2.2
by Brian Aker
Remove additional spot where we passed in a reference of a shared pointer. |
77 |
drizzled::message::schema::shared_ptr Function::doGetSchemaDefinition(const identifier::Schema &schema_identifier) |
1415
by Brian Aker
Mass overhaul to use schema_identifier. |
78 |
{
|
2159.2.2
by Brian Aker
Remove additional spot where we passed in a reference of a shared pointer. |
79 |
drizzled::message::schema::shared_ptr schema_message; |
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
80 |
|
1999.2.1
by Brian Aker
Merge in identifier work. |
81 |
if (schema_identifier == INFORMATION_SCHEMA_IDENTIFIER) |
1273.19.23
by Brian Aker
Updated meta calls for data_dictionary |
82 |
{
|
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
83 |
schema_message= information_message; |
1273.19.23
by Brian Aker
Updated meta calls for data_dictionary |
84 |
}
|
1999.2.1
by Brian Aker
Merge in identifier work. |
85 |
else if (schema_identifier == DATA_DICTIONARY_IDENTIFIER) |
1273.19.23
by Brian Aker
Updated meta calls for data_dictionary |
86 |
{
|
1812.3.8
by Brian Aker
This switches our schema system over to using a shared ptr. Lets see how |
87 |
schema_message= data_dictionary_message; |
1273.19.23
by Brian Aker
Updated meta calls for data_dictionary |
88 |
}
|
89 |
else
|
|
90 |
{
|
|
2159.2.2
by Brian Aker
Remove additional spot where we passed in a reference of a shared pointer. |
91 |
return drizzled::message::schema::shared_ptr(); |
1273.19.23
by Brian Aker
Updated meta calls for data_dictionary |
92 |
}
|
93 |
||
2159.2.2
by Brian Aker
Remove additional spot where we passed in a reference of a shared pointer. |
94 |
return schema_message; |
1273.19.22
by Brian Aker
Shuffled information_schema; |
95 |
}
|
96 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
97 |
bool Function::doCanCreateTable(const drizzled::identifier::Table &table_identifier) |
1320.1.8
by Brian Aker
Temporary fix for allowing engines to say "don't do this". |
98 |
{
|
2087.4.1
by Brian Aker
Merge in schema identifier. |
99 |
if (static_cast<const identifier::Schema&>(table_identifier) == INFORMATION_SCHEMA_IDENTIFIER) |
1320.1.8
by Brian Aker
Temporary fix for allowing engines to say "don't do this". |
100 |
{
|
101 |
return false; |
|
102 |
}
|
|
103 |
||
2087.4.1
by Brian Aker
Merge in schema identifier. |
104 |
else if (static_cast<const identifier::Schema&>(table_identifier) == DATA_DICTIONARY_IDENTIFIER) |
1320.1.8
by Brian Aker
Temporary fix for allowing engines to say "don't do this". |
105 |
{
|
106 |
return false; |
|
107 |
}
|
|
108 |
||
109 |
return true; |
|
110 |
}
|
|
111 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
112 |
bool Function::doDoesTableExist(Session&, const identifier::Table &identifier) |
1358.1.1
by Brian Aker
Fixes regression in performance from Exists patch. |
113 |
{
|
2318.6.65
by Olaf van der Spek
Refactor |
114 |
return getFunction(identifier.getPath()); |
1358.1.1
by Brian Aker
Fixes regression in performance from Exists patch. |
115 |
}
|
116 |
||
1273.13.1
by Brian Aker
First pass through data dictionary. |
117 |
|
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
118 |
void Function::doGetTableIdentifiers(drizzled::CachedDirectory&, |
2087.4.1
by Brian Aker
Merge in schema identifier. |
119 |
const drizzled::identifier::Schema &schema_identifier, |
2252.1.9
by Olaf van der Spek
Common fwd |
120 |
drizzled::identifier::table::vector &set_of_identifiers) |
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
121 |
{
|
1976.5.2
by Brian Aker
This resolves the issue where one thread may be looking at schema while |
122 |
set<std::string> set_of_names; |
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
123 |
drizzled::plugin::TableFunction::getNames(schema_identifier.getSchemaName(), set_of_names); |
124 |
||
2318.6.65
by Olaf van der Spek
Refactor |
125 |
BOOST_FOREACH(const std::string& iter, set_of_names) |
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
126 |
{
|
2318.6.65
by Olaf van der Spek
Refactor |
127 |
set_of_identifiers.push_back(identifier::Table(schema_identifier, iter, drizzled::message::Table::FUNCTION)); |
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
128 |
}
|
129 |
}
|
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
130 |
|
1530.2.6
by Monty Taylor
Moved plugin::Context to module::Context. |
131 |
static int init(drizzled::module::Context &context) |
1273.13.1
by Brian Aker
First pass through data dictionary. |
132 |
{
|
1429.1.3
by Brian Aker
Merge in work for fetching a list of table identifiers. |
133 |
context.add(new Function("FunctionEngine")); |
1273.13.36
by Brian Aker
Adding support for LOCAL_TABLE_NAMES and SCHEMA_NAMES |
134 |
|
1273.13.1
by Brian Aker
First pass through data dictionary. |
135 |
return 0; |
136 |
}
|
|
137 |
||
138 |
DRIZZLE_DECLARE_PLUGIN
|
|
139 |
{
|
|
140 |
DRIZZLE_VERSION_ID, |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
141 |
"FunctionEngine", |
1273.13.1
by Brian Aker
First pass through data dictionary. |
142 |
"1.0", |
143 |
"Brian Aker", |
|
1273.13.32
by Brian Aker
Big ole patch. This covers moving information_schema to old_* table names |
144 |
"Function Engine provides the infrastructure for Table Functions,etc.", |
1273.13.1
by Brian Aker
First pass through data dictionary. |
145 |
PLUGIN_LICENSE_GPL, |
146 |
init, /* Plugin Init */ |
|
2095.3.1
by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list. |
147 |
NULL, /* depends */ |
1273.13.1
by Brian Aker
First pass through data dictionary. |
148 |
NULL /* config options */ |
149 |
}
|
|
150 |
DRIZZLE_DECLARE_PLUGIN_END; |