~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/ha_archive.cc

Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
 
135
135
class ArchiveEngine : public drizzled::plugin::StorageEngine
136
136
{
137
 
std::map<std::string, ArchiveShare *> archive_open_tables;
 
137
  typedef std::map<string, ArchiveShare*> ArchiveMap;
 
138
  ArchiveMap archive_open_tables;
 
139
 
138
140
public:
139
141
  ArchiveEngine(const string &name_arg)
140
142
   : drizzled::plugin::StorageEngine(name_arg,
141
 
                                     HTON_FILE_BASED
142
 
                                      | HTON_HAS_DATA_DICTIONARY),
 
143
                                     HTON_FILE_BASED |
 
144
                                     HTON_STATS_RECORDS_IS_EXACT |
 
145
                                     HTON_HAS_RECORDS |
 
146
                                     HTON_HAS_DATA_DICTIONARY),
143
147
     archive_open_tables()
144
148
  {
145
149
    table_definition_ext= ARZ;
146
150
  }
147
151
 
148
 
  uint64_t table_flags() const
149
 
  {
150
 
    return (HA_NO_TRANSACTIONS |
151
 
            HA_STATS_RECORDS_IS_EXACT |
152
 
            HA_HAS_RECORDS);
153
 
  }
154
 
 
155
152
  virtual Cursor *create(TableShare &table,
156
153
                          MEM_ROOT *mem_root)
157
154
  {
179
176
  ArchiveShare *findOpenTable(const string table_name);
180
177
  void addOpenTable(const string &table_name, ArchiveShare *);
181
178
  void deleteOpenTable(const string &table_name);
 
179
 
 
180
  uint32_t max_supported_keys()          const { return 1; }
 
181
  uint32_t max_supported_key_length()    const { return sizeof(uint64_t); }
 
182
  uint32_t max_supported_key_part_length() const { return sizeof(uint64_t); }
182
183
};
183
184
 
184
185
ArchiveShare *ArchiveEngine::findOpenTable(const string table_name)
185
186
{
186
 
  map<string, ArchiveShare *>::iterator find_iter=
 
187
  ArchiveMap::iterator find_iter=
187
188
    archive_open_tables.find(table_name);
188
189
 
189
190
  if (find_iter != archive_open_tables.end())
202
203
  archive_open_tables.erase(table_name);
203
204
}
204
205
 
 
206
 
205
207
void ArchiveEngine::doGetTableNames(CachedDirectory &directory, 
206
208
                                    string&, 
207
209
                                    set<string>& set_of_names)
476
478
    thr_lock_init(&share->lock);
477
479
  }
478
480
  share->use_count++;
 
481
 
479
482
  if (share->crashed)
480
483
    *rc= HA_ERR_CRASHED_ON_USAGE;
481
484
  pthread_mutex_unlock(&archive_mutex);
1374
1377
}
1375
1378
 
1376
1379
/*
1377
 
  We just return state if asked.
1378
 
*/
1379
 
bool ha_archive::is_crashed() const
1380
 
{
1381
 
  return(share->crashed);
1382
 
}
1383
 
 
1384
 
/*
1385
1380
  Simple scan of the tables to make sure everything is ok.
1386
1381
*/
1387
1382