29
29
#include "drizzled/cursor.h"
30
30
#include "drizzled/data_home.h"
32
#include <drizzled/pthread_globals.h>
34
#include <drizzled/execute.h>
32
36
#include "drizzled/internal/my_sys.h"
69
73
CachedDirectory directory(getDataHomeCatalog().file_string(), CachedDirectory::DIRECTORY);
70
74
CachedDirectory::Entries files= directory.getEntries();
74
for (CachedDirectory::Entries::iterator fileIter= files.begin();
75
fileIter != files.end(); fileIter++)
77
CachedDirectory::Entry *entry= *fileIter;
78
message::Schema schema_message;
80
if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))
83
SchemaIdentifier filename(entry->filename);
84
if (readSchemaFile(filename, schema_message))
77
boost::unique_lock<boost::shared_mutex> scopedLock(mutex);
79
for (CachedDirectory::Entries::iterator fileIter= files.begin();
80
fileIter != files.end(); fileIter++)
86
SchemaIdentifier schema_identifier(schema_message.name());
88
pair<SchemaCache::iterator, bool> ret=
89
schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message)));
91
if (ret.second == false)
93
abort(); // If this has happened, something really bad is going down.
82
CachedDirectory::Entry *entry= *fileIter;
83
message::Schema schema_message;
85
if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))
88
SchemaIdentifier filename(entry->filename);
89
if (readSchemaFile(filename, schema_message))
91
SchemaIdentifier schema_identifier(schema_message.name());
93
pair<SchemaCache::iterator, bool> ret=
94
schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message)));
96
if (ret.second == false)
98
abort(); // If this has happened, something really bad is going down.
105
void Schema::startup(drizzled::Session &)
100
109
void Schema::doGetSchemaIdentifiers(SchemaIdentifier::vector &set_of_names)
208
215
if (writeSchemaFile(schema_identifier, schema_message))
217
boost::unique_lock<boost::shared_mutex> scopedLock(mutex);
218
schema_cache.erase(schema_identifier.getPath());
220
pair<SchemaCache::iterator, bool> ret=
221
schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message)));
223
if (ret.second == false)
212
schema_cache.erase(schema_identifier.getPath());
214
pair<SchemaCache::iterator, bool> ret=
215
schema_cache.insert(make_pair(schema_identifier.getPath(), new message::Schema(schema_message)));
217
if (ret.second == false)
219
abort(); // If this has happened, something really bad is going down.
225
abort(); // If this has happened, something really bad is going down.