1 /* 2 Copyright (C) 2009 Sun Microsystems Inc. 3 All rights reserved. Use is subject to license terms. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 #ifndef HA_NDBINFO_H 27 #define HA_NDBINFO_H 28 29 #include <mysql/plugin.h> 30 31 int ndbinfo_init(void *plugin); 32 int ndbinfo_deinit(void *plugin); 33 34 class ha_ndbinfo: public handler 35 { 36 public: 37 ha_ndbinfo(handlerton *hton, TABLE_SHARE *table_arg); 38 ~ha_ndbinfo(); 39 table_type()40 const char *table_type() const { return "NDBINFO"; } bas_ext()41 const char **bas_ext() const { 42 static const char *null[] = { NullS }; 43 return null; 44 } table_flags()45 ulonglong table_flags() const { 46 return HA_REC_NOT_IN_SEQ | HA_NO_TRANSACTIONS | 47 HA_NO_BLOBS | HA_NO_AUTO_INCREMENT; 48 } index_flags(uint inx,uint part,bool all_parts)49 ulong index_flags(uint inx, uint part, bool all_parts) const { 50 return 0; 51 } 52 53 int create(const char *name, TABLE *form, 54 HA_CREATE_INFO *create_info); 55 56 int open(const char *name, int mode, uint test_if_locked); 57 int close(void); 58 59 int rnd_init(bool scan); 60 int rnd_end(); 61 int rnd_next(uchar *buf); 62 int rnd_pos(uchar *buf, uchar *pos); 63 void position(const uchar *record); 64 int info(uint); 65 store_lock(THD * thd,THR_LOCK_DATA ** to,enum thr_lock_type lock_type)66 THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, 67 enum thr_lock_type lock_type) { 68 return to; 69 } 70 low_byte_first()71 bool low_byte_first() const { 72 // Data will be returned in machine format 73 #ifdef WORDS_BIGENDIAN 74 return false; 75 #else 76 return true; 77 #endif 78 } 79 80 bool get_error_message(int error, String *buf); 81 table_cache_type()82 uint8 table_cache_type() { 83 // Don't put ndbinfo results in query cache 84 return HA_CACHE_TBL_NOCACHE; 85 } 86 87 private: 88 void unpack_record(uchar *dst_row); 89 90 bool is_open(void) const; is_closed(void)91 bool is_closed(void) const { return ! is_open(); }; 92 93 bool is_offline(void) const; 94 95 struct ha_ndbinfo_impl& m_impl; 96 97 }; 98 99 #endif 100