~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.h

  • Committer: Brian Aker
  • Date: 2008-10-06 05:57:49 UTC
  • Revision ID: brian@tangent.org-20081006055749-svg700gciuqi0zu1
Remove all of uchar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
422
422
    return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
423
423
           gtrid_length+bqual_length;
424
424
  }
425
 
  uchar *key()
 
425
  unsigned char *key()
426
426
  {
427
 
    return (uchar *)&gtrid_length;
 
427
    return (unsigned char *)&gtrid_length;
428
428
  }
429
429
  uint key_length()
430
430
  {
543
543
 
544
544
   int (*discover)(handlerton *hton, THD* thd, const char *db, 
545
545
                   const char *name,
546
 
                   uchar **frmblob, 
 
546
                   unsigned char **frmblob, 
547
547
                   size_t *frmlen);
548
548
   int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db,
549
549
                                 const char *name);
698
698
    Not-null only if this instance is a part of transaction.
699
699
    May assume a combination of enum values above.
700
700
  */
701
 
  uchar       m_flags;
 
701
  unsigned char       m_flags;
702
702
};
703
703
 
704
704
 
852
852
 
853
853
typedef struct st_handler_buffer
854
854
{
855
 
  uchar *buffer;         /* Buffer one can start using */
856
 
  uchar *buffer_end;     /* End of buffer */
857
 
  uchar *end_of_used_area;     /* End of area that was used by handler */
 
855
  unsigned char *buffer;         /* Buffer one can start using */
 
856
  unsigned char *buffer_end;     /* End of buffer */
 
857
  unsigned char *end_of_used_area;     /* End of area that was used by handler */
858
858
} HANDLER_BUFFER;
859
859
 
860
860
typedef struct system_status_var SSV;
1031
1031
  {}
1032
1032
};
1033
1033
 
1034
 
uint calculate_key_len(Table *, uint, const uchar *, key_part_map);
 
1034
uint calculate_key_len(Table *, uint, const unsigned char *, key_part_map);
1035
1035
/*
1036
1036
  bitmap with first N+1 bits set
1037
1037
  (keypart_map for a key prefix of [0..N] keyparts)
1103
1103
  ha_rows estimation_rows_to_insert;
1104
1104
public:
1105
1105
  handlerton *ht;                 /* storage engine of this handler */
1106
 
  uchar *ref;                           /* Pointer to current row */
1107
 
  uchar *dup_ref;                       /* Pointer to duplicate row */
 
1106
  unsigned char *ref;                           /* Pointer to current row */
 
1107
  unsigned char *dup_ref;                       /* Pointer to duplicate row */
1108
1108
 
1109
1109
  ha_statistics stats;
1110
1110
  /** MultiRangeRead-related members: */
1235
1235
    and delete_row() below.
1236
1236
  */
1237
1237
  int ha_external_lock(THD *thd, int lock_type);
1238
 
  int ha_write_row(uchar * buf);
1239
 
  int ha_update_row(const uchar * old_data, uchar * new_data);
1240
 
  int ha_delete_row(const uchar * buf);
 
1238
  int ha_write_row(unsigned char * buf);
 
1239
  int ha_update_row(const unsigned char * old_data, unsigned char * new_data);
 
1240
  int ha_delete_row(const unsigned char * buf);
1241
1241
  void ha_release_auto_increment();
1242
1242
 
1243
1243
  int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
1254
1254
    estimation_rows_to_insert= 0;
1255
1255
    return end_bulk_insert();
1256
1256
  }
1257
 
  int ha_bulk_update_row(const uchar *old_data, uchar *new_data,
 
1257
  int ha_bulk_update_row(const unsigned char *old_data, unsigned char *new_data,
1258
1258
                         uint *dup_key_found);
1259
1259
  int ha_delete_all_rows();
1260
1260
  int ha_reset_auto_increment(uint64_t value);
1414
1414
     row if available. If the key value is null, begin at the first key of the
1415
1415
     index.
1416
1416
  */
1417
 
  virtual int index_read_map(uchar * buf, const uchar * key,
 
1417
  virtual int index_read_map(unsigned char * buf, const unsigned char * key,
1418
1418
                             key_part_map keypart_map,
1419
1419
                             enum ha_rkey_function find_flag)
1420
1420
  {
1427
1427
     row if available. If the key value is null, begin at the first key of the
1428
1428
     index.
1429
1429
  */
1430
 
  virtual int index_read_idx_map(uchar * buf, uint index, const uchar * key,
 
1430
  virtual int index_read_idx_map(unsigned char * buf, uint index, const unsigned char * key,
1431
1431
                                 key_part_map keypart_map,
1432
1432
                                 enum ha_rkey_function find_flag);
1433
 
  virtual int index_next(uchar * buf __attribute__((unused)))
1434
 
   { return  HA_ERR_WRONG_COMMAND; }
1435
 
  virtual int index_prev(uchar * buf __attribute__((unused)))
1436
 
   { return  HA_ERR_WRONG_COMMAND; }
1437
 
  virtual int index_first(uchar * buf __attribute__((unused)))
1438
 
   { return  HA_ERR_WRONG_COMMAND; }
1439
 
  virtual int index_last(uchar * buf __attribute__((unused)))
1440
 
   { return  HA_ERR_WRONG_COMMAND; }
1441
 
  virtual int index_next_same(uchar *buf __attribute__((unused)),
1442
 
                              const uchar *key __attribute__((unused)),
 
1433
  virtual int index_next(unsigned char * buf __attribute__((unused)))
 
1434
   { return  HA_ERR_WRONG_COMMAND; }
 
1435
  virtual int index_prev(unsigned char * buf __attribute__((unused)))
 
1436
   { return  HA_ERR_WRONG_COMMAND; }
 
1437
  virtual int index_first(unsigned char * buf __attribute__((unused)))
 
1438
   { return  HA_ERR_WRONG_COMMAND; }
 
1439
  virtual int index_last(unsigned char * buf __attribute__((unused)))
 
1440
   { return  HA_ERR_WRONG_COMMAND; }
 
1441
  virtual int index_next_same(unsigned char *buf __attribute__((unused)),
 
1442
                              const unsigned char *key __attribute__((unused)),
1443
1443
                              uint keylen __attribute__((unused)));
1444
1444
  /**
1445
1445
     @brief
1446
1446
     The following functions works like index_read, but it find the last
1447
1447
     row with the current key value or prefix.
1448
1448
  */
1449
 
  virtual int index_read_last_map(uchar * buf, const uchar * key,
 
1449
  virtual int index_read_last_map(unsigned char * buf, const unsigned char * key,
1450
1450
                                  key_part_map keypart_map)
1451
1451
  {
1452
1452
    uint key_len= calculate_key_len(table, active_index, key, keypart_map);
1458
1458
  virtual int read_range_next();
1459
1459
  int compare_key(key_range *range);
1460
1460
  int compare_key2(key_range *range);
1461
 
  virtual int rnd_next(uchar *buf __attribute__((unused)))=0;
1462
 
  virtual int rnd_pos(uchar * buf __attribute__((unused)),
1463
 
                      uchar *pos __attribute__((unused)))=0;
 
1461
  virtual int rnd_next(unsigned char *buf __attribute__((unused)))=0;
 
1462
  virtual int rnd_pos(unsigned char * buf __attribute__((unused)),
 
1463
                      unsigned char *pos __attribute__((unused)))=0;
1464
1464
  /**
1465
1465
    One has to use this method when to find
1466
1466
    random position by record as the plain
1467
1467
    position() call doesn't work for some
1468
1468
    handlers for random position.
1469
1469
  */
1470
 
  virtual int rnd_pos_by_record(uchar *record);
1471
 
  virtual int read_first_row(uchar *buf, uint primary_key);
 
1470
  virtual int rnd_pos_by_record(unsigned char *record);
 
1471
  virtual int read_first_row(unsigned char *buf, uint primary_key);
1472
1472
  /**
1473
1473
    The following function is only needed for tables that may be temporary
1474
1474
    tables during joins.
1475
1475
  */
1476
 
  virtual int restart_rnd_next(uchar *buf __attribute__((unused)),
1477
 
                               uchar *pos __attribute__((unused)))
 
1476
  virtual int restart_rnd_next(unsigned char *buf __attribute__((unused)),
 
1477
                               unsigned char *pos __attribute__((unused)))
1478
1478
    { return HA_ERR_WRONG_COMMAND; }
1479
 
  virtual int rnd_same(uchar *buf __attribute__((unused)),
 
1479
  virtual int rnd_same(unsigned char *buf __attribute__((unused)),
1480
1480
                       uint inx __attribute__((unused)))
1481
1481
    { return HA_ERR_WRONG_COMMAND; }
1482
1482
  virtual ha_rows records_in_range(uint inx __attribute__((unused)),
1483
1483
                                   key_range *min_key __attribute__((unused)),
1484
1484
                                   key_range *max_key __attribute__((unused)))
1485
1485
    { return (ha_rows) 10; }
1486
 
  virtual void position(const uchar *record)=0;
 
1486
  virtual void position(const unsigned char *record)=0;
1487
1487
  virtual int info(uint)=0; // see my_base.h for full description
1488
1488
  virtual uint32_t calculate_key_hash_value(Field **field_array __attribute__((unused)))
1489
1489
  { assert(0); return 0; }
1717
1717
   @retval false  otherwise
1718
1718
 */
1719
1719
 virtual bool primary_key_is_clustered() { return false; }
1720
 
 virtual int cmp_ref(const uchar *ref1, const uchar *ref2)
 
1720
 virtual int cmp_ref(const unsigned char *ref1, const unsigned char *ref2)
1721
1721
 {
1722
1722
   return memcmp(ref1, ref2, ref_length);
1723
1723
 }
1949
1949
  */
1950
1950
  virtual int rnd_init(bool scan)= 0;
1951
1951
  virtual int rnd_end() { return 0; }
1952
 
  virtual int write_row(uchar *buf __attribute__((unused)))
1953
 
  {
1954
 
    return HA_ERR_WRONG_COMMAND;
1955
 
  }
1956
 
 
1957
 
  virtual int update_row(const uchar *old_data __attribute__((unused)),
1958
 
                         uchar *new_data __attribute__((unused)))
1959
 
  {
1960
 
    return HA_ERR_WRONG_COMMAND;
1961
 
  }
1962
 
 
1963
 
  virtual int delete_row(const uchar *buf __attribute__((unused)))
 
1952
  virtual int write_row(unsigned char *buf __attribute__((unused)))
 
1953
  {
 
1954
    return HA_ERR_WRONG_COMMAND;
 
1955
  }
 
1956
 
 
1957
  virtual int update_row(const unsigned char *old_data __attribute__((unused)),
 
1958
                         unsigned char *new_data __attribute__((unused)))
 
1959
  {
 
1960
    return HA_ERR_WRONG_COMMAND;
 
1961
  }
 
1962
 
 
1963
  virtual int delete_row(const unsigned char *buf __attribute__((unused)))
1964
1964
  {
1965
1965
    return HA_ERR_WRONG_COMMAND;
1966
1966
  }
2018
2018
  virtual void start_bulk_insert(ha_rows rows __attribute__((unused)))
2019
2019
  {}
2020
2020
  virtual int end_bulk_insert(void) { return 0; }
2021
 
  virtual int index_read(uchar * buf __attribute__((unused)),
2022
 
                         const uchar * key __attribute__((unused)),
 
2021
  virtual int index_read(unsigned char * buf __attribute__((unused)),
 
2022
                         const unsigned char * key __attribute__((unused)),
2023
2023
                         uint key_len __attribute__((unused)),
2024
2024
                         enum ha_rkey_function find_flag __attribute__((unused)))
2025
2025
   { return  HA_ERR_WRONG_COMMAND; }
2026
 
  virtual int index_read_last(uchar * buf __attribute__((unused)),
2027
 
                              const uchar * key __attribute__((unused)),
 
2026
  virtual int index_read_last(unsigned char * buf __attribute__((unused)),
 
2027
                              const unsigned char * key __attribute__((unused)),
2028
2028
                              uint key_len __attribute__((unused)))
2029
2029
   { return (my_errno= HA_ERR_WRONG_COMMAND); }
2030
2030
  /**
2040
2040
    @retval  0   Bulk delete used by handler
2041
2041
    @retval  1   Bulk delete not used, normal operation used
2042
2042
  */
2043
 
  virtual int bulk_update_row(const uchar *old_data __attribute__((unused)),
2044
 
                              uchar *new_data __attribute__((unused)),
 
2043
  virtual int bulk_update_row(const unsigned char *old_data __attribute__((unused)),
 
2044
                              unsigned char *new_data __attribute__((unused)),
2045
2045
                              uint *dup_key_found __attribute__((unused)))
2046
2046
  {
2047
2047
    assert(false);
2120
2120
  handler *h2;
2121
2121
 
2122
2122
  /* Buffer to store rowids, or (rowid, range_id) pairs */
2123
 
  uchar *rowids_buf;
2124
 
  uchar *rowids_buf_cur;   /* Current position when reading/writing */
2125
 
  uchar *rowids_buf_last;  /* When reading: end of used buffer space */
2126
 
  uchar *rowids_buf_end;   /* End of the buffer */
 
2123
  unsigned char *rowids_buf;
 
2124
  unsigned char *rowids_buf_cur;   /* Current position when reading/writing */
 
2125
  unsigned char *rowids_buf_last;  /* When reading: end of used buffer space */
 
2126
  unsigned char *rowids_buf_end;   /* End of the buffer */
2127
2127
 
2128
2128
  bool dsmrr_eof; /* true <=> We have reached EOF when reading index tuples */
2129
2129
 
2225
2225
/* discovery */
2226
2226
int ha_create_table_from_engine(THD* thd, const char *db, const char *name);
2227
2227
int ha_discover(THD* thd, const char* dbname, const char* name,
2228
 
                uchar** frmblob, size_t* frmlen);
 
2228
                unsigned char** frmblob, size_t* frmlen);
2229
2229
int ha_find_files(THD *thd,const char *db,const char *path,
2230
2230
                  const char *wild, bool dir, List<LEX_STRING>* files);
2231
2231
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);