My Project
ha_ndbinfo.h
00001 /*
00002    Copyright (C) 2009 Sun Microsystems Inc.
00003    All rights reserved. Use is subject to license terms.
00004 
00005    This program is free software; you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; version 2 of the License.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; if not, write to the Free Software
00016    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
00017 */
00018 
00019 #ifndef HA_NDBINFO_H
00020 #define HA_NDBINFO_H
00021 
00022 #include <mysql/plugin.h>
00023 
00024 int ndbinfo_init(void *plugin);
00025 int ndbinfo_deinit(void *plugin);
00026 
00027 class ha_ndbinfo: public handler
00028 {
00029 public:
00030   ha_ndbinfo(handlerton *hton, TABLE_SHARE *table_arg);
00031   ~ha_ndbinfo();
00032 
00033   const char *table_type() const { return "NDBINFO"; }
00034   const char **bas_ext() const {
00035     static const char *null[] = { NullS };
00036     return null;
00037   }
00038   ulonglong table_flags() const {
00039     return HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS |
00040            HA_NO_BLOBS | HA_NO_AUTO_INCREMENT;
00041   }
00042   ulong index_flags(uint inx, uint part, bool all_parts) const {
00043     return 0;
00044   }
00045 
00046   int create(const char *name, TABLE *form,
00047              HA_CREATE_INFO *create_info);
00048 
00049   int open(const char *name, int mode, uint test_if_locked);
00050   int close(void);
00051 
00052   int rnd_init(bool scan);
00053   int rnd_end();
00054   int rnd_next(uchar *buf);
00055   int rnd_pos(uchar *buf, uchar *pos);
00056   void position(const uchar *record);
00057   int info(uint);
00058 
00059   THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
00060                              enum thr_lock_type lock_type) {
00061     return to;
00062   }
00063 
00064   bool low_byte_first() const {
00065     // Data will be returned in machine format
00066 #ifdef WORDS_BIGENDIAN
00067     return false;
00068 #else
00069     return true;
00070 #endif
00071   }
00072 
00073   bool get_error_message(int error, String *buf);
00074 
00075   uint8 table_cache_type() {
00076     // Don't put ndbinfo results in query cache
00077     return HA_CACHE_TBL_NOCACHE;
00078   }
00079 
00080 private:
00081   void unpack_record(uchar *dst_row);
00082 
00083   bool is_open(void) const;
00084   bool is_closed(void) const { return ! is_open(); };
00085 
00086   bool is_offline(void) const;
00087 
00088   struct ha_ndbinfo_impl& m_impl;
00089 
00090 };
00091 
00092 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines