~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/handler/ha_innodb.h

  • Committer: Monty Taylor
  • Date: 2010-06-02 22:35:45 UTC
  • mto: This revision was merged to the branch mainline in revision 1586.
  • Revision ID: mordred@inaugust.com-20100602223545-q8ekf9b40a85nwuf
Rearragned unittests into a single exe because of how we need to link it
(thanks lifeless)
Link with server symbols without needing to build a library.
Added an additional atomics test which tests whatever version of the atomics
lib the running platform would actually use.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2000, 2009, MySQL AB & Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
31
31
#include <drizzled/plugin/transactional_storage_engine.h>
32
32
 
33
33
using namespace drizzled;
34
 
 
35
 
/* Structure defines translation table between mysql index and innodb
36
 
index structures */
37
 
typedef struct innodb_idx_translate_struct {
38
 
        ulint           index_count;    /*!< number of valid index entries
39
 
                                        in the index_mapping array */
40
 
        ulint           array_size;     /*!< array size of index_mapping */
41
 
        dict_index_t**  index_mapping;  /*!< index pointer array directly
42
 
                                        maps to index in Innodb from MySQL
43
 
                                        array index */
44
 
} innodb_idx_translate_t;
45
 
 
46
34
/** InnoDB table share */
47
35
typedef struct st_innobase_share {
48
36
        THR_LOCK        lock;           /*!< MySQL lock protecting
49
37
                                        this structure */
50
 
        char    table_name[FN_REFLEN];  /*!< InnoDB table name */
 
38
        const char*     table_name;     /*!< InnoDB table name */
51
39
        uint            use_count;      /*!< reference count,
52
40
                                        incremented in get_share()
53
41
                                        and decremented in free_share() */
54
42
        void*           table_name_hash;/*!< hash table chain node */
55
 
        innodb_idx_translate_t  idx_trans_tbl;  /*!< index translation
56
 
                                                table between MySQL and
57
 
                                                Innodb */
58
 
 
59
 
        st_innobase_share(const char *arg) :
60
 
          use_count(0)
61
 
        {
62
 
          strncpy(table_name, arg, FN_REFLEN);
63
 
        }
64
 
 
65
43
} INNOBASE_SHARE;
66
44
 
67
45
 
107
85
        UNIV_INTERN uint store_key_val_for_row(uint keynr, char* buff, 
108
86
                                   uint buff_len, const unsigned char* record);
109
87
        UNIV_INTERN void update_session(Session* session);
 
88
        UNIV_INTERN void update_session();
110
89
        UNIV_INTERN int change_active_index(uint32_t keynr);
111
90
        UNIV_INTERN int general_fetch(unsigned char* buf, uint32_t direction, uint32_t match_mode);
112
91
        UNIV_INTERN ulint innobase_lock_autoinc();
115
94
        UNIV_INTERN ulint innobase_reset_autoinc(uint64_t auto_inc);
116
95
        UNIV_INTERN ulint innobase_get_autoinc(uint64_t* value);
117
96
        ulint innobase_update_autoinc(uint64_t  auto_inc);
118
 
        UNIV_INTERN void innobase_initialize_autoinc();
 
97
        UNIV_INTERN ulint innobase_initialize_autoinc();
119
98
        UNIV_INTERN dict_index_t* innobase_get_index(uint keynr);
 
99
        UNIV_INTERN uint64_t innobase_get_int_col_max_value(const Field* field);
120
100
 
121
101
        /* Init values for the class: */
122
102
 public:
123
103
        UNIV_INTERN ha_innobase(plugin::StorageEngine &engine,
124
 
                                Table &table_arg);
 
104
                                TableShare &table_arg);
125
105
        UNIV_INTERN ~ha_innobase();
126
106
  /**
127
107
   * Returns the plugin::TransactionStorageEngine pointer
133
113
   */
134
114
  UNIV_INTERN plugin::TransactionalStorageEngine *getTransactionalEngine()
135
115
  {
136
 
    return static_cast<plugin::TransactionalStorageEngine *>(getEngine());
 
116
    return static_cast<plugin::TransactionalStorageEngine *>(engine);
137
117
  }
138
118
 
 
119
        /*
 
120
          Get the row type from the storage engine.  If this method returns
 
121
          ROW_TYPE_NOT_USED, the information in HA_CREATE_INFO should be used.
 
122
        */
 
123
        UNIV_INTERN enum row_type get_row_type() const;
 
124
 
139
125
        UNIV_INTERN const char* index_type(uint key_number);
140
126
        UNIV_INTERN const key_map* keys_to_use_for_scanning();
141
127
 
142
 
        UNIV_INTERN int doOpen(const drizzled::TableIdentifier &identifier, int mode, uint test_if_locked);
 
128
        UNIV_INTERN int open(const char *name, int mode, uint test_if_locked);
143
129
        UNIV_INTERN int close(void);
144
130
        UNIV_INTERN double scan_time();
145
131
        UNIV_INTERN double read_time(uint index, uint ranges, ha_rows rows);
202
188
        UNIV_INTERN int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
203
189
        /** Fast index creation (smart ALTER TABLE) @see handler0alter.cc @{ */
204
190
        // Don't use these, I have just left them in here as reference for
205
 
        // the future. -Brian 
206
 
#if 0
207
 
        UNIV_INTERN int add_index(Session *session, TABLE *table_arg, KeyInfo *key_info, uint num_of_keys);
208
 
        UNIV_INTERN int prepare_drop_index(Session *session,
209
 
                                           TABLE *table_arg,
210
 
                                           uint *key_num,
 
191
        // the future. -Brian
 
192
        UNIV_INTERN int add_index(TABLE *table_arg, KeyInfo *key_info, uint num_of_keys);
 
193
        UNIV_INTERN int prepare_drop_index(TABLE *table_arg, uint *key_num,
211
194
                                           uint num_of_keys);
212
 
        UNIV_INTERN int final_drop_index(Session *session, TABLE *table_arg);
213
 
#endif
 
195
        UNIV_INTERN int final_drop_index(TABLE *table_arg);
214
196
        /** @} */
215
197
public:
216
198
  int read_range_first(const key_range *start_key, const key_range *end_key,
264
246
innobase_trx_allocate(
265
247
/*==================*/
266
248
        Session         *session);      /*!< in: user thread handle */
267
 
 
268
 
/***********************************************************************
269
 
This function checks each index name for a table against reserved
270
 
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
271
 
this function pushes an error message to the client, and returns true. */
272
 
extern "C"
273
 
bool
274
 
innobase_index_name_is_reserved(
275
 
/*============================*/
276
 
                                        /* out: true if index name matches a
277
 
                                        reserved name */
278
 
        const trx_t*    trx,            /* in: InnoDB transaction handle */
279
 
        const drizzled::KeyInfo*        key_info,/* in: Indexes to be created */
280
 
        ulint           num_of_keys);   /* in: Number of indexes to
281
 
                                        be created. */
282
 
 
283
249
#endif /* INNODB_HANDLER_HA_INNODB_H */