~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/catalog.cc

  • Committer: Stewart Smith
  • Date: 2011-01-14 05:21:52 UTC
  • mto: (2086.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2087.
  • Revision ID: stewart@flamingspork.com-20110114052152-xnvlbrzvy3bx1ucd
add some FIXME to analyze docs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
{
55
55
}
56
56
 
57
 
bool Catalog::create(identifier::Catalog::const_reference identifier)
 
57
bool Catalog::create(const identifier::Catalog &identifier)
58
58
{
59
59
  message::catalog::shared_ptr message= message::catalog::make_shared(identifier);
60
60
  return create(identifier, message);
61
61
}
62
62
 
63
 
bool Catalog::create(identifier::Catalog::const_reference identifier, message::catalog::shared_ptr &message)
 
63
bool Catalog::create(const identifier::Catalog &identifier, message::catalog::shared_ptr &message)
64
64
{
65
65
  assert(message);
66
66
 
89
89
  return true;
90
90
}
91
91
 
92
 
bool Catalog::drop(identifier::Catalog::const_reference identifier)
 
92
bool Catalog::drop(const identifier::Catalog &identifier)
93
93
{
94
94
  if (identifier == drizzled::catalog::local_identifier())
95
95
  {
122
122
  return true;
123
123
}
124
124
 
125
 
bool Catalog::lock(identifier::Catalog::const_reference identifier)
 
125
bool Catalog::lock(const identifier::Catalog &identifier)
126
126
{
127
 
  drizzled::error_t error;
 
127
  catalog::error_t error;
128
128
  
129
129
  // We insert a lock into the cache, if this fails we bail.
130
130
  if (not catalog::Cache::singleton().lock(identifier, error))
131
131
  {
132
 
    my_error(error, identifier);
 
132
    catalog::error(error, identifier);
133
133
 
134
134
    return false;
135
135
  }
138
138
}
139
139
 
140
140
 
141
 
bool Catalog::unlock(identifier::Catalog::const_reference identifier)
 
141
bool Catalog::unlock(const identifier::Catalog &identifier)
142
142
{
143
 
  drizzled::error_t error;
 
143
  catalog::error_t error;
144
144
  if (not catalog::Cache::singleton().unlock(identifier, error))
145
145
  {
146
 
    my_error(error, identifier);
 
146
    catalog::error(error, identifier);
147
147
  }
148
148
 
149
149
  return false;
156
156
  return false;
157
157
}
158
158
 
159
 
bool plugin::Catalog::exist(identifier::Catalog::const_reference identifier)
 
159
bool plugin::Catalog::exist(const identifier::Catalog &identifier)
160
160
{
161
161
  if (catalog::Cache::singleton().exist(identifier))
162
162
    return true;
186
186
  }
187
187
}
188
188
 
189
 
message::catalog::shared_ptr plugin::Catalog::getMessage(identifier::Catalog::const_reference identifier)
 
189
bool plugin::Catalog::getMessage(const identifier::Catalog &identifier, message::catalog::shared_ptr &message)
190
190
{
191
 
  drizzled::error_t error;
 
191
  catalog::error_t error;
192
192
  catalog::Instance::shared_ptr instance= catalog::Cache::singleton().find(identifier, error);
193
 
  message::catalog::shared_ptr message;
194
193
 
195
194
  if (instance and instance->message())
196
195
  {
197
 
    return instance->message();
198
 
  }
 
196
    message= instance->message();
199
197
 
200
 
  BOOST_FOREACH(catalog::Engine::vector::const_reference ref, Engines::singleton().catalogs())
201
 
  {
202
 
    if ((message= ref->getMessage(identifier)))
 
198
    if (message)
203
199
      return message;
204
200
  }
205
201
 
206
 
  return message;
 
202
  BOOST_FOREACH(catalog::Engine::vector::const_reference ref, Engines::singleton().catalogs())
 
203
  {
 
204
    if (ref->getMessage(identifier, message))
 
205
      return true;
 
206
  }
 
207
 
 
208
  return false;
207
209
}
208
210
 
209
 
catalog::Instance::shared_ptr plugin::Catalog::getInstance(identifier::Catalog::const_reference identifier)
 
211
catalog::Instance::shared_ptr plugin::Catalog::getInstance(const identifier::Catalog &identifier)
210
212
{
211
 
  drizzled::error_t error;
 
213
  catalog::error_t error;
212
214
  catalog::Instance::shared_ptr instance= catalog::Cache::singleton().find(identifier, error);
213
215
 
214
216
  if (instance)
216
218
 
217
219
  BOOST_FOREACH(catalog::Engine::vector::const_reference ref, Engines::singleton().catalogs())
218
220
  {
219
 
    message::catalog::shared_ptr message;
220
 
    if (message= ref->getMessage(identifier))
 
221
    if (ref->getInstance(identifier, instance))
221
222
    {
222
 
      instance= catalog::Instance::make_shared(message);
223
223
      // If this should fail inserting into the cache, we are in a world of
224
224
      // pain.
225
225
      catalog::Cache::singleton().insert(identifier, instance, error);