~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Date: 2010-11-03 03:27:09 UTC
  • mto: (1902.1.1 build) (1910.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: stewart@flamingspork.com-20101103032709-oyvfrc6eb8fzj0mr
fix docs warning: docs/unlock.rst:2: (WARNING/2) Title underline too short.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
35
35
typedef struct st_innobase_share {
36
36
        THR_LOCK        lock;           /*!< MySQL lock protecting
37
37
                                        this structure */
38
 
        const char*     table_name;     /*!< InnoDB table name */
 
38
        char    table_name[FN_REFLEN];  /*!< InnoDB table name */
39
39
        uint            use_count;      /*!< reference count,
40
40
                                        incremented in get_share()
41
41
                                        and decremented in free_share() */
42
42
        void*           table_name_hash;/*!< hash table chain node */
 
43
 
 
44
        st_innobase_share(const char *arg) :
 
45
          use_count(0)
 
46
        {
 
47
          strncpy(table_name, arg, FN_REFLEN);
 
48
        }
 
49
 
43
50
} INNOBASE_SHARE;
44
51
 
45
52
 
66
73
        INNOBASE_SHARE* share;          /*!< information for MySQL
67
74
                                        table locking */
68
75
 
69
 
        unsigned char*  upd_buff;       /*!< buffer used in updates */
70
 
        unsigned char*  key_val_buff;   /*!< buffer used in converting
71
 
                                        search key values from MySQL format
72
 
                                        to Innodb format */
 
76
        std::vector<unsigned char> upd_buff; /*!< buffer used in updates */
 
77
        std::vector<unsigned char> key_val_buff; /*!< buffer used in converting
 
78
                                                     search key values from MySQL format
 
79
                                                     to Innodb format */
73
80
        ulong           upd_and_key_val_buff_len;
74
81
                                        /* the length of each of the previous
75
82
                                        two buffers */
80
87
        uint            last_match_mode;/* match mode of the latest search:
81
88
                                        ROW_SEL_EXACT, ROW_SEL_EXACT_PREFIX,
82
89
                                        or undefined */
83
 
        uint            num_write_row;  /*!< number of write_row() calls */
 
90
        uint            num_write_row;  /*!< number of doInsertRecord() calls */
84
91
 
85
92
        UNIV_INTERN uint store_key_val_for_row(uint keynr, char* buff, 
86
93
                                   uint buff_len, const unsigned char* record);
87
94
        UNIV_INTERN void update_session(Session* session);
88
 
        UNIV_INTERN void update_session();
89
95
        UNIV_INTERN int change_active_index(uint32_t keynr);
90
96
        UNIV_INTERN int general_fetch(unsigned char* buf, uint32_t direction, uint32_t match_mode);
91
97
        UNIV_INTERN ulint innobase_lock_autoinc();
101
107
        /* Init values for the class: */
102
108
 public:
103
109
        UNIV_INTERN ha_innobase(plugin::StorageEngine &engine,
104
 
                                TableShare &table_arg);
 
110
                                Table &table_arg);
105
111
        UNIV_INTERN ~ha_innobase();
106
112
  /**
107
113
   * Returns the plugin::TransactionStorageEngine pointer
113
119
   */
114
120
  UNIV_INTERN plugin::TransactionalStorageEngine *getTransactionalEngine()
115
121
  {
116
 
    return static_cast<plugin::TransactionalStorageEngine *>(engine);
 
122
    return static_cast<plugin::TransactionalStorageEngine *>(getEngine());
117
123
  }
118
124
 
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
 
 
125
125
        UNIV_INTERN const char* index_type(uint key_number);
126
126
        UNIV_INTERN const key_map* keys_to_use_for_scanning();
127
127
 
128
 
        UNIV_INTERN int open(const char *name, int mode, uint test_if_locked);
 
128
        UNIV_INTERN int doOpen(const drizzled::TableIdentifier &identifier, int mode, uint test_if_locked);
129
129
        UNIV_INTERN int close(void);
130
130
        UNIV_INTERN double scan_time();
131
131
        UNIV_INTERN double read_time(uint index, uint ranges, ha_rows rows);
132
132
 
133
 
        UNIV_INTERN int write_row(unsigned char * buf);
134
 
        UNIV_INTERN int update_row(const unsigned char * old_data, unsigned char * new_data);
135
 
        UNIV_INTERN int delete_row(const unsigned char * buf);
 
133
        UNIV_INTERN int doInsertRecord(unsigned char * buf);
 
134
        UNIV_INTERN int doUpdateRecord(const unsigned char * old_data, unsigned char * new_data);
 
135
        UNIV_INTERN int doDeleteRecord(const unsigned char * buf);
136
136
        UNIV_INTERN bool was_semi_consistent_read();
137
137
        UNIV_INTERN void try_semi_consistent_read(bool yes);
138
138
        UNIV_INTERN void unlock_row();
139
139
 
140
 
        UNIV_INTERN int index_init(uint index, bool sorted);
141
 
        UNIV_INTERN int index_end();
 
140
        UNIV_INTERN int doStartIndexScan(uint index, bool sorted);
 
141
        UNIV_INTERN int doEndIndexScan();
142
142
        UNIV_INTERN int index_read(unsigned char * buf, const unsigned char * key,
143
143
                uint key_len, enum ha_rkey_function find_flag);
144
144
        UNIV_INTERN int index_read_idx(unsigned char * buf, uint index, const unsigned char * key,
150
150
        UNIV_INTERN int index_first(unsigned char * buf);
151
151
        UNIV_INTERN int index_last(unsigned char * buf);
152
152
 
153
 
        UNIV_INTERN int rnd_init(bool scan);
154
 
        UNIV_INTERN int rnd_end();
 
153
        UNIV_INTERN int doStartTableScan(bool scan);
 
154
        UNIV_INTERN int doEndTableScan();
155
155
        UNIV_INTERN int rnd_next(unsigned char *buf);
156
156
        UNIV_INTERN int rnd_pos(unsigned char * buf, unsigned char *pos);
157
157
 
171
171
        UNIV_INTERN int check(Session* session);
172
172
        UNIV_INTERN char* update_table_comment(const char* comment);
173
173
        UNIV_INTERN char* get_foreign_key_create_info();
174
 
        UNIV_INTERN int get_foreign_key_list(Session *session, List<FOREIGN_KEY_INFO> *f_key_list);
 
174
        UNIV_INTERN int get_foreign_key_list(Session *session, List<ForeignKeyInfo> *f_key_list);
175
175
        UNIV_INTERN bool can_switch_engines();
176
176
        UNIV_INTERN uint referenced_by_foreign_key();
177
177
        UNIV_INTERN void free_foreign_key_create_info(char* str);
187
187
        UNIV_INTERN bool primary_key_is_clustered();
188
188
        UNIV_INTERN int cmp_ref(const unsigned char *ref1, const unsigned char *ref2);
189
189
        /** Fast index creation (smart ALTER TABLE) @see handler0alter.cc @{ */
190
 
        UNIV_INTERN int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys);
191
 
        UNIV_INTERN int prepare_drop_index(TABLE *table_arg, uint *key_num,
 
190
        // Don't use these, I have just left them in here as reference for
 
191
        // the future. -Brian 
 
192
#if 0
 
193
        UNIV_INTERN int add_index(Session *session, TABLE *table_arg, KeyInfo *key_info, uint num_of_keys);
 
194
        UNIV_INTERN int prepare_drop_index(Session *session,
 
195
                                           TABLE *table_arg,
 
196
                                           uint *key_num,
192
197
                                           uint num_of_keys);
193
 
        UNIV_INTERN int final_drop_index(TABLE *table_arg);
 
198
        UNIV_INTERN int final_drop_index(Session *session, TABLE *table_arg);
 
199
#endif
194
200
        /** @} */
195
201
public:
196
202
  int read_range_first(const key_range *start_key, const key_range *end_key,
219
225
*/
220
226
int session_slave_thread(const Session *session);
221
227
 
222
 
/**
223
 
  Check if a user thread is running a non-transactional update
224
 
  @param session  user thread
225
 
  @retval 0 the user thread is not running a non-transactional update
226
 
  @retval 1 the user thread is running a non-transactional update
227
 
*/
228
 
int session_non_transactional_update(const Session *session);
229
 
 
230
 
/**
231
 
  Mark transaction to rollback and mark error as fatal to a sub-statement.
232
 
  @param  session   Thread handle
233
 
  @param  all   TRUE <=> rollback main transaction.
234
 
*/
235
 
void session_mark_transaction_to_rollback(Session *session, bool all);
236
228
}
237
229
 
238
230
typedef struct trx_struct trx_t;
258
250
innobase_trx_allocate(
259
251
/*==================*/
260
252
        Session         *session);      /*!< in: user thread handle */
 
253
 
 
254
/***********************************************************************
 
255
This function checks each index name for a table against reserved
 
256
system default primary index name 'GEN_CLUST_INDEX'. If a name matches,
 
257
this function pushes an error message to the client, and returns true. */
 
258
extern "C"
 
259
bool
 
260
innobase_index_name_is_reserved(
 
261
/*============================*/
 
262
                                        /* out: true if index name matches a
 
263
                                        reserved name */
 
264
        const trx_t*    trx,            /* in: InnoDB transaction handle */
 
265
        const drizzled::KeyInfo*        key_info,/* in: Indexes to be created */
 
266
        ulint           num_of_keys);   /* in: Number of indexes to
 
267
                                        be created. */
 
268
 
261
269
#endif /* INNODB_HANDLER_HA_INNODB_H */