MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
handler_api.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
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.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 ****************************************************************************/
18 
19 /**************************************************/
27 #ifndef HANDLER_API_H
28 #define HANDLER_API_H
29 
30 #define MYSQL_SERVER 1
31 
33 #define HDL_READ 0x1
34 #define HDL_WRITE 0x2
35 
37 typedef enum hdl_op_type {
38  HDL_UPDATE,
39  HDL_INSERT,
40  HDL_DELETE
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 /**********************************************************************/
49 void*
51 /*===============*/
52  bool enable_binlog);
54 /**********************************************************************/
57 void*
59 /*===============*/
60  void* my_thd,
61  const char* db_name,
62  const char* table_name,
63  int lock_mode);
65 /**********************************************************************/
67 void
69 /*===============*/
70  void* my_thd,
71  void* my_table,
72  int mode);
74 /**********************************************************************/
77 void
79 /*===============*/
80  void* my_thd,
81  void** original_thd);
83 /**********************************************************************/
85 void
87 /*==================*/
88  void* my_thd,
89  void* my_table);
91 /**********************************************************************/
93 void
95 /*====================*/
96  void* my_thd,
97  void* my_table);
99 /**********************************************************************/
101 void
103 /*=============*/
104  void* my_table);
106 /**********************************************************************/
108 void
110 /*==================*/
111  void* my_table,
112  int field_id,
113  const char* str,
114  int len);
116 /**********************************************************************/
118 void
120 /*==================*/
121  void* my_table,
122  int field_id,
123  int value,
124  bool unsigned_flag,
125  bool is_null);
127 /**********************************************************************/
129 void
131 /*=====================*/
132  void* my_table,
133  int field_id,
134  unsigned long long
135  value,
136  bool unsigned_flag,
137  bool is_null);
139 /**********************************************************************/
142 int
144 /*=================*/
145  void* my_thd,
146  void* my_table,
147  int mode);
149 /**********************************************************************/
151 void
153 /*==============*/
154  void* my_thd);
156 /**********************************************************************/
158 void
160 /*=================*/
161  void* my_table);
163 /**********************************************************************/
165 void
167 /*====================*/
168  void* my_thd,
169  char* table_name);
171 #ifdef __cplusplus
172 }
173 #endif
174 
175 /**********************************************************************
176 Following APIs can perform DMLs through MySQL handler interface. They
177 are currently disabled and under HANDLER_API_MEMCACHED define
178 **********************************************************************/
179 
180 #ifdef HANDLER_API_MEMCACHED
181 
183 typedef struct field_arg {
184  unsigned int num_arg;
185  int* len;
186  char** value;
187 } field_arg_t;
188 
190 #define MCI_FIELD_ADD(M_ARGS, M_FLD, M_VALUE, M_LEN) \
191  do { \
192  (M_ARGS)->len[M_FLD] = M_LEN; \
193  (M_ARGS)->value[M_FLD] = (char*)(M_VALUE); \
194  } while(0)
195 
196 #define MCI_FIELD_ALLOC(FIELD, NUM_FLD) \
197  do { \
198  FIELD->len = (int*)malloc((NUM_FLD) * sizeof(*(FIELD->len)));\
199  memset(FIELD->len, 0, (NUM_FLD) * sizeof(*(FIELD->len)));\
200  FIELD->value = (char**)malloc((NUM_FLD) \
201  * sizeof(*(FIELD->value)));\
202  FIELD->num_arg = NUM_FLD; \
203  } while(0)
204 
205 #define MCI_FIELD_FREE(FIELD) \
206  do { \
207  free(FIELD->len); \
208  free(FIELD->value); \
209  FIELD->num_arg = 0; \
210  } while(0)
211 
212 /**********************************************************************/
215 uchar*
216 handler_select_rec(
217 /*===============*/
218  TABLE* my_table,
219  field_arg_t* srch_args,
220  int idx_to_use);
222 /**********************************************************************/
225 int
226 handler_insert_rec(
227 /*===============*/
228  TABLE* my_table,
229  field_arg_t* store_args);
231 /**********************************************************************/
234 int
235 handler_update_rec(
236 /*===============*/
237  TABLE* my_table,
238  field_arg_t* store_args);
240 /**********************************************************************/
243 int
244 handler_delete_rec(
245 /*===============*/
246  TABLE* my_table);
248 /**********************************************************************/
251 MYSQL_LOCK *
252 handler_lock_table(
253 /*===============*/
254  THD* my_thd,
255  TABLE* my_table,
256  enum thr_lock_type lock_mode);
258 #endif /* HANDLER_API_MEMCACHED */
259 
260 #endif /* HANDLER_API_H */
261