Drizzled Public API Documentation

ha_myisam.h

00001 /* Copyright (C) 2000-2006 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 
00017 #pragma once
00018 
00019 #include <drizzled/cursor.h>
00020 #include <drizzled/thr_lock.h>
00021 
00022 /* class for the the myisam Cursor */
00023 
00024 #include <plugin/myisam/myisam.h>
00025 
00026 class ha_myisam: public drizzled::Cursor
00027 {
00028   MI_INFO *file;
00029   char    *data_file_name, *index_file_name;
00030   bool can_enable_indexes;
00031   bool is_ordered;
00032   int repair(drizzled::Session *session, MI_CHECK &param, bool optimize);
00033 
00034  public:
00035   ha_myisam(drizzled::plugin::StorageEngine &engine,
00036             drizzled::Table &table_arg);
00037   ~ha_myisam() {}
00038   Cursor *clone(drizzled::memory::Root *mem_root);
00039   const char *index_type(uint32_t key_number);
00040   int doStartIndexScan(uint32_t idx, bool sorted);
00041   int doEndIndexScan();
00042   uint32_t checksum() const;
00043 
00044   int doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked);
00045   int close(void);
00046   int doInsertRecord(unsigned char * buf);
00047   int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
00048   int doDeleteRecord(const unsigned char * buf);
00049   int index_read_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map,
00050                      enum drizzled::ha_rkey_function find_flag);
00051   int index_read_idx_map(unsigned char *buf, uint32_t index, const unsigned char *key,
00052                          drizzled::key_part_map keypart_map,
00053                          enum drizzled::ha_rkey_function find_flag);
00054   int index_read_last_map(unsigned char *buf, const unsigned char *key, drizzled::key_part_map keypart_map);
00055   int index_next(unsigned char * buf);
00056   int index_prev(unsigned char * buf);
00057   int index_first(unsigned char * buf);
00058   int index_last(unsigned char * buf);
00059   int index_next_same(unsigned char *buf, const unsigned char *key, uint32_t keylen);
00060   int doStartTableScan(bool scan);
00061   int rnd_next(unsigned char *buf);
00062   int rnd_pos(unsigned char * buf, unsigned char *pos);
00063   void position(const unsigned char *record);
00064   int info(uint);
00065   int extra(enum drizzled::ha_extra_function operation);
00066   int extra_opt(enum drizzled::ha_extra_function operation, uint32_t cache_size);
00067   int reset(void);
00068   int external_lock(drizzled::Session *session, int lock_type);
00069   int delete_all_rows(void);
00070   int disable_indexes(uint32_t mode);
00071   int enable_indexes(uint32_t mode);
00072   int indexes_are_disabled(void);
00073   void start_bulk_insert(drizzled::ha_rows rows);
00074   int end_bulk_insert();
00075   drizzled::ha_rows records_in_range(uint32_t inx, drizzled::key_range *min_key, drizzled::key_range *max_key);
00076   virtual void get_auto_increment(uint64_t offset, uint64_t increment,
00077                                   uint64_t nb_desired_values,
00078                                   uint64_t *first_value,
00079                                   uint64_t *nb_reserved_values);
00080   MI_INFO *file_ptr(void)
00081   {
00082     return file;
00083   }
00084   int read_range_first(const drizzled::key_range *start_key, const drizzled::key_range *end_key,
00085                        bool eq_range_arg, bool sorted);
00086   int read_range_next();
00087   int reset_auto_increment(uint64_t value);
00088 
00089   virtual bool isOrdered(void)
00090   {
00091     return false;
00092   }
00093 
00094 private:
00095   drizzled::key_map keys_with_parts;
00096 };
00097