~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.h

  • Committer: Monty Taylor
  • Date: 2008-11-04 19:53:08 UTC
  • mto: (575.1.8 devel)
  • mto: This revision was merged to the branch mainline in revision 579.
  • Revision ID: monty@inaugust.com-20081104195308-4p1tfsbv4t41cvsp
Moved implementation of some methods into handler.cc from handler.h.

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
  {
239
239
    cached_table_flags= table_flags();
240
240
  }
 
241
 
241
242
  /* ha_ methods: pubilc wrappers for private virtual API */
242
243
 
243
244
  int ha_open(Table *table, const char *name, int mode, int test_if_locked);
244
 
  int ha_index_init(uint32_t idx, bool sorted)
245
 
  {
246
 
    int result;
247
 
    assert(inited==NONE);
248
 
    if (!(result= index_init(idx, sorted)))
249
 
      inited=INDEX;
250
 
    end_range= NULL;
251
 
    return(result);
252
 
  }
253
 
  int ha_index_end()
254
 
  {
255
 
    assert(inited==INDEX);
256
 
    inited=NONE;
257
 
    end_range= NULL;
258
 
    return(index_end());
259
 
  }
260
 
  int ha_rnd_init(bool scan)
261
 
  {
262
 
    int result;
263
 
    assert(inited==NONE || (inited==RND && scan));
264
 
    inited= (result= rnd_init(scan)) ? NONE: RND;
265
 
    return(result);
266
 
  }
267
 
  int ha_rnd_end()
268
 
  {
269
 
    assert(inited==RND);
270
 
    inited=NONE;
271
 
    return(rnd_end());
272
 
  }
 
245
  int ha_index_init(uint32_t idx, bool sorted);
 
246
  int ha_index_end();
 
247
  int ha_rnd_init(bool scan);
 
248
  int ha_rnd_end();
273
249
  int ha_reset();
 
250
 
274
251
  /* this is necessary in many places, e.g. in HANDLER command */
275
 
  int ha_index_or_rnd_end()
276
 
  {
277
 
    return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() : 0;
278
 
  }
279
 
  Table_flags ha_table_flags() const { return cached_table_flags; }
 
252
  int ha_index_or_rnd_end();
 
253
  Table_flags ha_table_flags() const;
 
254
 
280
255
  /**
281
256
    These functions represent the public interface to *users* of the
282
257
    handler class, hence they are *not* virtual. For the inheritance
293
268
  /** to be actually called to get 'check()' functionality*/
294
269
  int ha_check(Session *session, HA_CHECK_OPT *check_opt);
295
270
  int ha_repair(Session* session, HA_CHECK_OPT* check_opt);
296
 
  void ha_start_bulk_insert(ha_rows rows)
297
 
  {
298
 
    estimation_rows_to_insert= rows;
299
 
    start_bulk_insert(rows);
300
 
  }
301
 
  int ha_end_bulk_insert()
302
 
  {
303
 
    estimation_rows_to_insert= 0;
304
 
    return end_bulk_insert();
305
 
  }
 
271
  void ha_start_bulk_insert(ha_rows rows);
 
272
  int ha_end_bulk_insert();
306
273
  int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data,
307
274
                         uint32_t *dup_key_found);
308
275
  int ha_delete_all_rows();
329
296
  virtual void print_error(int error, myf errflag);
330
297
  virtual bool get_error_message(int error, String *buf);
331
298
  uint32_t get_dup_key(int error);
332
 
  virtual void change_table_ptr(Table *table_arg, TABLE_SHARE *share)
333
 
  {
334
 
    table= table_arg;
335
 
    table_share= share;
336
 
  }
 
299
  virtual void change_table_ptr(Table *table_arg, TABLE_SHARE *share);
 
300
 
337
301
  /* Estimates calculation */
338
302
  virtual double scan_time(void)
339
303
  { return uint64_t2double(stats.data_file_length) / IO_SIZE + 2; }
355
319
  virtual int multi_range_read_next(char **range_info);
356
320
 
357
321
 
358
 
  virtual const key_map *keys_to_use_for_scanning() { return &key_map_empty; }
359
 
  bool has_transactions()
360
 
  { return (ha_table_flags() & HA_NO_TRANSACTIONS) == 0; }
 
322
  virtual const key_map *keys_to_use_for_scanning();
 
323
  bool has_transactions();
361
324
  virtual uint32_t extra_rec_buf_length() const { return 0; }
362
325
 
363
326
  /**
370
333
    same thing as HA_ERR_FOUND_DUP_KEY but can in some cases lead to
371
334
    a slightly different error message.
372
335
  */
373
 
  virtual bool is_fatal_error(int error, uint32_t flags)
374
 
  {
375
 
    if (!error ||
376
 
        ((flags & HA_CHECK_DUP_KEY) &&
377
 
         (error == HA_ERR_FOUND_DUPP_KEY ||
378
 
          error == HA_ERR_FOUND_DUPP_UNIQUE)))
379
 
      return false;
380
 
    return true;
381
 
  }
 
336
  virtual bool is_fatal_error(int error, uint32_t flags);
382
337
 
383
338
  /**
384
339
    Number of rows in table. It will only be called if