Merge lp:~stewart/drizzle/new-catalog-work into lp:drizzle
- new-catalog-work
- Merge into 7.2
Proposed by
Stewart Smith
Status: | Merged |
---|---|
Approved by: | Brian Aker |
Approved revision: | 2577 |
Merged at revision: | 2574 |
Proposed branch: | lp:~stewart/drizzle/new-catalog-work |
Merge into: | lp:drizzle |
Diff against target: |
1836 lines (+368/-208) 48 files modified
drizzled/catalog/instance.h (+14/-3) drizzled/cursor.cc (+1/-1) drizzled/identifier/catalog.h (+1/-1) drizzled/identifier/constants/schema.cc (+3/-1) drizzled/identifier/schema.cc (+7/-5) drizzled/identifier/schema.h (+9/-1) drizzled/identifier/table.cc (+14/-11) drizzled/identifier/table.h (+6/-4) drizzled/locking/global.cc (+4/-1) drizzled/message/schema.cc (+9/-18) drizzled/message/schema.h (+1/-2) drizzled/plugin/storage_engine.cc (+5/-3) drizzled/plugin/table_function.h (+4/-1) drizzled/schema.cc (+5/-3) drizzled/session.cc (+2/-2) drizzled/show.cc (+14/-5) drizzled/sql_base.cc (+18/-7) drizzled/sql_load.cc (+2/-1) drizzled/sql_parse.cc (+2/-2) drizzled/sql_table.cc (+16/-9) drizzled/sql_table.h (+1/-1) drizzled/statement/alter_schema.cc (+6/-3) drizzled/statement/alter_table.cc (+27/-12) drizzled/statement/change_schema.cc (+3/-1) drizzled/statement/create_index.cc (+14/-4) drizzled/statement/create_schema.cc (+4/-2) drizzled/statement/create_table.cc (+5/-2) drizzled/statement/drop_index.cc (+14/-4) drizzled/statement/drop_schema.cc (+3/-1) drizzled/statement/rename_table.cc (+7/-2) drizzled/table/concurrent.cc (+5/-1) drizzled/table/instance/base.cc (+24/-26) drizzled/table/instance/base.h (+10/-6) drizzled/table/singular.cc (+2/-4) plugin/innobase/handler/ha_innodb.cc (+5/-2) plugin/memory/ha_heap.cc (+1/-3) plugin/schema_engine/schema.cc (+41/-8) plugin/schema_engine/schema.h (+1/-0) plugin/show_dictionary/show_columns.cc (+3/-1) plugin/show_dictionary/show_create_schema.cc (+2/-1) plugin/show_dictionary/show_create_table.cc (+3/-1) plugin/show_dictionary/show_indexes.cc (+3/-1) plugin/show_dictionary/show_tables.cc (+2/-1) plugin/show_schema_proto/show_schema_proto.cc (+6/-1) plugin/table_cache_dictionary/tests/r/table_cache.result (+2/-2) plugin/table_cache_dictionary/tests/r/table_definition_cache.result (+2/-2) tests/r/show_check.result (+28/-28) unittests/table_identifier.cc (+7/-7) |
To merge this branch: | bzr merge lp:~stewart/drizzle/new-catalog-work |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+114544@code.launchpad.net |
Commit message
Description of the change
This completes the behind the scenes catalog work. What is left is fixing up table functions to appear in catalogs other than local and providing a way to connect via TCP to a catalog other than LOCAL.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzled/catalog/instance.h' |
2 | --- drizzled/catalog/instance.h 2011-03-28 14:32:36 +0000 |
3 | +++ drizzled/catalog/instance.h 2012-07-12 00:07:29 +0000 |
4 | @@ -23,6 +23,8 @@ |
5 | #include <boost/thread/mutex.hpp> |
6 | #include <boost/make_shared.hpp> |
7 | |
8 | +#include <drizzled/identifier.h> |
9 | +#include <drizzled/identifier/catalog.h> |
10 | #include <drizzled/message/catalog.h> |
11 | |
12 | namespace drizzled { |
13 | @@ -32,7 +34,8 @@ |
14 | { |
15 | Instance() : |
16 | _locked(false), |
17 | - _lock_id(0) |
18 | + _lock_id(0), |
19 | + _identifier(str_ref("")) |
20 | { }; |
21 | |
22 | bool _locked; |
23 | @@ -40,6 +43,7 @@ |
24 | message::catalog::shared_ptr _message; |
25 | mutable boost::mutex _schema_lock; |
26 | mutable boost::mutex _system_variable_lock; |
27 | + drizzled::identifier::Catalog _identifier; |
28 | |
29 | |
30 | public: |
31 | @@ -49,12 +53,14 @@ |
32 | typedef const Instance& const_reference; |
33 | typedef Instance& reference; |
34 | |
35 | - Instance(message::catalog::shared_ptr &message_arg) |
36 | + Instance(message::catalog::shared_ptr &message_arg) : |
37 | + _identifier(message_arg->name()) |
38 | { |
39 | _message= message_arg; |
40 | }; |
41 | |
42 | - Instance(const message::catalog::shared_ptr &message_arg) |
43 | + Instance(const message::catalog::shared_ptr &message_arg) : |
44 | + _identifier(message_arg->name()) |
45 | { |
46 | _message= message_arg; |
47 | }; |
48 | @@ -72,6 +78,11 @@ |
49 | return boost::make_shared<Instance>(new_message); |
50 | } |
51 | |
52 | + const drizzled::identifier::Catalog &identifier() const |
53 | + { |
54 | + return _identifier; |
55 | + } |
56 | + |
57 | const std::string &getName() const |
58 | { |
59 | assert(_message); |
60 | |
61 | === modified file 'drizzled/cursor.cc' |
62 | --- drizzled/cursor.cc 2012-02-12 07:40:43 +0000 |
63 | +++ drizzled/cursor.cc 2012-07-12 00:07:29 +0000 |
64 | @@ -89,7 +89,7 @@ |
65 | when the clone Cursor object is destroyed. |
66 | */ |
67 | new_handler->ref= mem_root->alloc(ALIGN_SIZE(ref_length)*2); |
68 | - identifier::Table identifier(getTable()->getShare()->getSchemaName(), getTable()->getShare()->getTableName(), getTable()->getShare()->getType()); |
69 | + identifier::Table identifier(*getTable()); |
70 | return new_handler->ha_open(identifier, getTable()->getDBStat(), HA_OPEN_IGNORE_IF_LOCKED) ? NULL : new_handler; |
71 | } |
72 | |
73 | |
74 | === modified file 'drizzled/identifier/catalog.h' |
75 | --- drizzled/identifier/catalog.h 2011-12-27 06:49:23 +0000 |
76 | +++ drizzled/identifier/catalog.h 2012-07-12 00:07:29 +0000 |
77 | @@ -35,7 +35,7 @@ |
78 | namespace drizzled { |
79 | namespace identifier { |
80 | |
81 | -class Catalog : public Identifier |
82 | +class DRIZZLED_API Catalog : public Identifier |
83 | { |
84 | public: |
85 | Catalog(str_ref); |
86 | |
87 | === modified file 'drizzled/identifier/constants/schema.cc' |
88 | --- drizzled/identifier/constants/schema.cc 2012-04-23 02:17:12 +0000 |
89 | +++ drizzled/identifier/constants/schema.cc 2012-07-12 00:07:29 +0000 |
90 | @@ -20,6 +20,7 @@ |
91 | |
92 | #include <config.h> |
93 | #include <drizzled/identifier.h> |
94 | +#include <drizzled/catalog/local.h> |
95 | |
96 | namespace drizzled { |
97 | namespace identifier { |
98 | @@ -29,8 +30,9 @@ |
99 | class Schema : public identifier::Schema |
100 | { |
101 | public: |
102 | + /* FIXME: use a global identifier for catalog */ |
103 | Schema(const char* name) : |
104 | - identifier::Schema(str_ref(name)) |
105 | + identifier::Schema(drizzled::catalog::local_identifier(), str_ref(name)) |
106 | { |
107 | } |
108 | |
109 | |
110 | === modified file 'drizzled/identifier/schema.cc' |
111 | --- drizzled/identifier/schema.cc 2012-04-22 01:43:13 +0000 |
112 | +++ drizzled/identifier/schema.cc 2012-07-12 00:07:29 +0000 |
113 | @@ -41,8 +41,10 @@ |
114 | namespace drizzled { |
115 | namespace identifier { |
116 | |
117 | -Schema::Schema(str_ref db_arg) : |
118 | - db(db_arg.data(), db_arg.size()) |
119 | +Schema::Schema(const drizzled::identifier::Catalog &catalog_arg, |
120 | + str_ref db_arg) : |
121 | + db(db_arg.data(), db_arg.size()), |
122 | + _catalog(catalog_arg) |
123 | { |
124 | #if 0 |
125 | string::size_type lastPos= db.find_first_of('/', 0); |
126 | @@ -56,7 +58,7 @@ |
127 | |
128 | if (db_arg.empty() == false) |
129 | { |
130 | - db_path += drizzled::catalog::local_identifier().getPath(); |
131 | + db_path += _catalog.getPath(); |
132 | db_path += FN_LIBCHAR; |
133 | db_path += util::tablename_to_filename(db); |
134 | assert(db_path.length()); // TODO throw exception, this is a possibility |
135 | @@ -99,12 +101,12 @@ |
136 | |
137 | const std::string &Schema::getCatalogName() const |
138 | { |
139 | - return drizzled::catalog::local_identifier().name(); |
140 | + return _catalog.name(); |
141 | } |
142 | |
143 | std::ostream& operator<<(std::ostream& output, const Schema&identifier) |
144 | { |
145 | - return output << "identifier::Schema:(" << drizzled::catalog::local_identifier() << ", " << identifier.getSchemaName() << ", " << identifier.getPath() << ")"; |
146 | + return output << "identifier::Schema:(" << identifier.getCatalogName() << ", " << identifier.getSchemaName() << ", " << identifier.getPath() << ")"; |
147 | } |
148 | |
149 | } /* namespace identifier */ |
150 | |
151 | === modified file 'drizzled/identifier/schema.h' |
152 | --- drizzled/identifier/schema.h 2012-04-21 02:13:56 +0000 |
153 | +++ drizzled/identifier/schema.h 2012-07-12 00:07:29 +0000 |
154 | @@ -37,14 +37,17 @@ |
155 | namespace drizzled { |
156 | namespace identifier { |
157 | |
158 | +class Catalog; |
159 | + |
160 | class DRIZZLED_API Schema : public Identifier |
161 | { |
162 | std::string _corrected_db; |
163 | std::string db; |
164 | std::string db_path; |
165 | + drizzled::identifier::Catalog _catalog; |
166 | |
167 | public: |
168 | - Schema(str_ref); |
169 | + Schema(const drizzled::identifier::Catalog &catalog_arg, str_ref); |
170 | |
171 | virtual std::string getSQLPath() const |
172 | { |
173 | @@ -63,6 +66,11 @@ |
174 | return _corrected_db; |
175 | } |
176 | |
177 | + const drizzled::identifier::Catalog &getCatalog() const |
178 | + { |
179 | + return _catalog; |
180 | + } |
181 | + |
182 | const std::string &getCatalogName() const; |
183 | |
184 | virtual bool isValid() const; |
185 | |
186 | === modified file 'drizzled/identifier/table.cc' |
187 | --- drizzled/identifier/table.cc 2012-04-22 01:43:13 +0000 |
188 | +++ drizzled/identifier/table.cc 2012-07-12 00:07:29 +0000 |
189 | @@ -182,15 +182,16 @@ |
190 | path length on success, 0 on failure |
191 | */ |
192 | |
193 | -std::string Table::build_table_filename(const std::string &in_db, const std::string &in_table_name, bool is_tmp) |
194 | +std::string Table::build_table_filename(const identifier::Table &table_identifier, bool is_tmp) |
195 | { |
196 | - string in_path= drizzled::catalog::local_identifier().getPath(); |
197 | - in_path+= FN_LIBCHAR + util::tablename_to_filename(in_db) + FN_LIBCHAR; |
198 | - return in_path + (is_tmp ? in_table_name : util::tablename_to_filename(in_table_name)); |
199 | + string in_path= table_identifier.getCatalog().getPath(); |
200 | + in_path+= FN_LIBCHAR + util::tablename_to_filename(table_identifier.getSchemaName()) + FN_LIBCHAR; |
201 | + return in_path + (is_tmp ? table_identifier.getTableName() : util::tablename_to_filename(table_identifier.getTableName())); |
202 | } |
203 | |
204 | Table::Table(const drizzled::Table &table) : |
205 | - identifier::Schema(str_ref(table.getShare()->getSchemaName())), |
206 | + identifier::Schema(table.getShare()->getTableIdentifier().getCatalog(), |
207 | + str_ref(table.getShare()->getSchemaName())), |
208 | type(table.getShare()->getTableType()), |
209 | table_name(table.getShare()->getTableName()) |
210 | { |
211 | @@ -212,20 +213,22 @@ |
212 | init(); |
213 | } |
214 | |
215 | -Table::Table(const std::string &db_arg, |
216 | +Table::Table(const drizzled::identifier::Catalog &catalog, |
217 | + const std::string &db_arg, |
218 | const std::string &table_name_arg, |
219 | Type tmp_arg) : |
220 | - Schema(db_arg), |
221 | + Schema(catalog, db_arg), |
222 | type(tmp_arg), |
223 | table_name(table_name_arg) |
224 | { |
225 | init(); |
226 | } |
227 | |
228 | -Table::Table(const std::string &schema_name_arg, |
229 | +Table::Table(const drizzled::identifier::Catalog &catalog, |
230 | + const std::string &schema_name_arg, |
231 | const std::string &table_name_arg, |
232 | const std::string &path_arg ) : |
233 | - Schema(schema_name_arg), |
234 | + Schema(catalog, schema_name_arg), |
235 | type(message::Table::TEMPORARY), |
236 | path(path_arg), |
237 | table_name(table_name_arg) |
238 | @@ -240,12 +243,12 @@ |
239 | case message::Table::FUNCTION: |
240 | case message::Table::STANDARD: |
241 | assert(path.empty()); |
242 | - path= build_table_filename(getSchemaName(), table_name, false); |
243 | + path= build_table_filename(*this, false); |
244 | break; |
245 | |
246 | case message::Table::INTERNAL: |
247 | assert(path.empty()); |
248 | - path= build_table_filename(getSchemaName(), table_name, true); |
249 | + path= build_table_filename(*this, true); |
250 | break; |
251 | |
252 | case message::Table::TEMPORARY: |
253 | |
254 | === modified file 'drizzled/identifier/table.h' |
255 | --- drizzled/identifier/table.h 2012-04-21 02:13:56 +0000 |
256 | +++ drizzled/identifier/table.h 2012-07-12 00:07:29 +0000 |
257 | @@ -150,16 +150,18 @@ |
258 | public: |
259 | |
260 | Table(const drizzled::Table &table); |
261 | - |
262 | + |
263 | Table(const identifier::Schema &schema, |
264 | const std::string &table_name_arg, |
265 | Type tmp_arg= message::Table::STANDARD); |
266 | |
267 | - Table(const std::string &db_arg, |
268 | + Table(const drizzled::identifier::Catalog &catalog, |
269 | + const std::string &db_arg, |
270 | const std::string &table_name_arg, |
271 | Type tmp_arg= message::Table::STANDARD); |
272 | |
273 | - Table(const std::string &schema_name_arg, |
274 | + Table(const drizzled::identifier::Catalog &catalog, |
275 | + const std::string &schema_name_arg, |
276 | const std::string &table_name_arg, |
277 | const std::string &path_arg ); |
278 | |
279 | @@ -238,7 +240,7 @@ |
280 | } |
281 | |
282 | static uint32_t filename_to_tablename(const char *from, char *to, uint32_t to_length); |
283 | - static std::string build_table_filename(const std::string &db, const std::string &table_name, bool is_tmp); |
284 | + static std::string build_table_filename(const drizzled::identifier::Table&, bool is_tmp); |
285 | static std::string build_tmptable_filename(); |
286 | |
287 | public: |
288 | |
289 | === modified file 'drizzled/locking/global.cc' |
290 | --- drizzled/locking/global.cc 2011-06-27 15:25:23 +0000 |
291 | +++ drizzled/locking/global.cc 2012-07-12 00:07:29 +0000 |
292 | @@ -93,6 +93,7 @@ |
293 | #include <drizzled/util/test.h> |
294 | #include <drizzled/open_tables_state.h> |
295 | #include <drizzled/table/cache.h> |
296 | +#include <drizzled/catalog/instance.h> |
297 | |
298 | #include <set> |
299 | #include <vector> |
300 | @@ -618,7 +619,9 @@ |
301 | |
302 | int Session::lock_table_name(TableList *table_list) |
303 | { |
304 | - identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName()); |
305 | + identifier::Table identifier(catalog().identifier(), |
306 | + table_list->getSchemaName(), |
307 | + table_list->getTableName()); |
308 | { |
309 | /* Only insert the table if we haven't insert it already */ |
310 | table::CacheRange ppp= table::getCache().equal_range(identifier.getKey()); |
311 | |
312 | === modified file 'drizzled/message/schema.cc' |
313 | --- drizzled/message/schema.cc 2011-04-20 22:18:30 +0000 |
314 | +++ drizzled/message/schema.cc 2012-07-12 00:07:29 +0000 |
315 | @@ -38,24 +38,15 @@ |
316 | { |
317 | shared_ptr shared(new message::Schema); |
318 | |
319 | - init(*shared, identifier.getSchemaName()); |
320 | - |
321 | - return shared; |
322 | -} |
323 | - |
324 | -shared_ptr make_shared(const std::string &name_arg) |
325 | -{ |
326 | - shared_ptr shared(new message::Schema); |
327 | - |
328 | - init(*shared, name_arg); |
329 | - |
330 | - return shared; |
331 | -} |
332 | - |
333 | -void init(drizzled::message::Schema &arg, const std::string &name_arg) |
334 | -{ |
335 | - arg.set_name(name_arg); |
336 | - arg.set_catalog(drizzled::catalog::local()->name()); |
337 | + init(*shared, identifier); |
338 | + |
339 | + return shared; |
340 | +} |
341 | + |
342 | +void init(drizzled::message::Schema &arg, const drizzled::identifier::Schema &identifier) |
343 | +{ |
344 | + arg.set_name(identifier.getSchemaName()); |
345 | + arg.set_catalog(identifier.getCatalogName()); |
346 | arg.mutable_engine()->set_name(std::string("filesystem")); // For the moment we have only one. |
347 | arg.set_creation_timestamp(time(NULL)); |
348 | arg.set_update_timestamp(time(NULL)); |
349 | |
350 | === modified file 'drizzled/message/schema.h' |
351 | --- drizzled/message/schema.h 2011-03-23 23:44:48 +0000 |
352 | +++ drizzled/message/schema.h 2012-07-12 00:07:29 +0000 |
353 | @@ -35,8 +35,7 @@ |
354 | typedef const message::Schema const_reference; |
355 | |
356 | shared_ptr make_shared(const identifier::Schema& identifier); |
357 | -shared_ptr make_shared(const std::string &name_arg); |
358 | -void init(drizzled::message::Schema &arg, const std::string &name_arg); |
359 | +void init(drizzled::message::Schema &arg, const drizzled::identifier::Schema &identifier); |
360 | |
361 | |
362 | } // namespace schema |
363 | |
364 | === modified file 'drizzled/plugin/storage_engine.cc' |
365 | --- drizzled/plugin/storage_engine.cc 2012-02-12 06:45:37 +0000 |
366 | +++ drizzled/plugin/storage_engine.cc 2012-07-12 00:07:29 +0000 |
367 | @@ -547,7 +547,10 @@ |
368 | message::Table definition; |
369 | if (StorageEngine::readTableFile(path, definition)) |
370 | { |
371 | - identifier::Table identifier(definition.schema(), definition.name(), path); |
372 | + identifier::Table identifier(identifier::Catalog(definition.catalog()), |
373 | + definition.schema(), |
374 | + definition.name(), |
375 | + path); |
376 | table_identifiers.push_back(identifier); |
377 | } |
378 | } |
379 | @@ -733,8 +736,7 @@ |
380 | break; |
381 | case HA_ERR_NO_SUCH_TABLE: |
382 | { |
383 | - identifier::Table identifier(table.getShare()->getSchemaName(), table.getShare()->getTableName()); |
384 | - my_error(ER_TABLE_UNKNOWN, identifier); |
385 | + my_error(ER_TABLE_UNKNOWN, table.getShare()->getTableIdentifier()); |
386 | return; |
387 | } |
388 | case HA_ERR_LOG_ROW_FOR_REPLICATION_FAILED: |
389 | |
390 | === modified file 'drizzled/plugin/table_function.h' |
391 | --- drizzled/plugin/table_function.h 2011-08-14 17:04:01 +0000 |
392 | +++ drizzled/plugin/table_function.h 2012-07-12 00:07:29 +0000 |
393 | @@ -29,6 +29,7 @@ |
394 | #include <drizzled/message/table.pb.h> |
395 | #include <drizzled/charset.h> |
396 | #include <drizzled/field.h> |
397 | +#include <drizzled/catalog/local.h> |
398 | |
399 | #include <string> |
400 | #include <set> |
401 | @@ -67,9 +68,11 @@ |
402 | void init(); |
403 | |
404 | public: |
405 | + /* FIXME: should use a universal catalog identifier */ |
406 | TableFunction(const char *schema_arg, const char *table_arg) : |
407 | Plugin(local_string_append(schema_arg, table_arg) , "TableFunction"), |
408 | - identifier(schema_arg, table_arg), |
409 | + identifier(drizzled::catalog::local_identifier(), |
410 | + schema_arg, table_arg), |
411 | original_table_label(table_arg) |
412 | { |
413 | init(); |
414 | |
415 | === modified file 'drizzled/schema.cc' |
416 | --- drizzled/schema.cc 2011-08-05 12:55:59 +0000 |
417 | +++ drizzled/schema.cc 2012-07-12 00:07:29 +0000 |
418 | @@ -98,8 +98,9 @@ |
419 | { |
420 | boost::mutex::scoped_lock scopedLock(session.catalog().schemaLock()); |
421 | |
422 | - // Check to see if it exists already. |
423 | - identifier::Schema schema_identifier(schema_message.name()); |
424 | + // Check to see if it exists already. |
425 | + identifier::Schema schema_identifier(session.catalog().identifier(), |
426 | + schema_message.name()); |
427 | if (plugin::StorageEngine::doesSchemaExist(schema_identifier)) |
428 | { |
429 | if (not is_if_not_exists) |
430 | @@ -157,7 +158,8 @@ |
431 | { |
432 | boost::mutex::scoped_lock scopedLock(session.catalog().schemaLock()); |
433 | |
434 | - identifier::Schema schema_idenifier(schema_message.name()); |
435 | + identifier::Schema schema_idenifier(session.catalog().identifier(), |
436 | + schema_message.name()); |
437 | if (not plugin::StorageEngine::doesSchemaExist(schema_idenifier)) |
438 | { |
439 | my_error(ER_SCHEMA_DOES_NOT_EXIST, schema_idenifier); |
440 | |
441 | === modified file 'drizzled/session.cc' |
442 | --- drizzled/session.cc 2012-05-31 15:20:57 +0000 |
443 | +++ drizzled/session.cc 2012-07-12 00:07:29 +0000 |
444 | @@ -666,7 +666,7 @@ |
445 | } |
446 | |
447 | /* Change database if necessary */ |
448 | - if (not in_db.empty() && schema::change(*this, identifier::Schema(in_db))) |
449 | + if (not in_db.empty() && schema::change(*this, identifier::Schema(catalog().identifier(), in_db))) |
450 | return false; // change() has pushed the error message |
451 | my_ok(); |
452 | |
453 | @@ -1640,7 +1640,7 @@ |
454 | plugin::StorageEngine& table_type= *table->getShare()->db_type(); |
455 | table->free_io_cache(); |
456 | table->delete_table(); |
457 | - rm_temporary_table(table_type, identifier::Table(table->getShare()->getSchemaName(), table->getShare()->getTableName(), table->getShare()->getPath())); |
458 | + rm_temporary_table(table_type, identifier::Table(table->getShare()->getTableIdentifier().getCatalog(), table->getShare()->getSchemaName(), table->getShare()->getTableName(), table->getShare()->getPath())); |
459 | boost::checked_delete(table->getMutableShare()); |
460 | boost::checked_delete(table); |
461 | } |
462 | |
463 | === modified file 'drizzled/show.cc' |
464 | --- drizzled/show.cc 2012-03-14 19:16:59 +0000 |
465 | +++ drizzled/show.cc 2012-07-12 00:07:29 +0000 |
466 | @@ -34,6 +34,7 @@ |
467 | #include <drizzled/statement/show_warnings.h> |
468 | #include <drizzled/sql_lex.h> |
469 | #include <drizzled/table_ident.h> |
470 | +#include <drizzled/catalog/instance.h> |
471 | |
472 | #include <sys/stat.h> |
473 | |
474 | @@ -116,7 +117,8 @@ |
475 | util::string::ptr schema(session->schema()); |
476 | if (ident) |
477 | { |
478 | - identifier::Schema identifier= str_ref(ident); |
479 | + identifier::Schema identifier(session->catalog().identifier(), |
480 | + str_ref(ident)); |
481 | column_name.append(ident); |
482 | session->lex().select_lex.db= ident; |
483 | if (not plugin::StorageEngine::doesSchemaExist(identifier)) |
484 | @@ -182,7 +184,8 @@ |
485 | { |
486 | session->lex().select_lex.db= ident; |
487 | |
488 | - identifier::Schema identifier= str_ref(ident); |
489 | + identifier::Schema identifier(session->catalog().identifier(), |
490 | + str_ref(ident)); |
491 | if (not plugin::StorageEngine::doesSchemaExist(identifier)) |
492 | { |
493 | my_error(ER_BAD_DB_ERROR, identifier); |
494 | @@ -245,7 +248,9 @@ |
495 | } |
496 | |
497 | { |
498 | - drizzled::identifier::Table identifier(select->getShowSchema(), table_ident->table.data()); |
499 | + drizzled::identifier::Table identifier(session->catalog().identifier(), |
500 | + select->getShowSchema(), |
501 | + table_ident->table.data()); |
502 | if (not plugin::StorageEngine::doesTableExist(*session, identifier)) |
503 | { |
504 | my_error(ER_TABLE_UNKNOWN, identifier); |
505 | @@ -308,7 +313,9 @@ |
506 | } |
507 | |
508 | { |
509 | - drizzled::identifier::Table identifier(select->getShowSchema(), table_ident->table.data()); |
510 | + drizzled::identifier::Table identifier(session->catalog().identifier(), |
511 | + select->getShowSchema(), |
512 | + table_ident->table.data()); |
513 | if (not plugin::StorageEngine::doesTableExist(*session, identifier)) |
514 | { |
515 | my_error(ER_TABLE_UNKNOWN, identifier); |
516 | @@ -483,7 +490,9 @@ |
517 | } |
518 | |
519 | { |
520 | - drizzled::identifier::Table identifier(select->getShowSchema(), ident->table.data()); |
521 | + drizzled::identifier::Table identifier(session->catalog().identifier(), |
522 | + select->getShowSchema(), |
523 | + ident->table.data()); |
524 | if (not plugin::StorageEngine::doesTableExist(*session, identifier)) |
525 | { |
526 | my_error(ER_TABLE_UNKNOWN, identifier); |
527 | |
528 | === modified file 'drizzled/sql_base.cc' |
529 | --- drizzled/sql_base.cc 2011-11-09 20:20:23 +0000 |
530 | +++ drizzled/sql_base.cc 2012-07-12 00:07:29 +0000 |
531 | @@ -106,7 +106,7 @@ |
532 | This has to be done to ensure that the table share is removed from |
533 | the table defintion cache as soon as the last instance is removed |
534 | */ |
535 | - identifier::Table identifier(table->getShare()->getSchemaName(), table->getShare()->getTableName(), message::Table::INTERNAL); |
536 | + identifier::Table identifier(table->getShare()->getTableIdentifier().getCatalog(), table->getShare()->getSchemaName(), table->getShare()->getTableName(), message::Table::INTERNAL); |
537 | TableShare *share= new TableShare(identifier.getType(), identifier, identifier.getKey().vector(), static_cast<uint32_t>(table->getShare()->getCacheKeySize())); |
538 | |
539 | table->cursor->close(); |
540 | @@ -174,7 +174,7 @@ |
541 | bool found= false; |
542 | for (TableList *table= tables; table; table= table->next_local) |
543 | { |
544 | - if (table::Cache::removeTable(*session, identifier::Table(table->getSchemaName(), table->getTableName()), RTFC_OWNED_BY_Session_FLAG)) |
545 | + if (table::Cache::removeTable(*session, identifier::Table(catalog().identifier(), table->getSchemaName(), table->getTableName()), RTFC_OWNED_BY_Session_FLAG)) |
546 | { |
547 | found= true; |
548 | } |
549 | @@ -473,7 +473,8 @@ |
550 | { |
551 | if (schema_identifier.compare(table->getShare()->getSchemaName())) |
552 | { |
553 | - set_of_identifiers.push_back(identifier::Table(table->getShare()->getSchemaName(), |
554 | + set_of_identifiers.push_back(identifier::Table(table->getShare()->getTableIdentifier().getCatalog(), |
555 | + table->getShare()->getSchemaName(), |
556 | table->getShare()->getTableName(), |
557 | table->getShare()->getPath())); |
558 | } |
559 | @@ -725,7 +726,10 @@ |
560 | /* |
561 | Create a table entry with the right key and with an old refresh version |
562 | */ |
563 | - identifier::Table identifier(arg.getSchemaName(), arg.getTableName(), message::Table::INTERNAL); |
564 | + identifier::Table identifier(catalog().identifier(), |
565 | + arg.getSchemaName(), |
566 | + arg.getTableName(), |
567 | + message::Table::INTERNAL); |
568 | table::Placeholder* table= new table::Placeholder(this, identifier); |
569 | table::Cache::insert(table); |
570 | return *table; |
571 | @@ -824,7 +828,9 @@ |
572 | return NULL; |
573 | } |
574 | |
575 | - identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName()); |
576 | + identifier::Table identifier(catalog().identifier(), |
577 | + table_list->getSchemaName(), |
578 | + table_list->getTableName()); |
579 | const identifier::Table::Key &key(identifier.getKey()); |
580 | table::CacheRange ppp; |
581 | |
582 | @@ -1020,7 +1026,10 @@ |
583 | |
584 | if (table_list->isCreate()) |
585 | { |
586 | - identifier::Table lock_table_identifier(table_list->getSchemaName(), table_list->getTableName(), message::Table::STANDARD); |
587 | + identifier::Table lock_table_identifier(catalog().identifier(), |
588 | + table_list->getSchemaName(), |
589 | + table_list->getTableName(), |
590 | + message::Table::STANDARD); |
591 | |
592 | if (not plugin::StorageEngine::doesTableExist(*this, lock_table_identifier)) |
593 | { |
594 | @@ -1480,7 +1489,9 @@ |
595 | * to see if it exists so that an unauthorized user cannot phish for |
596 | * table/schema information via error messages |
597 | */ |
598 | - identifier::Table the_table(tables->getSchemaName(), tables->getTableName()); |
599 | + identifier::Table the_table(catalog().identifier(), |
600 | + tables->getSchemaName(), |
601 | + tables->getTableName()); |
602 | if (not plugin::Authorization::isAuthorized(*user(), the_table)) |
603 | { |
604 | result= -1; // Fatal error |
605 | |
606 | === modified file 'drizzled/sql_load.cc' |
607 | --- drizzled/sql_load.cc 2012-02-12 08:30:54 +0000 |
608 | +++ drizzled/sql_load.cc 2012-07-12 00:07:29 +0000 |
609 | @@ -325,7 +325,8 @@ |
610 | info.handle_duplicates=handle_duplicates; |
611 | info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX; |
612 | |
613 | - identifier::Schema identifier(*schema); |
614 | + identifier::Schema identifier(session->catalog().identifier(), |
615 | + *schema); |
616 | READ_INFO read_info(file, tot_length, |
617 | ex->cs ? ex->cs : plugin::StorageEngine::getSchemaCollation(identifier), |
618 | *field_term, *ex->line_start, *ex->line_term, *enclosed, |
619 | |
620 | === modified file 'drizzled/sql_parse.cc' |
621 | --- drizzled/sql_parse.cc 2012-05-31 15:20:57 +0000 |
622 | +++ drizzled/sql_parse.cc 2012-07-12 00:07:29 +0000 |
623 | @@ -225,7 +225,7 @@ |
624 | my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); |
625 | break; |
626 | } |
627 | - if (not schema::change(session, identifier::Schema(packet))) |
628 | + if (not schema::change(session, identifier::Schema(session.catalog().identifier(), packet))) |
629 | { |
630 | session.my_ok(); |
631 | } |
632 | @@ -906,7 +906,7 @@ |
633 | if (not table->is_derived_table() && table->db.data()) |
634 | { |
635 | files_charset_info->casedn_str(table->db.str_); |
636 | - if (not schema::check(*session, identifier::Schema(table->db))) |
637 | + if (not schema::check(*session, identifier::Schema(session->catalog().identifier(), table->db))) |
638 | { |
639 | my_error(ER_WRONG_DB_NAME, MYF(0), table->db.data()); |
640 | return NULL; |
641 | |
642 | === modified file 'drizzled/sql_table.cc' |
643 | --- drizzled/sql_table.cc 2012-03-05 06:00:54 +0000 |
644 | +++ drizzled/sql_table.cc 2012-07-12 00:07:29 +0000 |
645 | @@ -65,7 +65,7 @@ |
646 | static const char *make_unique_key_name(const char *field_name,KeyInfo *start,KeyInfo *end); |
647 | static bool prepare_blob_field(Session *session, CreateField *sql_field); |
648 | |
649 | -void set_table_default_charset(HA_CREATE_INFO *create_info, const char *db) |
650 | +void set_table_default_charset(const identifier::Catalog &catalog, HA_CREATE_INFO *create_info, const char *db) |
651 | { |
652 | /* |
653 | If the table character set was not given explicitly, |
654 | @@ -73,7 +73,7 @@ |
655 | apply it to the table. |
656 | */ |
657 | if (not create_info->default_table_charset) |
658 | - create_info->default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier::Schema(str_ref(db))); |
659 | + create_info->default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier::Schema(catalog, str_ref(db))); |
660 | } |
661 | |
662 | /* |
663 | @@ -125,7 +125,9 @@ |
664 | |
665 | for (table= tables; table; table= table->next_local) |
666 | { |
667 | - identifier::Table tmp_identifier(table->getSchemaName(), table->getTableName()); |
668 | + identifier::Table tmp_identifier(session->catalog().identifier(), |
669 | + table->getSchemaName(), |
670 | + table->getTableName()); |
671 | |
672 | error= session->open_tables.drop_temporary_table(tmp_identifier); |
673 | |
674 | @@ -159,7 +161,10 @@ |
675 | break; |
676 | } |
677 | } |
678 | - identifier::Table identifier(table->getSchemaName(), table->getTableName(), table->getInternalTmpTable() ? message::Table::INTERNAL : message::Table::STANDARD); |
679 | + identifier::Table identifier(session->catalog().identifier(), |
680 | + table->getSchemaName(), |
681 | + table->getTableName(), |
682 | + table->getInternalTmpTable() ? message::Table::INTERNAL : message::Table::STANDARD); |
683 | |
684 | message::table::shared_ptr message= plugin::StorageEngine::getTableMessage(*session, identifier, true); |
685 | |
686 | @@ -1406,7 +1411,7 @@ |
687 | assert(identifier.getTableName() == table_proto.name()); |
688 | db_options= create_info->table_options; |
689 | |
690 | - set_table_default_charset(create_info, identifier.getSchemaName().c_str()); |
691 | + set_table_default_charset(session->catalog().identifier(),create_info, identifier.getSchemaName().c_str()); |
692 | |
693 | /* Build a Table object to pass down to the engine, and the do the actual create. */ |
694 | if (not prepare_create_table(session, create_info, table_proto, alter_info, |
695 | @@ -1639,7 +1644,7 @@ |
696 | session->abortLock(table); /* end threads waiting on lock */ |
697 | |
698 | /* Wait until all there are no other threads that has this table open */ |
699 | - identifier::Table identifier(table->getShare()->getSchemaName(), table->getShare()->getTableName()); |
700 | + identifier::Table identifier(session->catalog().identifier(),table->getShare()->getSchemaName(), table->getShare()->getTableName()); |
701 | table::Cache::removeTable(*session, identifier, RTFC_WAIT_OTHER_THREAD_FLAG); |
702 | } |
703 | |
704 | @@ -1711,7 +1716,7 @@ |
705 | |
706 | for (table= tables; table; table= table->next_local) |
707 | { |
708 | - identifier::Table table_identifier(table->getSchemaName(), table->getTableName()); |
709 | + identifier::Table table_identifier(session->catalog().identifier(), table->getSchemaName(), table->getTableName()); |
710 | bool fatal_error=0; |
711 | |
712 | std::string table_name = table_identifier.getSQLPath(); |
713 | @@ -1785,7 +1790,7 @@ |
714 | const char *old_message=session->enter_cond(COND_refresh, table::Cache::mutex(), |
715 | "Waiting to get writelock"); |
716 | session->abortLock(table->table); |
717 | - identifier::Table identifier(table->table->getShare()->getSchemaName(), table->table->getShare()->getTableName()); |
718 | + identifier::Table identifier(session->catalog().identifier(),table->table->getShare()->getSchemaName(), table->table->getShare()->getTableName()); |
719 | table::Cache::removeTable(*session, identifier, RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG); |
720 | session->exit_cond(old_message); |
721 | if (session->getKilled()) |
722 | @@ -1884,7 +1889,9 @@ |
723 | else |
724 | { |
725 | boost::unique_lock<boost::mutex> lock(table::Cache::mutex()); |
726 | - identifier::Table identifier(table->table->getShare()->getSchemaName(), table->table->getShare()->getTableName()); |
727 | + identifier::Table identifier(session->catalog().identifier(), |
728 | + table->table->getShare()->getSchemaName(), |
729 | + table->table->getShare()->getTableName()); |
730 | table::Cache::removeTable(*session, identifier, RTFC_NO_FLAG); |
731 | } |
732 | } |
733 | |
734 | === modified file 'drizzled/sql_table.h' |
735 | --- drizzled/sql_table.h 2011-08-19 08:06:53 +0000 |
736 | +++ drizzled/sql_table.h 2012-07-12 00:07:29 +0000 |
737 | @@ -44,6 +44,6 @@ |
738 | |
739 | bool is_primary_key(const char* name); |
740 | bool check_engine(Session*, const char*, message::Table*, HA_CREATE_INFO*); |
741 | -void set_table_default_charset(HA_CREATE_INFO *create_info, const char *db); |
742 | +void set_table_default_charset(const drizzled::identifier::Catalog&, HA_CREATE_INFO *create_info, const char *db); |
743 | } /* namespace drizzled */ |
744 | |
745 | |
746 | === modified file 'drizzled/statement/alter_schema.cc' |
747 | --- drizzled/statement/alter_schema.cc 2011-10-18 13:52:19 +0000 |
748 | +++ drizzled/statement/alter_schema.cc 2012-07-12 00:07:29 +0000 |
749 | @@ -27,6 +27,8 @@ |
750 | #include <drizzled/message.h> |
751 | #include <drizzled/sql_lex.h> |
752 | |
753 | +#include <drizzled/catalog/instance.h> |
754 | + |
755 | #include <string> |
756 | |
757 | using namespace std; |
758 | @@ -38,7 +40,8 @@ |
759 | if (not validateSchemaOptions()) |
760 | return true; |
761 | |
762 | - identifier::Schema schema_identifier(lex().name); |
763 | + identifier::Schema schema_identifier(session().catalog().identifier(), |
764 | + lex().name); |
765 | |
766 | if (not schema::check(session(), schema_identifier)) |
767 | { |
768 | @@ -46,7 +49,7 @@ |
769 | return false; |
770 | } |
771 | |
772 | - identifier::Schema identifier(lex().name); |
773 | + identifier::Schema identifier(session().catalog().identifier(), lex().name); |
774 | message::schema::shared_ptr old_definition= plugin::StorageEngine::getSchemaDefinition(identifier); |
775 | if (not old_definition) |
776 | { |
777 | @@ -64,7 +67,7 @@ |
778 | */ |
779 | |
780 | // First initialize the schema message |
781 | - drizzled::message::schema::init(schema_message, old_definition->name()); |
782 | + drizzled::message::schema::init(schema_message, identifier); |
783 | |
784 | // We set the name from the old version to keep case preference |
785 | schema_message.set_version(old_definition->version()); |
786 | |
787 | === modified file 'drizzled/statement/alter_table.cc' |
788 | --- drizzled/statement/alter_table.cc 2012-02-12 08:54:25 +0000 |
789 | +++ drizzled/statement/alter_table.cc 2012-07-12 00:07:29 +0000 |
790 | @@ -51,6 +51,7 @@ |
791 | #include <drizzled/open_tables_state.h> |
792 | #include <drizzled/table/cache.h> |
793 | #include <drizzled/create_field.h> |
794 | +#include <drizzled/catalog/instance.h> |
795 | |
796 | using namespace std; |
797 | |
798 | @@ -128,7 +129,9 @@ |
799 | /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */ |
800 | message::table::shared_ptr original_table_message; |
801 | { |
802 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
803 | + identifier::Table identifier(session().catalog().identifier(), |
804 | + first_table->getSchemaName(), |
805 | + first_table->getTableName()); |
806 | if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier))) |
807 | { |
808 | my_error(ER_BAD_TABLE_ERROR, identifier); |
809 | @@ -163,8 +166,11 @@ |
810 | bool res; |
811 | if (original_table_message->type() == message::Table::STANDARD ) |
812 | { |
813 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
814 | - identifier::Table new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(), |
815 | + identifier::Table identifier(session().catalog().identifier(), |
816 | + first_table->getSchemaName(), |
817 | + first_table->getTableName()); |
818 | + identifier::Table new_identifier(session().catalog().identifier(), |
819 | + select_lex->db ? select_lex->db : first_table->getSchemaName(), |
820 | lex().name.data() ? lex().name.data() : first_table->getTableName()); |
821 | |
822 | res= alter_table(&session(), |
823 | @@ -181,12 +187,19 @@ |
824 | } |
825 | else |
826 | { |
827 | - identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName()); |
828 | + identifier::Table catch22(session().catalog().identifier(), |
829 | + first_table->getSchemaName(), |
830 | + first_table->getTableName()); |
831 | Table *table= session().open_tables.find_temporary_table(catch22); |
832 | assert(table); |
833 | { |
834 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath()); |
835 | - identifier::Table new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(), |
836 | + identifier::Table identifier(session().catalog().identifier(), |
837 | + first_table->getSchemaName(), |
838 | + first_table->getTableName(), |
839 | + table->getMutableShare()->getPath()); |
840 | + |
841 | + identifier::Table new_identifier(session().catalog().identifier(), |
842 | + select_lex->db ? select_lex->db : first_table->getSchemaName(), |
843 | lex().name.data() ? lex().name.data() : first_table->getTableName(), |
844 | table->getMutableShare()->getPath()); |
845 | |
846 | @@ -1048,7 +1061,7 @@ |
847 | return true; |
848 | } |
849 | |
850 | - set_table_default_charset(create_info, new_table_identifier.getSchemaName().c_str()); |
851 | + set_table_default_charset(session->catalog().identifier(), create_info, new_table_identifier.getSchemaName().c_str()); |
852 | |
853 | snprintf(tmp_name, sizeof(tmp_name), "%s-%lx_%"PRIx64, TMP_FILE_PREFIX, (unsigned long) current_pid, session->thread_id); |
854 | |
855 | @@ -1058,10 +1071,11 @@ |
856 | case we just use it as is. Neither of these tables require locks in order to be |
857 | filled. |
858 | */ |
859 | - identifier::Table new_table_as_temporary(original_table_identifier.getSchemaName(), |
860 | - tmp_name, |
861 | - create_proto.type() != message::Table::TEMPORARY ? message::Table::INTERNAL : |
862 | - message::Table::TEMPORARY); |
863 | + identifier::Table new_table_as_temporary(session->catalog().identifier(), |
864 | + original_table_identifier.getSchemaName(), |
865 | + tmp_name, |
866 | + create_proto.type() != message::Table::TEMPORARY ? message::Table::INTERNAL : |
867 | + message::Table::TEMPORARY); |
868 | |
869 | /* |
870 | Create a table with a temporary name. |
871 | @@ -1247,7 +1261,8 @@ |
872 | table. This is when the old and new tables are compatible, according to |
873 | compare_table(). Then, we need one additional call to |
874 | */ |
875 | - identifier::Table original_table_to_drop(original_table_identifier.getSchemaName(), |
876 | + identifier::Table original_table_to_drop(session->catalog().identifier(), |
877 | + original_table_identifier.getSchemaName(), |
878 | old_name, create_proto.type() != message::Table::TEMPORARY ? message::Table::INTERNAL : |
879 | message::Table::TEMPORARY); |
880 | |
881 | |
882 | === modified file 'drizzled/statement/change_schema.cc' |
883 | --- drizzled/statement/change_schema.cc 2011-10-18 13:52:19 +0000 |
884 | +++ drizzled/statement/change_schema.cc 2012-07-12 00:07:29 +0000 |
885 | @@ -24,6 +24,7 @@ |
886 | #include <drizzled/statement/change_schema.h> |
887 | #include <drizzled/schema.h> |
888 | #include <drizzled/sql_lex.h> |
889 | +#include <drizzled/catalog/instance.h> |
890 | |
891 | #include <string> |
892 | |
893 | @@ -33,7 +34,8 @@ |
894 | |
895 | bool statement::ChangeSchema::execute() |
896 | { |
897 | - identifier::Schema identifier(str_ref(lex().select_lex.db)); |
898 | + identifier::Schema identifier(session().catalog().identifier(), |
899 | + str_ref(lex().select_lex.db)); |
900 | if (not schema::change(session(), identifier)) |
901 | { |
902 | session().my_ok(); |
903 | |
904 | === modified file 'drizzled/statement/create_index.cc' |
905 | --- drizzled/statement/create_index.cc 2011-04-09 16:11:46 +0000 |
906 | +++ drizzled/statement/create_index.cc 2012-07-12 00:07:29 +0000 |
907 | @@ -26,6 +26,7 @@ |
908 | #include <drizzled/statement/alter_table.h> |
909 | #include <drizzled/plugin/storage_engine.h> |
910 | #include <drizzled/open_tables_state.h> |
911 | +#include <drizzled/catalog/instance.h> |
912 | |
913 | namespace drizzled |
914 | { |
915 | @@ -49,7 +50,9 @@ |
916 | /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */ |
917 | message::table::shared_ptr original_table_message; |
918 | { |
919 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
920 | + identifier::Table identifier(session().catalog().identifier(), |
921 | + first_table->getSchemaName(), |
922 | + first_table->getTableName()); |
923 | if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier))) |
924 | { |
925 | my_error(ER_BAD_TABLE_ERROR, identifier); |
926 | @@ -76,7 +79,9 @@ |
927 | bool res; |
928 | if (original_table_message->type() == message::Table::STANDARD ) |
929 | { |
930 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
931 | + identifier::Table identifier(session().catalog().identifier(), |
932 | + first_table->getSchemaName(), |
933 | + first_table->getTableName()); |
934 | create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier); |
935 | |
936 | res= alter_table(&session(), |
937 | @@ -91,11 +96,16 @@ |
938 | } |
939 | else |
940 | { |
941 | - identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName()); |
942 | + identifier::Table catch22(session().catalog().identifier(), |
943 | + first_table->getSchemaName(), |
944 | + first_table->getTableName()); |
945 | Table *table= session().open_tables.find_temporary_table(catch22); |
946 | assert(table); |
947 | { |
948 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath()); |
949 | + identifier::Table identifier(session().catalog().identifier(), |
950 | + first_table->getSchemaName(), |
951 | + first_table->getTableName(), |
952 | + table->getMutableShare()->getPath()); |
953 | create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier); |
954 | |
955 | res= alter_table(&session(), |
956 | |
957 | === modified file 'drizzled/statement/create_schema.cc' |
958 | --- drizzled/statement/create_schema.cc 2011-10-14 09:23:40 +0000 |
959 | +++ drizzled/statement/create_schema.cc 2012-07-12 00:07:29 +0000 |
960 | @@ -29,6 +29,7 @@ |
961 | #include <drizzled/plugin/storage_engine.h> |
962 | #include <drizzled/sql_lex.h> |
963 | #include <drizzled/plugin/authorization.h> |
964 | +#include <drizzled/catalog/instance.h> |
965 | |
966 | #include <string> |
967 | |
968 | @@ -47,11 +48,12 @@ |
969 | return true; |
970 | } |
971 | |
972 | - identifier::Schema schema_identifier(to_string(lex().name)); |
973 | + identifier::Schema schema_identifier(session().catalog().identifier(), |
974 | + to_string(lex().name)); |
975 | if (not check(schema_identifier)) |
976 | return false; |
977 | |
978 | - drizzled::message::schema::init(schema_message, lex().name.data()); |
979 | + drizzled::message::schema::init(schema_message, schema_identifier); |
980 | |
981 | message::set_definer(schema_message, *session().user()); |
982 | |
983 | |
984 | === modified file 'drizzled/statement/create_table.cc' |
985 | --- drizzled/statement/create_table.cc 2011-10-14 09:23:40 +0000 |
986 | +++ drizzled/statement/create_table.cc 2012-07-12 00:07:29 +0000 |
987 | @@ -29,6 +29,7 @@ |
988 | #include <drizzled/plugin/storage_engine.h> |
989 | #include <drizzled/select_create.h> |
990 | #include <drizzled/table_ident.h> |
991 | +#include <drizzled/catalog/instance.h> |
992 | |
993 | #include <iostream> |
994 | |
995 | @@ -116,7 +117,8 @@ |
996 | |
997 | drizzled::message::table::init(createTableMessage(), createTableMessage().name(), create_table_list->getSchemaName(), create_info().db_type->getName()); |
998 | |
999 | - identifier::Table new_table_identifier(create_table_list->getSchemaName(), |
1000 | + identifier::Table new_table_identifier(session().catalog().identifier(), |
1001 | + create_table_list->getSchemaName(), |
1002 | create_table_list->getTableName(), |
1003 | createTableMessage().type()); |
1004 | |
1005 | @@ -239,7 +241,8 @@ |
1006 | { |
1007 | res= create_like_table(&session(), |
1008 | new_table_identifier, |
1009 | - identifier::Table(select_tables->getSchemaName(), |
1010 | + identifier::Table(session().catalog().identifier(), |
1011 | + select_tables->getSchemaName(), |
1012 | select_tables->getTableName()), |
1013 | createTableMessage(), |
1014 | lex().exists(), |
1015 | |
1016 | === modified file 'drizzled/statement/drop_index.cc' |
1017 | --- drizzled/statement/drop_index.cc 2011-04-09 16:11:46 +0000 |
1018 | +++ drizzled/statement/drop_index.cc 2012-07-12 00:07:29 +0000 |
1019 | @@ -26,6 +26,7 @@ |
1020 | #include <drizzled/statement/alter_table.h> |
1021 | #include <drizzled/plugin/storage_engine.h> |
1022 | #include <drizzled/open_tables_state.h> |
1023 | +#include <drizzled/catalog/instance.h> |
1024 | |
1025 | namespace drizzled { |
1026 | |
1027 | @@ -37,7 +38,9 @@ |
1028 | /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */ |
1029 | message::table::shared_ptr original_table_message; |
1030 | { |
1031 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
1032 | + identifier::Table identifier(session().catalog().identifier(), |
1033 | + first_table->getSchemaName(), |
1034 | + first_table->getTableName()); |
1035 | if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier))) |
1036 | { |
1037 | my_error(ER_BAD_TABLE_ERROR, identifier); |
1038 | @@ -68,7 +71,9 @@ |
1039 | bool res; |
1040 | if (original_table_message->type() == message::Table::STANDARD ) |
1041 | { |
1042 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName()); |
1043 | + identifier::Table identifier(session().catalog().identifier(), |
1044 | + first_table->getSchemaName(), |
1045 | + first_table->getTableName()); |
1046 | |
1047 | create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier); |
1048 | |
1049 | @@ -84,11 +89,16 @@ |
1050 | } |
1051 | else |
1052 | { |
1053 | - identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName()); |
1054 | + identifier::Table catch22(session().catalog().identifier(), |
1055 | + first_table->getSchemaName(), |
1056 | + first_table->getTableName()); |
1057 | Table *table= session().open_tables.find_temporary_table(catch22); |
1058 | assert(table); |
1059 | { |
1060 | - identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getShare()->getPath()); |
1061 | + identifier::Table identifier(session().catalog().identifier(), |
1062 | + first_table->getSchemaName(), |
1063 | + first_table->getTableName(), |
1064 | + table->getShare()->getPath()); |
1065 | create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier); |
1066 | |
1067 | res= alter_table(&session(), |
1068 | |
1069 | === modified file 'drizzled/statement/drop_schema.cc' |
1070 | --- drizzled/statement/drop_schema.cc 2011-10-14 09:23:40 +0000 |
1071 | +++ drizzled/statement/drop_schema.cc 2012-07-12 00:07:29 +0000 |
1072 | @@ -26,6 +26,7 @@ |
1073 | #include <drizzled/plugin/event_observer.h> |
1074 | #include <drizzled/sql_lex.h> |
1075 | #include <drizzled/schema.h> |
1076 | +#include <drizzled/catalog/instance.h> |
1077 | |
1078 | #include <string> |
1079 | |
1080 | @@ -41,7 +42,8 @@ |
1081 | return true; |
1082 | } |
1083 | |
1084 | - identifier::Schema schema_identifier(to_string(lex().name)); |
1085 | + identifier::Schema schema_identifier(session().catalog().identifier(), |
1086 | + to_string(lex().name)); |
1087 | |
1088 | if (not schema::check(session(), schema_identifier)) |
1089 | { |
1090 | |
1091 | === modified file 'drizzled/statement/rename_table.cc' |
1092 | --- drizzled/statement/rename_table.cc 2011-06-23 10:47:03 +0000 |
1093 | +++ drizzled/statement/rename_table.cc 2012-07-12 00:07:29 +0000 |
1094 | @@ -28,6 +28,7 @@ |
1095 | #include <drizzled/transaction_services.h> |
1096 | #include <drizzled/sql_lex.h> |
1097 | #include <drizzled/table/cache.h> |
1098 | +#include <drizzled/catalog/instance.h> |
1099 | |
1100 | namespace drizzled { |
1101 | |
1102 | @@ -156,7 +157,10 @@ |
1103 | plugin::StorageEngine *engine= NULL; |
1104 | message::table::shared_ptr table_message; |
1105 | |
1106 | - identifier::Table old_identifier(ren_table->getSchemaName(), old_alias, message::Table::STANDARD); |
1107 | + identifier::Table old_identifier(session().catalog().identifier(), |
1108 | + ren_table->getSchemaName(), |
1109 | + old_alias, |
1110 | + message::Table::STANDARD); |
1111 | |
1112 | if (not (table_message= plugin::StorageEngine::getTableMessage(session(), old_identifier))) |
1113 | { |
1114 | @@ -166,7 +170,8 @@ |
1115 | |
1116 | engine= plugin::StorageEngine::findByName(session(), table_message->engine().name()); |
1117 | |
1118 | - identifier::Table new_identifier(new_db, new_alias, message::Table::STANDARD); |
1119 | + identifier::Table new_identifier(session().catalog().identifier(), |
1120 | + new_db, new_alias, message::Table::STANDARD); |
1121 | if (plugin::StorageEngine::doesTableExist(session(), new_identifier)) |
1122 | { |
1123 | my_error(ER_TABLE_EXISTS_ERROR, new_identifier); |
1124 | |
1125 | === modified file 'drizzled/table/concurrent.cc' |
1126 | --- drizzled/table/concurrent.cc 2011-06-29 12:57:43 +0000 |
1127 | +++ drizzled/table/concurrent.cc 2012-07-12 00:07:29 +0000 |
1128 | @@ -31,6 +31,7 @@ |
1129 | #include <drizzled/table/instance.h> |
1130 | #include <drizzled/table.h> |
1131 | #include <drizzled/table_list.h> |
1132 | +#include <drizzled/catalog/instance.h> |
1133 | |
1134 | namespace drizzled { |
1135 | namespace table { |
1136 | @@ -65,7 +66,10 @@ |
1137 | if (session->getKilled()) |
1138 | return true; |
1139 | |
1140 | - identifier::Table identifier(table_list->getSchemaName(), table_list->getTableName()); |
1141 | + identifier::Table identifier(session->catalog().identifier(), |
1142 | + table_list->getSchemaName(), |
1143 | + table_list->getTableName()); |
1144 | + |
1145 | if (open_unireg_entry(session, table_list->getTableName(), identifier)) |
1146 | { |
1147 | intern_close_table(); |
1148 | |
1149 | === modified file 'drizzled/table/instance/base.cc' |
1150 | --- drizzled/table/instance/base.cc 2012-04-21 02:13:56 +0000 |
1151 | +++ drizzled/table/instance/base.cc 2012-07-12 00:07:29 +0000 |
1152 | @@ -86,6 +86,7 @@ |
1153 | #include <drizzled/typelib.h> |
1154 | #include <drizzled/key.h> |
1155 | #include <drizzled/open_tables_state.h> |
1156 | +#include <drizzled/catalog/local.h> |
1157 | |
1158 | using namespace std; |
1159 | |
1160 | @@ -230,6 +231,7 @@ |
1161 | key_info(NULL), |
1162 | mem_root(TABLE_ALLOC_BLOCK_SIZE), |
1163 | all_set(), |
1164 | + table_identifier(NULL), |
1165 | block_size(0), |
1166 | version(0), |
1167 | timestamp_offset(0), |
1168 | @@ -289,6 +291,7 @@ |
1169 | mem_root(TABLE_ALLOC_BLOCK_SIZE), |
1170 | table_charset(0), |
1171 | all_set(), |
1172 | + table_identifier(NULL), |
1173 | block_size(0), |
1174 | version(0), |
1175 | timestamp_offset(0), |
1176 | @@ -328,6 +331,8 @@ |
1177 | keys_in_use(0), |
1178 | keys_for_keyread(0) |
1179 | { |
1180 | + table_identifier= new identifier::Table(identifier); |
1181 | + |
1182 | assert(identifier.getKey() == key); |
1183 | |
1184 | private_key_for_cache= key; |
1185 | @@ -335,14 +340,8 @@ |
1186 | table_category= TABLE_CATEGORY_TEMPORARY; |
1187 | tmp_table= message::Table::INTERNAL; |
1188 | |
1189 | - db= str_ref(private_key_for_cache.schema_name()); |
1190 | - table_name= str_ref(private_key_for_cache.table_name()); |
1191 | path= str_ref(""); |
1192 | normalized_path= str_ref(""); |
1193 | - |
1194 | - std::string tb_name(identifier.getTableName()); |
1195 | - boost::to_lower(tb_name); |
1196 | - assert(strcmp(tb_name.c_str(), table_name.data()) == 0); |
1197 | } |
1198 | |
1199 | TableShare::TableShare(const identifier::Table &identifier) : // Just used during createTable() |
1200 | @@ -353,6 +352,7 @@ |
1201 | mem_root(TABLE_ALLOC_BLOCK_SIZE), |
1202 | table_charset(0), |
1203 | all_set(), |
1204 | + table_identifier(NULL), |
1205 | block_size(0), |
1206 | version(0), |
1207 | timestamp_offset(0), |
1208 | @@ -392,6 +392,8 @@ |
1209 | keys_in_use(0), |
1210 | keys_for_keyread(0) |
1211 | { |
1212 | + table_identifier= new identifier::Table(identifier); |
1213 | + |
1214 | private_key_for_cache= identifier.getKey(); |
1215 | assert(identifier.getPath().size()); // Since we are doing a create table, this should be a positive value |
1216 | private_normalized_path.resize(identifier.getPath().size() + 1); |
1217 | @@ -400,8 +402,6 @@ |
1218 | { |
1219 | table_category= TABLE_CATEGORY_TEMPORARY; |
1220 | tmp_table= message::Table::INTERNAL; |
1221 | - db= str_ref(private_key_for_cache.vector()); |
1222 | - table_name= str_ref(db.data() + 1); |
1223 | path= private_normalized_path; |
1224 | normalized_path= path; |
1225 | } |
1226 | @@ -422,6 +422,7 @@ |
1227 | mem_root(TABLE_ALLOC_BLOCK_SIZE), |
1228 | table_charset(0), |
1229 | all_set(), |
1230 | + table_identifier(NULL), |
1231 | block_size(0), |
1232 | version(0), |
1233 | timestamp_offset(0), |
1234 | @@ -461,13 +462,9 @@ |
1235 | keys_in_use(0), |
1236 | keys_for_keyread(0) |
1237 | { |
1238 | + table_identifier= new identifier::Table(identifier); |
1239 | + |
1240 | private_key_for_cache= identifier.getKey(); |
1241 | - /* |
1242 | - Let us use the fact that the key is "db/0/table_name/0" + optional |
1243 | - part for temporary tables. |
1244 | - */ |
1245 | - db= str_ref(private_key_for_cache.schema_name()); |
1246 | - table_name= str_ref(private_key_for_cache.table_name()); |
1247 | |
1248 | std::string _path; |
1249 | if (path_arg) |
1250 | @@ -476,7 +473,7 @@ |
1251 | } |
1252 | else |
1253 | { |
1254 | - _path= identifier::Table::build_table_filename(db.data(), table_name.data(), false); |
1255 | + _path= identifier::Table::build_table_filename(*table_identifier, false); |
1256 | } |
1257 | |
1258 | char* path_buff= mem_root.strdup(_path); |
1259 | @@ -490,8 +487,13 @@ |
1260 | { |
1261 | table_category= TABLE_CATEGORY_TEMPORARY; |
1262 | tmp_table= message::Table::INTERNAL; |
1263 | - db= str_ref(""); |
1264 | - table_name= str_ref(new_table_name); |
1265 | + |
1266 | + /* local_identifier() is okay to use here as the path is what matters */ |
1267 | + identifier::Table *n= new identifier::Table(catalog::local_identifier(), |
1268 | + "", new_table_name, new_path); |
1269 | + delete table_identifier; |
1270 | + table_identifier= n; |
1271 | + |
1272 | path= str_ref(new_path); |
1273 | normalized_path= str_ref(new_path); |
1274 | } |
1275 | @@ -499,6 +501,7 @@ |
1276 | TableShare::~TableShare() |
1277 | { |
1278 | storage_engine= NULL; |
1279 | + delete table_identifier; |
1280 | |
1281 | mem_root.free_root(MYF(0)); // Free's share |
1282 | } |
1283 | @@ -507,12 +510,8 @@ |
1284 | { |
1285 | private_key_for_cache= identifier_arg.getKey(); |
1286 | |
1287 | - /* |
1288 | - Let us use the fact that the key is "db/0/table_name/0" + optional |
1289 | - part for temporary tables. |
1290 | - */ |
1291 | - db= str_ref(private_key_for_cache.schema_name()); |
1292 | - table_name= str_ref(private_key_for_cache.table_name()); |
1293 | + delete table_identifier; |
1294 | + table_identifier= new identifier::Table(identifier_arg); |
1295 | |
1296 | getTableMessage()->set_name(identifier_arg.getTableName()); |
1297 | getTableMessage()->set_schema(identifier_arg.getSchemaName()); |
1298 | @@ -1705,8 +1704,7 @@ |
1299 | case 1: |
1300 | if (db_errno == ENOENT) |
1301 | { |
1302 | - identifier::Table identifier(db.data(), table_name.data()); |
1303 | - my_error(ER_TABLE_UNKNOWN, identifier); |
1304 | + my_error(ER_TABLE_UNKNOWN, *table_identifier); |
1305 | } |
1306 | else |
1307 | { |
1308 | @@ -1729,7 +1727,7 @@ |
1309 | snprintf(tmp, sizeof(tmp), "#%d", pass_errarg); |
1310 | csname= tmp; |
1311 | } |
1312 | - my_printf_error(ER_UNKNOWN_COLLATION, _("Unknown collation '%s' in table '%-.64s' definition"), MYF(0), csname, table_name.data()); |
1313 | + my_printf_error(ER_UNKNOWN_COLLATION, _("Unknown collation '%s' in table '%-.64s' definition"), MYF(0), csname, table_identifier->getTableName().c_str()); |
1314 | break; |
1315 | } |
1316 | case 6: |
1317 | |
1318 | === modified file 'drizzled/table/instance/base.h' |
1319 | --- drizzled/table/instance/base.h 2011-10-29 18:07:51 +0000 |
1320 | +++ drizzled/table/instance/base.h 2012-07-12 00:07:29 +0000 |
1321 | @@ -231,8 +231,7 @@ |
1322 | private: |
1323 | identifier::Table::Key private_key_for_cache; // This will not exist in the final design. |
1324 | std::vector<char> private_normalized_path; // This will not exist in the final design. |
1325 | - str_ref db; /* Pointer to db */ |
1326 | - str_ref table_name; /* Table name (for open) */ |
1327 | + drizzled::identifier::Table *table_identifier; |
1328 | str_ref path; /* Path to table (from datadir) */ |
1329 | str_ref normalized_path; /* unpack_filename(path) */ |
1330 | |
1331 | @@ -261,22 +260,27 @@ |
1332 | |
1333 | str_ref getTableNameRef() const |
1334 | { |
1335 | - return table_name; |
1336 | + return str_ref(table_identifier->getTableName()); |
1337 | } |
1338 | |
1339 | const char *getTableName() const |
1340 | { |
1341 | - return table_name.data(); |
1342 | + return table_identifier->getTableName().c_str(); |
1343 | } |
1344 | |
1345 | str_ref getSchemaNameRef() const |
1346 | { |
1347 | - return db; |
1348 | + return str_ref(table_identifier->getSchemaName()); |
1349 | } |
1350 | |
1351 | const char *getSchemaName() const |
1352 | { |
1353 | - return db.data(); |
1354 | + return table_identifier->getSchemaName().c_str(); |
1355 | + } |
1356 | + |
1357 | + const drizzled::identifier::Table &getTableIdentifier() const |
1358 | + { |
1359 | + return *table_identifier; |
1360 | } |
1361 | |
1362 | uint32_t block_size; /* create information */ |
1363 | |
1364 | === modified file 'drizzled/table/singular.cc' |
1365 | --- drizzled/table/singular.cc 2011-08-08 12:51:19 +0000 |
1366 | +++ drizzled/table/singular.cc 2012-07-12 00:07:29 +0000 |
1367 | @@ -126,8 +126,7 @@ |
1368 | |
1369 | bool Singular::open_tmp_table() |
1370 | { |
1371 | - identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getPath()); |
1372 | - if (int error= cursor->ha_open(identifier, O_RDWR, HA_OPEN_TMP_TABLE | HA_OPEN_INTERNAL_TABLE)) |
1373 | + if (int error= cursor->ha_open(getShare()->getTableIdentifier(), O_RDWR, HA_OPEN_TMP_TABLE | HA_OPEN_INTERNAL_TABLE)) |
1374 | { |
1375 | print_error(error, MYF(0)); |
1376 | db_stat= 0; |
1377 | @@ -301,9 +300,8 @@ |
1378 | if (db_stat) |
1379 | cursor->closeMarkForDelete(); |
1380 | |
1381 | - identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getTableName()); |
1382 | drizzled::error_t ignored; |
1383 | - plugin::StorageEngine::dropTable(*in_use, *getShare()->getEngine(), identifier, ignored); |
1384 | + plugin::StorageEngine::dropTable(*in_use, *getShare()->getEngine(), getShare()->getTableIdentifier(), ignored); |
1385 | delete cursor; |
1386 | } |
1387 | |
1388 | |
1389 | === modified file 'plugin/innobase/handler/ha_innodb.cc' |
1390 | --- plugin/innobase/handler/ha_innodb.cc 2012-05-25 23:45:18 +0000 |
1391 | +++ plugin/innobase/handler/ha_innodb.cc 2012-07-12 00:07:29 +0000 |
1392 | @@ -610,7 +610,10 @@ |
1393 | |
1394 | if (search_string.compare("data_dictionary") == 0) |
1395 | { |
1396 | - set_of_identifiers.push_back(identifier::Table(schema_identifier.getSchemaName(), "SYS_REPLICATION_LOG")); |
1397 | + set_of_identifiers.push_back(identifier::Table( |
1398 | + catalog::local_identifier(), |
1399 | + schema_identifier.getSchemaName(), |
1400 | + "SYS_REPLICATION_LOG")); |
1401 | } |
1402 | |
1403 | for (CachedDirectory::Entries::iterator entry_iter= entries.begin(); |
1404 | @@ -640,7 +643,7 @@ |
1405 | Using schema_identifier here to stop unused warning, could use |
1406 | definition.schema() instead |
1407 | */ |
1408 | - identifier::Table identifier(schema_identifier.getSchemaName(), definition.name()); |
1409 | + identifier::Table identifier(schema_identifier, definition.name()); |
1410 | set_of_identifiers.push_back(identifier); |
1411 | } |
1412 | } |
1413 | |
1414 | === modified file 'plugin/memory/ha_heap.cc' |
1415 | --- plugin/memory/ha_heap.cc 2012-01-15 20:54:59 +0000 |
1416 | +++ plugin/memory/ha_heap.cc 2012-07-12 00:07:29 +0000 |
1417 | @@ -250,9 +250,7 @@ |
1418 | Cursor *ha_heap::clone(memory::Root *) |
1419 | { |
1420 | Cursor *new_handler= getTable()->getMutableShare()->db_type()->getCursor(*getTable()); |
1421 | - identifier::Table identifier(getTable()->getShare()->getSchemaName(), |
1422 | - getTable()->getShare()->getTableName(), |
1423 | - getTable()->getShare()->getPath()); |
1424 | + identifier::Table identifier(*getTable()); |
1425 | |
1426 | if (new_handler && !new_handler->ha_open(identifier, getTable()->db_stat, |
1427 | HA_OPEN_IGNORE_IF_LOCKED)) |
1428 | |
1429 | === modified file 'plugin/schema_engine/schema.cc' |
1430 | --- plugin/schema_engine/schema.cc 2012-01-16 02:37:54 +0000 |
1431 | +++ plugin/schema_engine/schema.cc 2012-07-12 00:07:29 +0000 |
1432 | @@ -26,7 +26,8 @@ |
1433 | #include <drizzled/sql_table.h> |
1434 | #include <drizzled/charset.h> |
1435 | #include <drizzled/cursor.h> |
1436 | -#include <drizzled/catalog/local.h> |
1437 | +#include <drizzled/data_home.h> |
1438 | +#include <drizzled/message/catalog.h> |
1439 | |
1440 | #include <drizzled/pthread_globals.h> |
1441 | |
1442 | @@ -69,9 +70,9 @@ |
1443 | table_definition_ext= DEFAULT_FILE_EXTENSION; |
1444 | } |
1445 | |
1446 | -void Schema::prime() |
1447 | +void Schema::prime_catalog(identifier::Catalog &catalog_identifier) |
1448 | { |
1449 | - CachedDirectory directory(catalog::local_identifier().getPath(), |
1450 | + CachedDirectory directory(catalog_identifier.getPath(), |
1451 | CachedDirectory::DIRECTORY, true); |
1452 | |
1453 | CachedDirectory::Entries files= directory.getEntries(); |
1454 | @@ -83,13 +84,20 @@ |
1455 | continue; |
1456 | message::Schema schema_message; |
1457 | |
1458 | - std::string filename= catalog::local_identifier().getPath(); |
1459 | + std::string filename= catalog_identifier.getPath(); |
1460 | filename+= FN_LIBCHAR; |
1461 | filename+= entry->filename; |
1462 | |
1463 | if (readSchemaFile(filename, schema_message)) |
1464 | { |
1465 | - identifier::Schema schema_identifier(schema_message.name()); |
1466 | + |
1467 | + identifier::Schema schema_identifier(catalog_identifier, |
1468 | + schema_message.name()); |
1469 | + |
1470 | + if (! schema_message.has_catalog()) |
1471 | + { |
1472 | + schema_message.set_catalog(catalog_identifier.name()); |
1473 | + } |
1474 | |
1475 | pair<SchemaCache::iterator, bool> ret= |
1476 | schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message))); |
1477 | @@ -99,11 +107,34 @@ |
1478 | } |
1479 | } |
1480 | |
1481 | +void Schema::prime() |
1482 | +{ |
1483 | + drizzled::CachedDirectory directory(drizzled::getDataHome().file_string(), |
1484 | + drizzled::CachedDirectory::DIRECTORY, |
1485 | + true); |
1486 | + drizzled::CachedDirectory::Entries files= directory.getEntries(); |
1487 | + |
1488 | + for (drizzled::CachedDirectory::Entries::iterator fileIter= files.begin(); |
1489 | + fileIter != files.end(); fileIter++) |
1490 | + { |
1491 | + drizzled::CachedDirectory::Entry *entry= *fileIter; |
1492 | + drizzled::message::catalog::shared_ptr message; |
1493 | + |
1494 | + if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT)) |
1495 | + continue; |
1496 | + |
1497 | + drizzled::identifier::Catalog identifier(entry->filename); |
1498 | + |
1499 | + prime_catalog(identifier); |
1500 | + } |
1501 | +} |
1502 | + |
1503 | void Schema::doGetSchemaIdentifiers(identifier::schema::vector &set_of_names) |
1504 | { |
1505 | mutex.lock_shared(); |
1506 | BOOST_FOREACH(SchemaCache::reference iter, schema_cache) |
1507 | - set_of_names.push_back(identifier::Schema(iter.second->name())); |
1508 | + set_of_names.push_back(identifier::Schema(identifier::Catalog(iter.second->catalog()), |
1509 | + iter.second->name())); |
1510 | mutex.unlock_shared(); |
1511 | } |
1512 | |
1513 | @@ -124,7 +155,8 @@ |
1514 | |
1515 | bool Schema::doCreateSchema(const drizzled::message::Schema &schema_message) |
1516 | { |
1517 | - identifier::Schema schema_identifier(schema_message.name()); |
1518 | + identifier::Schema schema_identifier(identifier::Catalog(schema_message.catalog()), |
1519 | + schema_message.name()); |
1520 | |
1521 | if (mkdir(schema_identifier.getPath().c_str(), 0777) == -1) |
1522 | { |
1523 | @@ -186,7 +218,8 @@ |
1524 | |
1525 | bool Schema::doAlterSchema(const drizzled::message::Schema &schema_message) |
1526 | { |
1527 | - identifier::Schema schema_identifier(schema_message.name()); |
1528 | + identifier::Schema schema_identifier(identifier::Catalog(schema_message.catalog()), |
1529 | + schema_message.name()); |
1530 | |
1531 | if (access(schema_identifier.getPath().c_str(), F_OK)) |
1532 | return false; |
1533 | |
1534 | === modified file 'plugin/schema_engine/schema.h' |
1535 | --- plugin/schema_engine/schema.h 2011-06-21 20:40:13 +0000 |
1536 | +++ plugin/schema_engine/schema.h 2012-07-12 00:07:29 +0000 |
1537 | @@ -33,6 +33,7 @@ |
1538 | bool readSchemaFile(const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema); |
1539 | bool readSchemaFile(std::string filename, drizzled::message::Schema &schema); |
1540 | |
1541 | + void prime_catalog(drizzled::identifier::Catalog &catalog_identifier); |
1542 | void prime(); |
1543 | |
1544 | typedef boost::unordered_map<std::string, drizzled::message::schema::shared_ptr> SchemaCache; |
1545 | |
1546 | === modified file 'plugin/show_dictionary/show_columns.cc' |
1547 | --- plugin/show_dictionary/show_columns.cc 2011-07-13 05:35:09 +0000 |
1548 | +++ plugin/show_dictionary/show_columns.cc 2012-07-12 00:07:29 +0000 |
1549 | @@ -51,7 +51,9 @@ |
1550 | if (not select.getShowTable().empty() && not select.getShowSchema().empty()) |
1551 | { |
1552 | table_name.append(select.getShowTable().c_str()); |
1553 | - identifier::Table identifier(select.getShowSchema().c_str(), select.getShowTable().c_str()); |
1554 | + identifier::Table identifier(getSession().catalog().identifier(), |
1555 | + select.getShowSchema().c_str(), |
1556 | + select.getShowTable().c_str()); |
1557 | |
1558 | if (not plugin::Authorization::isAuthorized(*getSession().user(), |
1559 | identifier, false)) |
1560 | |
1561 | === modified file 'plugin/show_dictionary/show_create_schema.cc' |
1562 | --- plugin/show_dictionary/show_create_schema.cc 2011-03-10 11:57:20 +0000 |
1563 | +++ plugin/show_dictionary/show_create_schema.cc 2012-07-12 00:07:29 +0000 |
1564 | @@ -47,7 +47,8 @@ |
1565 | if (not select.getShowSchema().empty()) |
1566 | { |
1567 | schema_name.append(select.getShowTable()); |
1568 | - identifier::Schema identifier(select.getShowSchema()); |
1569 | + identifier::Schema identifier(getSession().catalog().identifier(), |
1570 | + select.getShowSchema()); |
1571 | |
1572 | if (not plugin::Authorization::isAuthorized(*getSession().user(), |
1573 | identifier, false)) |
1574 | |
1575 | === modified file 'plugin/show_dictionary/show_create_table.cc' |
1576 | --- plugin/show_dictionary/show_create_table.cc 2011-03-18 16:53:27 +0000 |
1577 | +++ plugin/show_dictionary/show_create_table.cc 2012-07-12 00:07:29 +0000 |
1578 | @@ -48,7 +48,9 @@ |
1579 | |
1580 | if (not select.getShowTable().empty() && not select.getShowSchema().empty()) |
1581 | { |
1582 | - identifier::Table identifier(select.getShowSchema(), select.getShowTable()); |
1583 | + identifier::Table identifier(getSession().catalog().identifier(), |
1584 | + select.getShowSchema(), |
1585 | + select.getShowTable()); |
1586 | |
1587 | if (not plugin::Authorization::isAuthorized(*getSession().user(), |
1588 | identifier, false)) |
1589 | |
1590 | === modified file 'plugin/show_dictionary/show_indexes.cc' |
1591 | --- plugin/show_dictionary/show_indexes.cc 2011-03-10 11:57:20 +0000 |
1592 | +++ plugin/show_dictionary/show_indexes.cc 2012-07-12 00:07:29 +0000 |
1593 | @@ -52,7 +52,9 @@ |
1594 | if (not select.getShowTable().empty() && not select.getShowSchema().empty()) |
1595 | { |
1596 | table_name.append(select.getShowTable().c_str()); |
1597 | - identifier::Table identifier(select.getShowSchema().c_str(), select.getShowTable().c_str()); |
1598 | + identifier::Table identifier(getSession().catalog().identifier(), |
1599 | + select.getShowSchema().c_str(), |
1600 | + select.getShowTable().c_str()); |
1601 | |
1602 | if (not plugin::Authorization::isAuthorized(*getSession().user(), |
1603 | identifier, false)) |
1604 | |
1605 | === modified file 'plugin/show_dictionary/show_tables.cc' |
1606 | --- plugin/show_dictionary/show_tables.cc 2011-06-17 13:43:52 +0000 |
1607 | +++ plugin/show_dictionary/show_tables.cc 2012-07-12 00:07:29 +0000 |
1608 | @@ -62,7 +62,8 @@ |
1609 | return false; |
1610 | } |
1611 | |
1612 | - identifier::Schema identifier(schema_name); |
1613 | + identifier::Schema identifier(getSession().catalog().identifier(), |
1614 | + schema_name); |
1615 | plugin::StorageEngine::getIdentifiers(getSession(), identifier, set_of_identifiers); |
1616 | table_iterator= set_of_identifiers.begin(); |
1617 | is_primed= true; |
1618 | |
1619 | === modified file 'plugin/show_schema_proto/show_schema_proto.cc' |
1620 | --- plugin/show_schema_proto/show_schema_proto.cc 2012-01-15 20:54:59 +0000 |
1621 | +++ plugin/show_schema_proto/show_schema_proto.cc 2012-07-12 00:07:29 +0000 |
1622 | @@ -25,6 +25,10 @@ |
1623 | #include <drizzled/plugin/function.h> |
1624 | #include <drizzled/plugin/storage_engine.h> |
1625 | |
1626 | +#include <drizzled/identifier.h> |
1627 | +#include <drizzled/session.h> |
1628 | +#include <drizzled/catalog/instance.h> |
1629 | + |
1630 | #include <iostream> |
1631 | #include <stdio.h> |
1632 | #include <string> |
1633 | @@ -74,7 +78,8 @@ |
1634 | |
1635 | null_value= false; |
1636 | |
1637 | - identifier::Schema schema_identifier(*db_sptr); |
1638 | + identifier::Schema schema_identifier(getSession().catalog().identifier(), |
1639 | + *db_sptr); |
1640 | message::schema::shared_ptr proto= plugin::StorageEngine::getSchemaDefinition(schema_identifier); |
1641 | if (not proto) |
1642 | { |
1643 | |
1644 | === modified file 'plugin/table_cache_dictionary/tests/r/table_cache.result' |
1645 | --- plugin/table_cache_dictionary/tests/r/table_cache.result 2011-04-28 02:29:52 +0000 |
1646 | +++ plugin/table_cache_dictionary/tests/r/table_cache.result 2012-07-12 00:07:29 +0000 |
1647 | @@ -17,14 +17,14 @@ |
1648 | flush tables; |
1649 | select * FROM data_dictionary.TABLE_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME; |
1650 | SESSION_ID TABLE_SCHEMA TABLE_NAME VERSION IS_NAME_LOCKED ROWS AVG_ROW_LENGTH TABLE_SIZE AUTO_INCREMENT |
1651 | -# data_dictionary table_cache # # # 2112 # # |
1652 | +# data_dictionary TABLE_CACHE # # # 2112 # # |
1653 | create table a ( a int); |
1654 | create table b ( b int); |
1655 | select * FROM a CROSS JOIN b; |
1656 | a b |
1657 | select * FROM data_dictionary.TABLE_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME; |
1658 | SESSION_ID TABLE_SCHEMA TABLE_NAME VERSION IS_NAME_LOCKED ROWS AVG_ROW_LENGTH TABLE_SIZE AUTO_INCREMENT |
1659 | -# data_dictionary table_cache # # # 2112 # # |
1660 | +# data_dictionary TABLE_CACHE # # # 2112 # # |
1661 | # test a # # # 6 # # |
1662 | # test b # # # 6 # # |
1663 | DROP TABLES a,b; |
1664 | |
1665 | === modified file 'plugin/table_cache_dictionary/tests/r/table_definition_cache.result' |
1666 | --- plugin/table_cache_dictionary/tests/r/table_definition_cache.result 2011-04-28 02:29:52 +0000 |
1667 | +++ plugin/table_cache_dictionary/tests/r/table_definition_cache.result 2012-07-12 00:07:29 +0000 |
1668 | @@ -13,14 +13,14 @@ |
1669 | flush tables; |
1670 | select * FROM data_dictionary.TABLE_DEFINITION_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME; |
1671 | TABLE_SCHEMA TABLE_NAME VERSION TABLE_COUNT IS_NAME_LOCKED |
1672 | -# table_definition_cache # # # |
1673 | +# TABLE_DEFINITION_CACHE # # # |
1674 | create table a ( a int); |
1675 | create table b ( b int); |
1676 | select * FROM a CROSS JOIN b; |
1677 | a b |
1678 | select * FROM data_dictionary.TABLE_DEFINITION_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME; |
1679 | TABLE_SCHEMA TABLE_NAME VERSION TABLE_COUNT IS_NAME_LOCKED |
1680 | -# table_definition_cache # # # |
1681 | +# TABLE_DEFINITION_CACHE # # # |
1682 | # a # # # |
1683 | # b # # # |
1684 | DROP TABLES a,b; |
1685 | |
1686 | === modified file 'tests/r/show_check.result' |
1687 | --- tests/r/show_check.result 2011-07-15 08:26:31 +0000 |
1688 | +++ tests/r/show_check.result 2012-07-12 00:07:29 +0000 |
1689 | @@ -26,11 +26,11 @@ |
1690 | test.t1 check status OK |
1691 | show index from t1; |
1692 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1693 | -def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45 |
1694 | -def data_dictionary show_indexes SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63 |
1695 | -def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45 |
1696 | -def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63 |
1697 | -def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45 |
1698 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45 |
1699 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63 |
1700 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45 |
1701 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63 |
1702 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45 |
1703 | Table Unique Key_name Seq_in_index Column_name |
1704 | t1 YES PRIMARY 1 a |
1705 | t1 NO b 1 b |
1706 | @@ -48,37 +48,37 @@ |
1707 | -- after Bug#29394 is implemented. |
1708 | show variables like "server_id%"; |
1709 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1710 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45 |
1711 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45 |
1712 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45 |
1713 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45 |
1714 | Variable_name Value |
1715 | server_id 1 |
1716 | show variables like "SERVER_id%"; |
1717 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1718 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45 |
1719 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45 |
1720 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45 |
1721 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45 |
1722 | Variable_name Value |
1723 | server_id 1 |
1724 | show variables like "this_doesn't_exists%"; |
1725 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1726 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45 |
1727 | -def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45 |
1728 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45 |
1729 | +def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45 |
1730 | Variable_name Value |
1731 | show table status from test like "this_doesn't_exists%"; |
1732 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1733 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Session Session 5 21 0 N 36865 0 63 |
1734 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45 |
1735 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45 |
1736 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45 |
1737 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45 |
1738 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45 |
1739 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45 |
1740 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45 |
1741 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45 |
1742 | -def data_dictionary show_table_status SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45 |
1743 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Session Session 5 21 0 N 36865 0 63 |
1744 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45 |
1745 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45 |
1746 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45 |
1747 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45 |
1748 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45 |
1749 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45 |
1750 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45 |
1751 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45 |
1752 | +def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45 |
1753 | Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment |
1754 | show databases; |
1755 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1756 | -def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45 |
1757 | +def data_dictionary SHOW_SCHEMAS SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45 |
1758 | Database |
1759 | DATA_DICTIONARY |
1760 | INFORMATION_SCHEMA |
1761 | @@ -86,7 +86,7 @@ |
1762 | test |
1763 | show databases like "test%"; |
1764 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1765 | -def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45 |
1766 | +def data_dictionary SHOW_SCHEMAS SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45 |
1767 | Database (test%) |
1768 | test |
1769 | create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); |
1770 | @@ -446,11 +446,11 @@ |
1771 | ); |
1772 | show index from t1; |
1773 | Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
1774 | -def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45 |
1775 | -def data_dictionary show_indexes SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63 |
1776 | -def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45 |
1777 | -def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63 |
1778 | -def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45 |
1779 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45 |
1780 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63 |
1781 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45 |
1782 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63 |
1783 | +def data_dictionary SHOW_INDEXES SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45 |
1784 | Table Unique Key_name Seq_in_index Column_name |
1785 | t1 YES PRIMARY 1 field1 |
1786 | drop table t1; |
1787 | |
1788 | === modified file 'unittests/table_identifier.cc' |
1789 | --- unittests/table_identifier.cc 2012-01-04 09:51:04 +0000 |
1790 | +++ unittests/table_identifier.cc 2012-07-12 00:07:29 +0000 |
1791 | @@ -30,21 +30,21 @@ |
1792 | BOOST_AUTO_TEST_SUITE(TableIdentifierTest) |
1793 | BOOST_AUTO_TEST_CASE(CreateStandard) |
1794 | { |
1795 | - identifier::Table identifier("test", "a"); |
1796 | - BOOST_REQUIRE_EQUAL("test/a", identifier.getPath()); |
1797 | + identifier::Table identifier(identifier::Catalog(str_ref("local")), "test", "a"); |
1798 | + BOOST_REQUIRE_EQUAL("local/test/a", identifier.getPath()); |
1799 | BOOST_REQUIRE_EQUAL("test.a", identifier.getSQLPath()); |
1800 | } |
1801 | |
1802 | BOOST_AUTO_TEST_CASE(CreateTemporary) |
1803 | { |
1804 | - identifier::Table identifier("test", "a", message::Table::TEMPORARY); |
1805 | + identifier::Table identifier(identifier::Catalog(str_ref("local")),"test", "a", message::Table::TEMPORARY); |
1806 | BOOST_REQUIRE_EQUAL("/#sql", identifier.getPath().substr(0, 5)); |
1807 | BOOST_REQUIRE_EQUAL("test.#a", identifier.getSQLPath()); |
1808 | } |
1809 | |
1810 | BOOST_AUTO_TEST_CASE(CreateInternal) |
1811 | { |
1812 | - identifier::Table identifier("test", "a", message::Table::TEMPORARY); |
1813 | + identifier::Table identifier(identifier::Catalog(str_ref("local")),"test", "a", message::Table::TEMPORARY); |
1814 | BOOST_REQUIRE_EQUAL("/#sql", identifier.getPath().substr(0, 5)); |
1815 | BOOST_REQUIRE_EQUAL("test.#a", identifier.getSQLPath()); |
1816 | } |
1817 | @@ -59,7 +59,7 @@ |
1818 | |
1819 | BOOST_AUTO_TEST_CASE(Key) |
1820 | { |
1821 | - identifier::Table identifier("test", "a"); |
1822 | + identifier::Table identifier(identifier::Catalog(str_ref("LOCAL")),"test", "a"); |
1823 | |
1824 | const identifier::Table::Key key= identifier.getKey(); |
1825 | |
1826 | @@ -82,8 +82,8 @@ |
1827 | |
1828 | BOOST_AUTO_TEST_CASE(KeyCompare) |
1829 | { |
1830 | - identifier::Table identifier("test", "a"); |
1831 | - identifier::Table identifier2("test", "a"); |
1832 | + identifier::Table identifier(identifier::Catalog(str_ref("local")), "test", "a"); |
1833 | + identifier::Table identifier2(identifier::Catalog(str_ref("local")), "test", "a"); |
1834 | |
1835 | BOOST_REQUIRE_EQUAL((identifier.getKey() == identifier.getKey()), true); |
1836 | } |