MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
innodb_api.h
Go to the documentation of this file.
1 /***********************************************************************
2 
3 Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
12 Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17 
18 ***********************************************************************/
19 /**************************************************/
25 #ifndef innodb_api_h
26 #define innodb_api_h
27 
28 #include "api0api.h"
29 #include "innodb_engine.h"
30 #include "assert.h"
31 #include "handler_api.h"
32 
34 #define LOCK_CONN_IF_NOT_LOCKED(has_lock, engine) \
35  if (!(has_lock)) { \
36  pthread_mutex_lock(&(engine)->conn_mutex); \
37  }
38 
39 #define UNLOCK_CONN_IF_NOT_LOCKED(has_lock, engine) \
40  if (!(has_lock)) { \
41  pthread_mutex_unlock(&(engine)->conn_mutex); \
42  }
43 
46 #define LOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn) \
47  if (!(has_lock)) { \
48  pthread_mutex_lock(&(conn)->curr_conn_mutex); \
49  }
50 
51 #define UNLOCK_CURRENT_CONN_IF_NOT_LOCKED(has_lock, conn) \
52  if (!(has_lock)) { \
53  pthread_mutex_unlock(&(conn)->curr_conn_mutex); \
54  }
55 
58 #define MCI_COL_TO_GET 5
59 
60 typedef enum mci_col {
66 } mci_col_t;
67 
72 typedef struct mci_column {
73  char* value_str;
74  int value_len;
75  uint64_t value_int;
76  bool is_str;
77  bool is_valid;
79  bool is_null;
80  bool allocated;
82 } mci_column_t;
83 
93 typedef struct mci_item {
100 } mci_item_t;
101 
102 
103 /*************************************************************/
105 void
107 /*===============*/
108  void* p);
110 /*********************************************************************
111 Open a table and return a cursor for the table. */
112 ib_err_t
114 /*=============*/
116  engine,
117  const char* dbname,
118  const char* name,
119  innodb_conn_data_t* conn_data,
121  ib_trx_t ib_trx,
122  ib_crsr_t* crsr,
123  ib_crsr_t* idx_crsr,
124  ib_lck_mode_t lock_mode);
126 /*************************************************************/
129 ib_err_t
131 /*==============*/
132  innodb_conn_data_t* cursor_data,
133  ib_crsr_t* crsr,
134  const char* key,
135  int len,
136  mci_item_t* item,
137  ib_tpl_t* r_tpl,
138  bool sel_only);
140 /*************************************************************/
143 ib_err_t
145 /*==============*/
146  innodb_engine_t* engine,
147  innodb_conn_data_t* cursor_data,
148  const char* key,
149  int len,
150  uint32_t val_len,
151  uint64_t exp,
152  uint64_t* cas,
153  uint64_t flags);
155 /*************************************************************/
158 ENGINE_ERROR_CODE
160 /*==============*/
161  innodb_engine_t* engine,
162  innodb_conn_data_t* cursor_data,
163  const char* key,
164  int len);
166 /*************************************************************/
169 ENGINE_ERROR_CODE
171 /*==================*/
172  innodb_engine_t* engine,
173  innodb_conn_data_t* cursor_data,
174  const char* key,
175  int len,
176  int delta,
177  bool increment,
178  uint64_t* cas,
179  rel_time_t exp_time,
180  bool create,
182  uint64_t initial,
183  uint64_t* result);
185 /*************************************************************/
194 ENGINE_ERROR_CODE
196 /*=============*/
197  innodb_engine_t* engine,
198  innodb_conn_data_t* cursor_data,
199  const char* key,
200  int len,
201  uint32_t val_len,
202  uint64_t exp,
203  uint64_t* cas,
204  uint64_t input_cas,
205  uint64_t flags,
206  ENGINE_STORE_OPERATION op);
208 /*********************************************************************
209 Implement the "flush_all" command, map to InnoDB's trunk table operation
210 return ENGINE_SUCCESS is all successful */
211 ENGINE_ERROR_CODE
213 /*=============*/
214  innodb_engine_t* engine,
215  innodb_conn_data_t* conn_data,
217  const char* dbname,
218  const char* name);
220 /*************************************************************/
222 uint64_t
223 mci_get_time(void);
224 /*==============*/
225 
227 typedef enum conn_op_type {
233 
234 /*************************************************************/
237 void
239 /*====================*/
240  innodb_engine_t* engine,
242  innodb_conn_data_t* conn_data,
244  conn_op_type_t op_type,
246  bool commit);
248 /*************************************************************/
251 bool
253 /*==============*/
254  innodb_conn_data_t* conn_data,
256  bool has_lock,
258  bool commit,
259  bool has_binlog);
261 /**********************************************************************/
265 ib_err_t
267 /*==============*/
268  meta_cfg_info_t* info,
270  ib_crsr_t crsr,
271  bool runtime);
274 /*************************************************************/
278 ib_err_t
280 /*===================*/
281  ib_crsr_t ib_crsr);
283 /*************************************************************/
286 ib_trx_t
288 /*================*/
289  ib_trx_level_t ib_trx_level);
291 /*************************************************************/
294 ib_err_t
296 /*=================*/
297  ib_trx_t ib_trx);
299 /*************************************************************/
302 ib_err_t
304 /*=================*/
305  void* thd);
307 /*****************************************************************/
310 ib_err_t
312 /*=====================*/
313  ib_crsr_t ib_crsr,
314  ib_trx_t ib_trx);
316 /*****************************************************************/
319 ib_err_t
321 /*==================*/
322  innodb_engine_t* eng,
323  ib_crsr_t ib_crsr,
324  ib_lck_mode_t ib_lck_mode);
326 /*****************************************************************/
329 ib_tpl_t
331 /*========================*/
332  ib_crsr_t ib_crsr);
334 /*****************************************************************/
337 ib_err_t
339 /*===================*/
340  ib_crsr_t ib_crsr);
342 /*****************************************************************/
345 ib_err_t
347 /*===============*/
348  ib_crsr_t ib_crsr,
349  ib_tpl_t ib_tpl);
351 /*****************************************************************/
356 /*===================*/
357  ib_tpl_t ib_tpl,
358  ib_ulint_t i,
359  ib_col_meta_t* ib_col_meta);
361 /*****************************************************************/
363 void
365 /*===================*/
366  ib_tpl_t ib_tpl);
368 /*****************************************************************/
373 /*=======================*/
374  const ib_tpl_t ib_tpl);
376 /*****************************************************************/
379 const void*
381 /*====================*/
382  ib_tpl_t ib_tpl,
383  ib_ulint_t i);
385 /********************************************************************/
388 ib_err_t
390 /*=================*/
391  const char* name,
392  ib_trx_t ib_trx,
393  ib_crsr_t* ib_crsr);
395 /*****************************************************************/
398 char*
400 /*===================*/
401  ib_crsr_t ib_crsr,
402  ib_ulint_t i);
404 /*****************************************************************/
407 ib_err_t
409 /*===================================*/
410  ib_crsr_t ib_open_crsr,
411  const char* index_name,
412  ib_crsr_t* ib_crsr,
413  int* idx_type,
414  ib_id_u64_t* idx_id);
416 /*****************************************************************/
419 int
421 /*===============*/
422 #endif