~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/archive/ha_archive.cc

  • Committer: Stewart Smith
  • Date: 2008-12-15 06:30:20 UTC
  • mto: This revision was merged to the branch mainline in revision 677.
  • Revision ID: stewart@flamingspork.com-20081215063020-c0uzw9ion0evttud
remove old table discovery mechanim.

Will be replaced by new data dictionary work

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
static handler *archive_create_handler(handlerton *hton,
107
107
                                       TABLE_SHARE *table,
108
108
                                       MEM_ROOT *mem_root);
109
 
int archive_discover(handlerton *hton, Session* session, const char *db,
110
 
                     const char *name,
111
 
                     unsigned char **frmblob,
112
 
                     size_t *frmlen);
113
109
 
114
110
static bool archive_use_aio= false;
115
111
 
160
156
  archive_hton->state= SHOW_OPTION_YES;
161
157
  archive_hton->create= archive_create_handler;
162
158
  archive_hton->flags= HTON_NO_FLAGS;
163
 
  archive_hton->discover= archive_discover;
164
159
 
165
160
  /* When the engine starts up set the first version */
166
161
  global_version= 1;
211
206
  archive_reader_open= false;
212
207
}
213
208
 
214
 
int archive_discover(handlerton *, Session *,
215
 
                     const char *db,
216
 
                     const char *name,
217
 
                     unsigned char **frmblob,
218
 
                     size_t *frmlen)
219
 
{
220
 
  azio_stream frm_stream;
221
 
  char az_file[FN_REFLEN];
222
 
  char *frm_ptr;
223
 
  struct stat file_stat;
224
 
 
225
 
  fn_format(az_file, name, db, ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME);
226
 
 
227
 
  if (stat(az_file, &file_stat))
228
 
    goto err;
229
 
 
230
 
  if (!(azopen(&frm_stream, az_file, O_RDONLY, AZ_METHOD_BLOCK)))
231
 
  {
232
 
    if (errno == EROFS || errno == EACCES)
233
 
      return(my_errno= errno);
234
 
    return(HA_ERR_CRASHED_ON_USAGE);
235
 
  }
236
 
 
237
 
  if (frm_stream.frm_length == 0)
238
 
    goto err;
239
 
 
240
 
  frm_ptr= (char *)malloc(sizeof(char) * frm_stream.frm_length);
241
 
  if (frm_ptr == NULL)
242
 
  {
243
 
    goto err;
244
 
  }
245
 
 
246
 
  azread_frm(&frm_stream, frm_ptr);
247
 
  azclose(&frm_stream);
248
 
 
249
 
  *frmlen= frm_stream.frm_length;
250
 
  *frmblob= (unsigned char*) frm_ptr;
251
 
 
252
 
  return(0);
253
 
err:
254
 
  my_errno= 0;
255
 
  return(1);
256
 
}
257
 
 
258
209
/*
259
210
  This method reads the header of a datafile and returns whether or not it was successful.
260
211
*/