MySQL  8.0.21
Source Code Documentation
api0api.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2008, 2020, 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, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 /** @file include/api0api.h
28  InnoDB Native API
29 
30  2008-08-01 Created by Sunny Bains.
31  3/20/2011 Jimmy Yang extracted from Embedded InnoDB
32  *******************************************************/
33 
34 #ifndef api0api_h
35 #define api0api_h
36 
37 #include <stdio.h>
38 
39 #include "config.h"
40 #include "db0err.h"
41 
42 /* Define uint32 outside my_compiler.h, because my_compiler.h would not allow
43 Memcached C code to use the bool data type. */
44 #if SIZEOF_INT == 4
45 typedef unsigned int uint32;
46 #elif SIZEOF_LONG == 4
47 typedef unsigned long uint32;
48 #else
49 #error Neither int or long is of 4 bytes width
50 #endif
51 
52 #if defined(WITH_INNODB_MEMCACHED) && !defined(DBUG_OFF)
53 #define UNIV_MEMCACHED_SDI
54 #endif
55 
56 /** Page number */
57 typedef uint32 page_no_t;
58 /** Tablespace identifier */
60 
61 typedef struct ib_sdi_key ib_sdi_key_t;
63 
64 #if defined(__GNUC__)
65 #define UNIV_NO_IGNORE MY_ATTRIBUTE((warn_unused_result))
66 #else
67 #define UNIV_NO_IGNORE
68 #endif /* __GNUC__ */
69 
70 /* See comment about ib_bool_t as to why the two macros are unsigned long. */
71 /** The boolean value of "true" used internally within InnoDB */
72 #define IB_TRUE 0x1UL
73 /** The boolean value of "false" used internally within InnoDB */
74 #define IB_FALSE 0x0UL
75 
76 /* Basic types used by the InnoDB API. */
77 /** All InnoDB error codes are represented by ib_err_t */
78 typedef enum dberr_t ib_err_t;
79 /** Representation of a byte within InnoDB */
80 typedef unsigned char ib_byte_t;
81 /** Representation of an unsigned long int within InnoDB */
82 #ifdef _WIN64
83 typedef unsigned __int64 ib_ulint_t;
84 #else
85 typedef unsigned long int ib_ulint_t;
86 #endif /* _WIN64 */
87 
88 /* We assume C99 support except when using VisualStudio. */
89 #if !defined(_MSC_VER)
90 #include <stdint.h>
91 #endif /* _MSC_VER */
92 
93 /* Integer types used by the API. Microsft VS defines its own types
94 and we use the Microsoft types when building with Visual Studio. */
95 #if defined(_MSC_VER)
96 /** A signed 8 bit integral type. */
97 typedef __int8 ib_i8_t;
98 #else
99 /** A signed 8 bit integral type. */
100 typedef int8_t ib_i8_t;
101 #endif
102 
103 #if defined(_MSC_VER)
104 /** An unsigned 8 bit integral type. */
105 typedef unsigned __int8 ib_u8_t;
106 #else
107 /** An unsigned 8 bit integral type. */
108 typedef uint8_t ib_u8_t;
109 #endif
110 
111 #if defined(_MSC_VER)
112 /** A signed 16 bit integral type. */
113 typedef __int16 ib_i16_t;
114 #else
115 /** A signed 16 bit integral type. */
116 typedef int16_t ib_i16_t;
117 #endif
118 
119 #if defined(_MSC_VER)
120 /** An unsigned 16 bit integral type. */
121 typedef unsigned __int16 ib_u16_t;
122 #else
123 /** An unsigned 16 bit integral type. */
124 typedef uint16_t ib_u16_t;
125 #endif
126 
127 #if defined(_MSC_VER)
128 /** A signed 32 bit integral type. */
129 typedef __int32 ib_i32_t;
130 #else
131 /** A signed 32 bit integral type. */
132 typedef int32_t ib_i32_t;
133 #endif
134 
135 #if defined(_MSC_VER)
136 /** An unsigned 32 bit integral type. */
137 typedef unsigned __int32 ib_u32_t;
138 #else
139 /** An unsigned 32 bit integral type. */
140 typedef uint32_t ib_u32_t;
141 #endif
142 
143 #if defined(_MSC_VER)
144 /** A signed 64 bit integral type. */
145 typedef __int64 ib_i64_t;
146 #else
147 /** A signed 64 bit integral type. */
148 typedef int64_t ib_i64_t;
149 #endif
150 
151 #if defined(_MSC_VER)
152 /** An unsigned 64 bit integral type. */
153 typedef unsigned __int64 ib_u64_t;
154 #else
155 /** An unsigned 64 bit integral type. */
156 typedef uint64_t ib_u64_t;
157 #endif
158 
159 typedef void *ib_opaque_t;
163 
164 /** @enum ib_cfg_type_t Possible types for a configuration variable. */
165 typedef enum {
166  IB_CFG_IBOOL, /*!< The configuration parameter is
167  of type ibool */
168 
169  /* XXX Can we avoid having different types for ulint and ulong?
170  - On Win64 "unsigned long" is 32 bits
171  - ulong is always defined as "unsigned long"
172  - On Win64 ulint is defined as 64 bit integer
173  => On Win64 ulint != ulong.
174  If we typecast all ulong and ulint variables to the smaller type
175  ulong, then we will cut the range of the ulint variables.
176  This is not a problem for most ulint variables because their max
177  allowed values do not exceed 2^32-1 (e.g. log_groups is ulint
178  but its max allowed value is 10). BUT buffer_pool_size and
179  log_file_size allow up to 2^64-1. */
180 
181  IB_CFG_ULINT, /*!< The configuration parameter is
182  of type ulint */
183 
184  IB_CFG_ULONG, /*!< The configuration parameter is
185  of type ulong */
186 
187  IB_CFG_TEXT, /*!< The configuration parameter is
188  of type char* */
189 
190  IB_CFG_CB /*!< The configuration parameter is
191  a callback parameter */
192 } ib_cfg_type_t;
193 
194 /** @enum ib_col_type_t column types that are supported. */
195 typedef enum {
196  IB_VARCHAR = 1, /*!< Character varying length. The
197  column is not padded. */
198 
199  IB_CHAR = 2, /*!< Fixed length character string. The
200  column is padded to the right. */
201 
202  IB_BINARY = 3, /*!< Fixed length binary, similar to
203  IB_CHAR but the column is not padded
204  to the right. */
205 
206  IB_VARBINARY = 4, /*!< Variable length binary */
207 
208  IB_BLOB = 5, /*!< Binary large object, or
209  a TEXT type */
210 
211  IB_INT = 6, /*!< Integer: can be any size
212  from 1 - 8 bytes. If the size is
213  1, 2, 4 and 8 bytes then you can use
214  the typed read and write functions. For
215  other sizes you will need to use the
216  ib_col_get_value() function and do the
217  conversion yourself. */
218 
219  IB_SYS = 8, /*!< System column, this column can
220  be one of DATA_TRX_ID, DATA_ROLL_PTR
221  or DATA_ROW_ID. */
222 
223  IB_FLOAT = 9, /*!< C (float) floating point value. */
224 
225  IB_DOUBLE = 10, /*!> C (double) floating point value. */
226 
227  IB_DECIMAL = 11, /*!< Decimal stored as an ASCII
228  string */
229 
230  IB_VARCHAR_ANYCHARSET = 12, /*!< Any charset, varying length */
231 
232  IB_CHAR_ANYCHARSET = 13 /*!< Any charset, fixed length */
233 
234 } ib_col_type_t;
235 
236 /** @enum ib_tbl_fmt_t InnoDB table format types */
237 typedef enum {
238  IB_TBL_REDUNDANT, /*!< Redundant row format, the column
239  type and length is stored in the row.*/
240 
241  IB_TBL_COMPACT, /*!< Compact row format, the column
242  type is not stored in the row. The
243  length is stored in the row but the
244  storage format uses a compact format
245  to store the length of the column data
246  and record data storage format also
247  uses less storage. */
248 
249  IB_TBL_DYNAMIC, /*!< Compact row format. BLOB prefixes
250  are not stored in the clustered index */
251 
252  IB_TBL_COMPRESSED /*!< Similar to dynamic format but
253  with pages compressed */
254 } ib_tbl_fmt_t;
255 
256 /** @enum ib_col_attr_t InnoDB column attributes */
257 typedef enum {
258  IB_COL_NONE = 0, /*!< No special attributes. */
259 
260  IB_COL_NOT_NULL = 1, /*!< Column data can't be NULL. */
261 
262  IB_COL_UNSIGNED = 2, /*!< Column is IB_INT and unsigned. */
263 
264  IB_COL_NOT_USED = 4, /*!< Future use, reserved. */
265 
266  IB_COL_CUSTOM1 = 8, /*!< Custom precision type, this is
267  a bit that is ignored by InnoDB and so
268  can be set and queried by users. */
269 
270  IB_COL_CUSTOM2 = 16, /*!< Custom precision type, this is
271  a bit that is ignored by InnoDB and so
272  can be set and queried by users. */
273 
274  IB_COL_CUSTOM3 = 32 /*!< Custom precision type, this is
275  a bit that is ignored by InnoDB and so
276  can be set and queried by users. */
277 } ib_col_attr_t;
278 
279 /* Note: must match lock0types.h */
280 /** @enum ib_lck_mode_t InnoDB lock modes. */
281 typedef enum {
282  IB_LOCK_IS = 0, /*!< Intention shared, an intention
283  lock should be used to lock tables */
284 
285  IB_LOCK_IX, /*!< Intention exclusive, an intention
286  lock should be used to lock tables */
287 
288  IB_LOCK_S, /*!< Shared locks should be used to
289  lock rows */
290 
291  IB_LOCK_X, /*!< Exclusive locks should be used to
292  lock rows*/
293 
294  IB_LOCK_TABLE_X, /*!< exclusive table lock */
295 
296  IB_LOCK_NONE, /*!< This is used internally to note
297  consistent read */
298 
299  IB_LOCK_NUM = IB_LOCK_NONE /*!< number of lock modes */
300 } ib_lck_mode_t;
301 
302 typedef enum {
303  IB_CLUSTERED = 1, /*!< clustered index */
304  IB_UNIQUE = 2 /*!< unique index */
306 
307 /** @enum ib_srch_mode_t InnoDB cursor search modes for ib_cursor_moveto().
308 Note: Values must match those found in page0cur.h */
309 typedef enum {
310  IB_CUR_G = 1, /*!< If search key is not found then
311  position the cursor on the row that
312  is greater than the search key */
313 
314  IB_CUR_GE = 2, /*!< If the search key not found then
315  position the cursor on the row that
316  is greater than or equal to the search
317  key */
318 
319  IB_CUR_L = 3, /*!< If search key is not found then
320  position the cursor on the row that
321  is less than the search key */
322 
323  IB_CUR_LE = 4 /*!< If search key is not found then
324  position the cursor on the row that
325  is less than or equal to the search
326  key */
328 
329 /** @enum ib_match_mode_t Various match modes used by ib_cursor_moveto() */
330 typedef enum {
331  IB_CLOSEST_MATCH, /*!< Closest match possible */
332 
333  IB_EXACT_MATCH, /*!< Search using a complete key
334  value */
335 
336  IB_EXACT_PREFIX /*!< Search using a key prefix which
337  must match to rows: the prefix may
338  contain an incomplete field (the
339  last field in prefix may be just
340  a prefix of a fixed length column) */
342 
343 /** InnoDB column meta data. */
344 typedef struct {
345  ib_col_type_t type; /*!< Type of the column */
346 
347  ib_col_attr_t attr; /*!< Column attributes */
348 
349  ib_u32_t type_len; /*!< Length of type */
350 
351  ib_u16_t client_type; /*!< 16 bits of data relevant only to
352  the client. InnoDB doesn't care */
353 
354  ib_charset_t *charset; /*!< Column charset */
355 } ib_col_meta_t;
356 
357 /* Note: Must be in sync with trx0trx.h */
358 /** @enum ib_trx_level_t Transaction isolation levels */
359 typedef enum {
360  IB_TRX_READ_UNCOMMITTED = 0, /*!< Dirty read: non-locking SELECTs are
361  performed so that we do not look at a
362  possible earlier version of a record;
363  thus they are not 'consistent' reads
364  under this isolation level; otherwise
365  like level 2 */
366 
367  IB_TRX_READ_COMMITTED = 1, /*!< Somewhat Oracle-like isolation,
368  except that in range UPDATE and DELETE
369  we must block phantom rows with
370  next-key locks; SELECT ... FOR UPDATE
371  and ... LOCK IN SHARE MODE only lock
372  the index records, NOT the gaps before
373  them, and thus allow free inserting;
374  each consistent read reads its own
375  snapshot */
376 
377  IB_TRX_REPEATABLE_READ = 2, /*!< All consistent reads in the same
378  trx read the same snapshot; full
379  next-key locking used in locking reads
380  to block insertions into gaps */
381 
382  IB_TRX_SERIALIZABLE = 3 /*!< All plain SELECTs are converted to
383  LOCK IN SHARE MODE reads */
385 
386 /** Generical InnoDB callback prototype. */
387 typedef void (*ib_cb_t)(void);
388 
389 #define IB_CFG_BINLOG_ENABLED 0x1
390 #define IB_CFG_MDL_ENABLED 0x2
391 #define IB_CFG_DISABLE_ROWLOCK 0x4
392 
393 /** Used by ib_read_tuple to determine number of bytes to allocate for new slot
394 if needed */
395 static const size_t REC_BUF_SLOT_SIZE = 16384;
396 
397 /** The first argument to the InnoDB message logging function. By default
398 it's set to stderr. You should treat ib_msg_stream_t as a void*, since
399 it will probably change in the future. */
401 
402 /** All log messages are written to this function.It should have the same
403 behavior as fprintf(3). */
404 typedef int (*ib_msg_log_t)(ib_msg_stream_t, const char *, ...);
405 
406 /* Note: This is to make it easy for API users to have type
407 checking for arguments to our functions. Making it ib_opaque_t
408 by itself will result in pointer decay resulting in subverting
409 of the compiler's type checking. */
410 
411 /** InnoDB tuple handle. This handle can refer to either a cluster index
412 tuple or a secondary index tuple. There are two types of tuples for each
413 type of index, making a total of four types of tuple handles. There
414 is a tuple for reading the entire row contents and another for searching
415 on the index key. */
416 typedef struct ib_tuple_t *ib_tpl_t;
417 
418 /** InnoDB transaction handle, all database operations need to be covered
419 by transactions. This handle represents a transaction. The handle can be
420 created with ib_trx_begin(), you commit your changes with ib_trx_commit()
421 and undo your changes using ib_trx_rollback(). If the InnoDB deadlock
422 monitor rolls back the transaction then you need to free the transaction
423 using the function ib_trx_release(). You can query the state of an InnoDB
424 transaction by calling ib_trx_state(). */
425 typedef struct trx_t *ib_trx_t;
426 
427 /** InnoDB cursor handle */
428 typedef struct ib_cursor_t *ib_crsr_t;
429 
430 /** This function is used to compare two data fields for which the data type
431  is such that we must use the client code to compare them.
432 
433  @param col_meta column meta data
434  @param p1 key
435  @param p1_len key length
436  @param p2 second key
437  @param p2_len second key length
438  @return 1, 0, -1, if a is greater, equal, less than b, respectively */
439 
440 typedef int (*ib_client_cmp_t)(const ib_col_meta_t *col_meta,
441  const ib_byte_t *p1, ib_ulint_t p1_len,
442  const ib_byte_t *p2, ib_ulint_t p2_len);
443 
444 /* This should be the same as univ.i */
445 /** Represents SQL_NULL length */
446 #define IB_SQL_NULL 0xFFFFFFFF
447 
448 /** Start a transaction that's been rolled back. This special function
449  exists for the case when InnoDB's deadlock detector has rolledack
450  a transaction. While the transaction has been rolled back the handle
451  is still valid and can be reused by calling this function. If you
452  don't want to reuse the transaction handle then you can free the handle
453  by calling ib_trx_release().
454  @return innobase txn handle */
456  ib_trx_t ib_trx, /*!< in: transaction to restart */
457  ib_trx_level_t ib_trx_level, /*!< in: trx isolation level */
458  ib_bool_t read_write, /*!< in: true if read write
459  transaction */
460  ib_bool_t auto_commit, /*!< in: auto commit after each
461  single DML */
462  void *thd); /*!< in: THD */
463 
464 /** Begin a transaction. This will allocate a new transaction handle and
465 put the transaction in the active state.
466 @param[in] ib_trx_level trx isolation level
467 @param[in] read_write true if read write transaction
468 @param[in] auto_commit auto commit after each single DML
469 @param[in,out] thd MySQL THD
470 @return innobase txn handle */
471 ib_trx_t ib_trx_begin(ib_trx_level_t ib_trx_level, ib_bool_t read_write,
472  ib_bool_t auto_commit, void *thd);
473 
474 /** Check if the transaction is read_only */
475 ib_u32_t ib_trx_read_only(ib_trx_t ib_trx); /*!< in: trx handle */
476 
477 /** Release the resources of the transaction. If the transaction was
478  selected as a victim by InnoDB and rolled back then use this function
479  to free the transaction handle.
480  @return DB_SUCCESS or err code */
481 ib_err_t ib_trx_release(ib_trx_t ib_trx); /*!< in: trx handle */
482 
483 /** Commit a transaction. This function will release the schema latches too.
484  It will also free the transaction handle.
485  @return DB_SUCCESS or err code */
486 ib_err_t ib_trx_commit(ib_trx_t ib_trx); /*!< in: trx handle */
487 
488 /** Rollback a transaction. This function will release the schema latches too.
489  It will also free the transaction handle.
490  @return DB_SUCCESS or err code */
491 ib_err_t ib_trx_rollback(ib_trx_t ib_trx); /*!< in: trx handle */
492 
493 /** Open an InnoDB secondary index cursor and return a cursor handle to it.
494  @return DB_SUCCESS or err code */
496  ib_crsr_t ib_open_crsr, /*!< in: open/active cursor */
497  const char *index_name, /*!< in: secondary index name */
498  ib_crsr_t *ib_crsr, /*!< out,own: InnoDB index cursor */
499  int *idx_type, /*!< out: index is cluster index */
500  ib_id_u64_t *idx_id); /*!< out: index id */
501 
502 /** Open an InnoDB table by name and return a cursor handle to it.
503  @return DB_SUCCESS or err code */
505  const char *name, /*!< in: table name */
506  ib_trx_t ib_trx, /*!< in: Current transaction handle
507  can be NULL */
508  ib_crsr_t *ib_crsr); /*!< out,own: InnoDB cursor */
509 
510 /** Reset the cursor.
511  @return DB_SUCCESS or err code */
512 ib_err_t ib_cursor_reset(ib_crsr_t ib_crsr); /*!< in/out: InnoDB cursor */
513 
514 /** Close an InnoDB table and free the cursor.
515  @return DB_SUCCESS or err code */
516 ib_err_t ib_cursor_close(ib_crsr_t ib_crsr); /*!< in/out: InnoDB cursor */
517 
518 /** update the cursor with new transactions and also reset the cursor
519  @return DB_SUCCESS or err code */
520 ib_err_t ib_cursor_new_trx(ib_crsr_t ib_crsr, /*!< in/out: InnoDB cursor */
521  ib_trx_t ib_trx); /*!< in: transaction */
522 
523 /** Commit the transaction in a cursor
524  @return DB_SUCCESS or err code */
525 ib_err_t ib_cursor_commit_trx(ib_crsr_t ib_crsr, /*!< in/out: InnoDB cursor */
526  ib_trx_t ib_trx); /*!< in: transaction */
527 
528 /** Insert a row to a table.
529  @return DB_SUCCESS or err code */
531  ib_crsr_t ib_crsr, /*!< in/out: InnoDB cursor instance */
532  const ib_tpl_t ib_tpl); /*!< in: tuple to insert */
533 
534 /** Update a row in a table.
535  @return DB_SUCCESS or err code */
537  ib_crsr_t ib_crsr, /*!< in: InnoDB cursor instance */
538  const ib_tpl_t ib_old_tpl, /*!< in: Old tuple in table */
539  const ib_tpl_t ib_new_tpl); /*!< in: New tuple to update */
540 
541 /** Delete a row in a table.
542  @return DB_SUCCESS or err code */
543 ib_err_t ib_cursor_delete_row(ib_crsr_t ib_crsr); /*!< in: cursor instance */
544 
545 /** Read current row.
546  @return DB_SUCCESS or err code */
548  ib_crsr_t ib_crsr, /*!< in: InnoDB cursor instance */
549  ib_tpl_t ib_tpl, /*!< out: read cols into this tuple */
550  ib_tpl_t cmp_tpl, /*!< in: tuple to compare and stop
551  reading */
552  int mode, /*!< in: mode determine when to
553  stop read */
554  void **row_buf, /*!< in/out: row buffer */
555  ib_ulint_t *row_len, /*!< in/out: row buffer len */
556  ib_ulint_t *used_len); /*!< in/out: row buffer len used */
557 
558 /** Move cursor to the first record in the table.
559  @return DB_SUCCESS or err code */
560 ib_err_t ib_cursor_first(ib_crsr_t ib_crsr); /*!< in: InnoDB cursor instance */
561 
562 /** Move cursor to the next record in the table.
563  @return DB_SUCCESS or err code */
564 ib_err_t ib_cursor_next(ib_crsr_t ib_crsr); /*!< in: InnoDB cursor instance */
565 
566 /** Search for key.
567  @return DB_SUCCESS or err code */
568 ib_err_t ib_cursor_moveto(ib_crsr_t ib_crsr, /*!< in: InnoDB cursor instance */
569  ib_tpl_t ib_tpl, /*!< in: Key to search for */
570  ib_srch_mode_t ib_srch_mode, /*!< in: search mode */
571  ib_ulint_t direction); /*!< in: search direction */
572 
573 /** Set the match mode for ib_cursor_move(). */
575  ib_crsr_t ib_crsr, /*!< in: Cursor instance */
576  ib_match_mode_t match_mode); /*!< in: ib_cursor_moveto match mode */
577 
578 /** Set a column of the tuple. Make a copy using the tuple's heap.
579  @return DB_SUCCESS or error code */
580 ib_err_t ib_col_set_value(ib_tpl_t ib_tpl, /*!< in: tuple instance */
581  ib_ulint_t col_no, /*!< in: column index in tuple */
582  const void *src, /*!< in: data value */
583  ib_ulint_t len, /*!< in: data value len */
584  ib_bool_t need_cpy); /*!< in: if need memcpy */
585 
586 /** Get the size of the data available in the column the tuple.
587  @return bytes avail or IB_SQL_NULL */
588 ib_ulint_t ib_col_get_len(ib_tpl_t ib_tpl, /*!< in: tuple instance */
589  ib_ulint_t i); /*!< in: column index in tuple */
590 
591 /** Copy a column value from the tuple.
592  @return bytes copied or IB_SQL_NULL */
594  ib_tpl_t ib_tpl, /*!< in: tuple instance */
595  ib_ulint_t i, /*!< in: column index in tuple */
596  void *dst, /*!< out: copied data value */
597  ib_ulint_t len); /*!< in: max data value len to copy */
598 
599 /** Read a signed int 8 bit column from an InnoDB tuple.
600  @return DB_SUCCESS or error */
601 ib_err_t ib_tuple_read_i8(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
602  ib_ulint_t i, /*!< in: column number */
603  ib_i8_t *ival); /*!< out: integer value */
604 
605 /** Read an unsigned int 8 bit column from an InnoDB tuple.
606  @return DB_SUCCESS or error */
607 ib_err_t ib_tuple_read_u8(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
608  ib_ulint_t i, /*!< in: column number */
609  ib_u8_t *ival); /*!< out: integer value */
610 
611 /** Read a signed int 16 bit column from an InnoDB tuple.
612  @return DB_SUCCESS or error */
613 ib_err_t ib_tuple_read_i16(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
614  ib_ulint_t i, /*!< in: column number */
615  ib_i16_t *ival); /*!< out: integer value */
616 
617 /** Read an unsigned int 16 bit column from an InnoDB tuple.
618  @return DB_SUCCESS or error */
619 ib_err_t ib_tuple_read_u16(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
620  ib_ulint_t i, /*!< in: column number */
621  ib_u16_t *ival); /*!< out: integer value */
622 
623 /** Read a signed int 32 bit column from an InnoDB tuple.
624  @return DB_SUCCESS or error */
625 ib_err_t ib_tuple_read_i32(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
626  ib_ulint_t i, /*!< in: column number */
627  ib_i32_t *ival); /*!< out: integer value */
628 
629 /** Read an unsigned int 32 bit column from an InnoDB tuple.
630  @return DB_SUCCESS or error */
631 ib_err_t ib_tuple_read_u32(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
632  ib_ulint_t i, /*!< in: column number */
633  ib_u32_t *ival); /*!< out: integer value */
634 
635 /** Read a signed int 64 bit column from an InnoDB tuple.
636  @return DB_SUCCESS or error */
637 ib_err_t ib_tuple_read_i64(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
638  ib_ulint_t i, /*!< in: column number */
639  ib_i64_t *ival); /*!< out: integer value */
640 
641 /** Read an unsigned int 64 bit column from an InnoDB tuple.
642  @return DB_SUCCESS or error */
643 ib_err_t ib_tuple_read_u64(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
644  ib_ulint_t i, /*!< in: column number */
645  ib_u64_t *ival); /*!< out: integer value */
646 
647 /** Get a column value pointer from the tuple.
648  @return NULL or pointer to buffer */
649 const void *ib_col_get_value(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
650  ib_ulint_t i); /*!< in: column number */
651 
652 /** Get a column type, length and attributes from the tuple.
653  @return len of column data */
655  ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
656  ib_ulint_t i, /*!< in: column number */
657  ib_col_meta_t *ib_col_meta); /*!< out: column meta data */
658 
659 /** "Clear" or reset an InnoDB tuple. We free the heap and recreate the tuple.
660  @return new tuple, or NULL */
661 ib_tpl_t ib_tuple_clear(ib_tpl_t ib_tpl); /*!< in: InnoDB tuple */
662 
663 /** Create a new cluster key search tuple and copy the contents of the
664  secondary index key tuple columns that refer to the cluster index record
665  to the cluster key. It does a deep copy of the column data.
666  @return DB_SUCCESS or error code */
668  ib_crsr_t ib_crsr, /*!< in: secondary index cursor */
669  ib_tpl_t *ib_dst_tpl, /*!< out,own: destination tuple */
670  const ib_tpl_t ib_src_tpl); /*!< in: source tuple */
671 
672 /** Create an InnoDB tuple used for index/table search.
673  @return tuple for current index */
675  ib_crsr_t ib_crsr); /*!< in: Cursor instance */
676 
677 /** Create an InnoDB tuple used for index/table search.
678  @return tuple for current index */
679 ib_tpl_t ib_sec_read_tuple_create(
680  ib_crsr_t ib_crsr); /*!< in: Cursor instance */
681 
682 /** Create an InnoDB tuple used for table key operations.
683  @return tuple for current table */
685  ib_crsr_t ib_crsr); /*!< in: Cursor instance */
686 
687 /** Create an InnoDB tuple for table row operations.
688  @return tuple for current table */
690  ib_crsr_t ib_crsr); /*!< in: Cursor instance */
691 
692 /** Return the number of user columns in the tuple definition.
693  @return number of user columns */
695  const ib_tpl_t ib_tpl); /*!< in: Tuple for current table */
696 
697 /** Return the number of columns in the tuple definition.
698  @return number of columns */
700  const ib_tpl_t ib_tpl); /*!< in: Tuple for current table */
701 
702 /** Destroy an InnoDB tuple. */
703 void ib_tuple_delete(ib_tpl_t ib_tpl); /*!< in,own: Tuple instance to delete */
704 
705 /** Get a table id.
706  @return DB_SUCCESS if found */
707 ib_err_t ib_table_get_id(const char *table_name, /*!< in: table to find */
708  ib_id_u64_t *table_id); /*!< out: table id if found */
709 
710 /** Check if cursor is positioned.
711  @return IB_true if positioned */
713  const ib_crsr_t ib_crsr); /*!< in: InnoDB cursor instance */
714 
715 /** Checks if the data dictionary is latched in exclusive mode by a
716  user transaction.
717  @return true if exclusive latch */
719  const ib_trx_t ib_trx); /*!< in: transaction */
720 
721 /** Lock an InnoDB cursor/table.
722  @return DB_SUCCESS or error code */
723 ib_err_t ib_cursor_lock(ib_crsr_t ib_crsr, /*!< in/out: InnoDB cursor */
724  ib_lck_mode_t ib_lck_mode); /*!< in: InnoDB lock mode */
725 
726 /** Set the Lock mode of the cursor.
727  @return DB_SUCCESS or error code */
729  ib_crsr_t ib_crsr, /*!< in/out: InnoDB cursor */
730  ib_lck_mode_t ib_lck_mode); /*!< in: InnoDB lock mode */
731 
732 /** Set need to access clustered index record flag. */
734  ib_crsr_t ib_crsr); /*!< in/out: InnoDB cursor */
735 
736 /** Inform the cursor that it's the start of an SQL statement. */
737 void ib_cursor_stmt_begin(ib_crsr_t ib_crsr); /*!< in: cursor */
738 
739 /** Write a double value to a column.
740  @return DB_SUCCESS or error */
741 ib_err_t ib_tuple_write_double(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
742  int col_no, /*!< in: column number */
743  double val); /*!< in: value to write */
744 
745 /** Read a double column value from an InnoDB tuple.
746  @return DB_SUCCESS or error */
747 ib_err_t ib_tuple_read_double(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
748  ib_ulint_t col_no, /*!< in: column number */
749  double *dval); /*!< out: double value */
750 
751 /** Write a float value to a column.
752  @return DB_SUCCESS or error */
753 ib_err_t ib_tuple_write_float(ib_tpl_t ib_tpl, /*!< in/out: tuple to write to */
754  int col_no, /*!< in: column number */
755  float val); /*!< in: value to write */
756 
757 /** Read a float value from an InnoDB tuple.
758  @return DB_SUCCESS or error */
759 ib_err_t ib_tuple_read_float(ib_tpl_t ib_tpl, /*!< in: InnoDB tuple */
760  ib_ulint_t col_no, /*!< in: column number */
761  float *fval); /*!< out: float value */
762 
763 /** Get a column type, length and attributes from the tuple.
764  @return len of column data */
765 const char *ib_col_get_name(
766  ib_crsr_t ib_crsr, /*!< in: InnoDB cursor instance */
767  ib_ulint_t i); /*!< in: column index in tuple */
768 
769 /** Get an index field name from the cursor.
770  @return name of the field */
771 const char *ib_get_idx_field_name(
772  ib_crsr_t ib_crsr, /*!< in: InnoDB cursor instance */
773  ib_ulint_t i); /*!< in: column index in tuple */
774 
775 /** Get generic configure status
776  @return configure status*/
777 int ib_cfg_get_cfg();
778 
779 /** Return isolation configuration set by "innodb_api_trx_level"
780  @return trx isolation level*/
782 
783 /** Return configure value for background commit interval (in seconds)
784  @return background commit interval (in seconds) */
786 
787 /** Get a trx start time.
788  @return trx start_time */
789 ib_u64_t ib_trx_get_start_time(ib_trx_t ib_trx); /*!< in: transaction */
790 
791 /** Wrapper of ut_strerr() which converts an InnoDB error number to a
792  human readable text message.
793  @return string, describing the error */
794 const char *ib_ut_strerr(ib_err_t num); /*!< in: error number */
795 
796 /** Get the SDI keys in a tablespace into vector.
797 @param[in] tablespace_id tablespace id
798 @param[in,out] ib_sdi_vector vector to hold objects with tablespace types
799 and ids
800 @param[in,out] trx data dictionary transaction
801 @return DB_SUCCESS if SDI keys retrieval is successful, else error */
802 ib_err_t ib_sdi_get_keys(uint32_t tablespace_id, ib_sdi_vector_t *ib_sdi_vector,
803  ib_trx_t trx);
804 
805 /** Retrieve SDI from tablespace
806 @param[in] tablespace_id tablespace id
807 @param[in] ib_sdi_key SDI key
808 @param[in,out] comp_sdi in: buffer to hold the SDI BLOB
809  out: compressed SDI retrieved from tablespace
810 @param[in,out] comp_sdi_len in: Size of memory allocated
811  out: compressed length of SDI
812 @param[out] uncomp_sdi_len out: uncompressed length of SDI
813 @param[in,out] trx innodb transaction
814 @return DB_SUCCESS if SDI retrieval is successful, else error
815 in case the passed buffer length is smaller than the actual SDI
816 DB_OUT_OF_MEMORY is thrown and uncompressed length is set in
817 uncomp_sdi_len */
818 ib_err_t ib_sdi_get(uint32_t tablespace_id, const ib_sdi_key_t *ib_sdi_key,
819  void *comp_sdi, uint32_t *comp_sdi_len,
820  uint32_t *uncomp_sdi_len, ib_trx_t trx);
821 
822 /** Insert/Update SDI in tablespace
823 @param[in] tablespace_id tablespace id
824 @param[in] sdi_key SDI key to uniquely identify the tablespace
825  object
826 @param[in] uncomp_len uncompressed length of SDI
827 @param[in] comp_len compressed length of SDI
828 @param[in] sdi compressed SDI to be stored in tablespace
829 @param[in,out] trx innodb transaction
830 @return DB_SUCCESS if SDI Insert/Update is successful, else error */
831 ib_err_t ib_sdi_set(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key,
832  uint32_t uncomp_len, uint32_t comp_len, const void *sdi,
833  ib_trx_t trx);
834 
835 /** Delete SDI from tablespace.
836 @param[in] tablespace_id tablespace id
837 @param[in] sdi_key SDI key to uniquely identify the tablespace
838 object
839 @param[in,out] trx innodb transaction
840 @return DB_SUCCESS if SDI deletion is successful, else error */
841 ib_err_t ib_sdi_delete(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key,
842  ib_trx_t trx);
843 
844 /** Create SDI in a tablespace
845 @param[in] tablespace_id InnoDB tablespace id
846 @return DB_SUCCESS if SDI index creation is successful, else error */
847 ib_err_t ib_sdi_create(space_id_t tablespace_id);
848 
849 /** Drop SDI Index from tablespace. This should be used only when SDI
850 is corrupted.
851 @param[in] tablespace_id InnoDB tablespace id
852 @return DB_SUCCESS if dropping of SDI indexes is successful, else error */
853 ib_err_t ib_sdi_drop(space_id_t tablespace_id);
854 
855 /** Flush SDI in a tablespace. The pages of a SDI copy modified by the
856 transaction will be flushed to disk.
857 @param[in] space_id tablespace id
858 @return DB_SUCCESS always*/
860 
861 #ifdef UNIV_MEMCACHED_SDI
862 /** Wrapper function to retrieve SDI from tablespace.
863 @param[in] crsr Memcached cursor
864 @param[in] key Memcached key
865 @param[in,out] sdi SDI data retrieved
866 @param[in,out] sdi_len in: Size of allocated memory
867  out: Actual SDI length
868 @return DB_SUCCESS if SDI retrieval is successful, else error */
869 ib_err_t ib_memc_sdi_get(ib_crsr_t crsr, const char *key, void *sdi,
870  uint64_t *sdi_len);
871 
872 /** Wrapper function to delete SDI from tablespace.
873 @param[in,out] crsr Memcached cursor
874 @param[in] key Memcached key
875 @return DB_SUCCESS if SDI deletion is successful, else error */
876 ib_err_t ib_memc_sdi_delete(ib_crsr_t crsr, const char *key);
877 
878 /** Wrapper function to insert SDI into tablespace.
879 @param[in] crsr Memcached cursor
880 @param[in] key Memcached key
881 @param[in] sdi SDI to be stored in tablespace
882 @param[in] sdi_len SDI length
883 @return DB_SUCCESS if SDI insertion is successful, else error */
884 ib_err_t ib_memc_sdi_set(ib_crsr_t crsr, const char *key, const void *sdi,
885  uint64_t *sdi_len);
886 
887 /** Wrapper function to create SDI in a tablespace.
888 @param[in,out] crsr Memcached cursor
889 @return DB_SUCCESS if SDI creation is successful, else error */
890 ib_err_t ib_memc_sdi_create(ib_crsr_t crsr);
891 
892 /** Wrapper function to drop SDI in a tablespace.
893 @param[in,out] crsr Memcached cursor
894 @return DB_SUCCESS if dropping of SDI is successful, else error */
895 ib_err_t ib_memc_sdi_drop(ib_crsr_t crsr);
896 
897 /* Wrapper function to retreive list of SDI keys into the buffer
898 The SDI keys are copied in the from x:y and separated by '|'.
899 @param[in,out] crsr Memcached cursor
900 @param[in] key Memcached key
901 @param[out] sdi The keys are copies into this buffer
902 @return DB_SUCCESS if SDI keys retrieval is successful, else error */
903 ib_err_t ib_memc_sdi_get_keys(ib_crsr_t crsr, const char *key, void *sdi,
904  uint64_t list_buf_len);
905 #endif /* UNIV_MEMCACHED_SDI */
906 
907 /** Check the table whether it contains virtual columns.
908 @param[in] crsr InnoDB Cursor
909 @return true if table contains virtual column else false. */
910 ib_bool_t ib_is_virtual_table(ib_crsr_t crsr);
911 
912 #ifdef UNIV_MEMCACHED_SDI
913 #define ONLY_FOR_MEMCACHED_SDI(x) x
914 #else
915 #define ONLY_FOR_MEMCACHED_SDI(x)
916 #endif
917 
918 #define FOR_EACH_API_METHOD_NAME_STEM(transform) \
919  transform(cursor_open_table) /**/ \
920  transform(cursor_read_row) /**/ \
921  transform(cursor_insert_row) /**/ \
922  transform(cursor_delete_row) /**/ \
923  transform(cursor_update_row) /**/ \
924  transform(cursor_moveto) /**/ \
925  transform(cursor_first) /**/ \
926  transform(cursor_next) /**/ \
927  transform(cursor_set_match_mode) /**/ \
928  transform(sec_search_tuple_create) /**/ \
929  transform(clust_read_tuple_create) /**/ \
930  transform(tuple_delete) /**/ \
931  transform(tuple_read_u8) /**/ \
932  transform(tuple_read_u16) /**/ \
933  transform(tuple_read_u32) /**/ \
934  transform(tuple_read_u64) /**/ \
935  transform(tuple_read_i8) /**/ \
936  transform(tuple_read_i16) /**/ \
937  transform(tuple_read_i32) /**/ \
938  transform(tuple_read_i64) /**/ \
939  transform(tuple_get_n_cols) /**/ \
940  transform(col_set_value) /**/ \
941  transform(col_get_value) /**/ \
942  transform(col_get_meta) /**/ \
943  transform(trx_begin) /**/ \
944  transform(trx_commit) /**/ \
945  transform(trx_rollback) /**/ \
946  transform(trx_start) /**/ \
947  transform(trx_release) /**/ \
948  transform(cursor_lock) /**/ \
949  transform(cursor_close) /**/ \
950  transform(cursor_new_trx) /**/ \
951  transform(cursor_reset) /**/ \
952  transform(col_get_name) /**/ \
953  transform(cursor_open_index_using_name) /**/ \
954  transform(cfg_get_cfg) /**/ \
955  transform(cursor_set_cluster_access) /**/ \
956  transform(cursor_commit_trx) /**/ \
957  transform(cfg_trx_level) /**/ \
958  transform(tuple_get_n_user_cols) /**/ \
959  transform(cursor_set_lock_mode) /**/ \
960  transform(get_idx_field_name) /**/ \
961  transform(trx_get_start_time) /**/ \
962  transform(cfg_bk_commit_interval) /**/ \
963  transform(ut_strerr) /**/ \
964  transform(cursor_stmt_begin) /**/ \
965  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_get)) /**/ \
966  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_delete)) /**/ \
967  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_set)) /**/ \
968  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_create)) /**/ \
969  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_drop)) /**/ \
970  ONLY_FOR_MEMCACHED_SDI(transform(memc_sdi_get_keys)) /**/ \
971  transform(trx_read_only) /**/ \
972  transform(is_virtual_table) /**/
973 
974 #endif /* api0api_h */
ib_bool_t ib_is_virtual_table(ib_crsr_t crsr)
Check the table whether it contains virtual columns.
Definition: api0api.cc:888
ib_tbl_fmt_t
InnoDB table format types.
Definition: api0api.h:237
const char * ib_ut_strerr(ib_err_t num)
Wrapper of ut_strerr() which converts an InnoDB error number to a human readable text message...
Definition: api0api.cc:2780
ib_err_t ib_cursor_commit_trx(ib_crsr_t ib_crsr, ib_trx_t ib_trx)
Commit the transaction in a cursor.
Definition: api0api.cc:950
ib_err_t ib_sdi_set(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key, uint32_t uncomp_len, uint32_t comp_len, const void *sdi, ib_trx_t trx)
Insert/Update SDI in tablespace.
ib_ulint_t ib_tuple_get_n_user_cols(const ib_tpl_t ib_tpl)
Return the number of user columns in the tuple definition.
Definition: api0api.cc:2536
void ib_cursor_set_match_mode(ib_crsr_t ib_crsr, ib_match_mode_t match_mode)
Set the match mode for ib_cursor_move().
Definition: api0api.cc:1774
uint32 page_no_t
Page number.
Definition: api0api.h:57
If search key is not found then position the cursor on the row that is less than or equal to the sear...
Definition: api0api.h:323
Global error codes for the database.
Intention shared, an intention lock should be used to lock tables.
Definition: api0api.h:282
Exclusive locks should be used to lock rows.
Definition: api0api.h:291
Search using a complete key value.
Definition: api0api.h:333
Column data can&#39;t be NULL.
Definition: api0api.h:260
enum dberr_t ib_err_t
All InnoDB error codes are represented by ib_err_t.
Definition: api0api.h:78
ib_err_t ib_cursor_reset(ib_crsr_t ib_crsr)
Reset the cursor.
Definition: api0api.cc:905
The configuration parameter is of type ulint.
Definition: api0api.h:181
ib_err_t ib_cursor_open_table(const char *name, ib_trx_t ib_trx, ib_crsr_t *ib_crsr)
Open an InnoDB table by name and return a cursor handle to it.
Definition: api0api.cc:839
uint8_t ib_u8_t
An unsigned 8 bit integral type.
Definition: api0api.h:108
ib_err_t ib_cursor_update_row(ib_crsr_t ib_crsr, const ib_tpl_t ib_old_tpl, const ib_tpl_t ib_new_tpl)
Update a row in a table.
Definition: api0api.cc:1420
FILE * ib_msg_stream_t
The first argument to the InnoDB message logging function.
Definition: api0api.h:400
Definition: trx0trx.h:829
uint64_t ib_u64_t
An unsigned 64 bit integral type.
Definition: api0api.h:156
ib_err_t ib_cursor_next(ib_crsr_t ib_crsr)
Move cursor to the next record in the table.
Definition: api0api.cc:1702
ib_err_t ib_sdi_create(space_id_t tablespace_id)
Create SDI in a tablespace.
Definition: api0api.cc:3199
struct ib_cursor_t * ib_crsr_t
InnoDB cursor handle.
Definition: api0api.h:428
Search using a key prefix which must match to rows: the prefix may contain an incomplete field (the l...
Definition: api0api.h:336
ib_tpl_t ib_tuple_clear(ib_tpl_t ib_tpl)
"Clear" or reset an InnoDB tuple.
Definition: api0api.cc:2390
ib_col_attr_t
InnoDB column attributes.
Definition: api0api.h:257
int64_t ib_i64_t
A signed 64 bit integral type.
Definition: api0api.h:148
ib_trx_level_t ib_cfg_trx_level()
Return isolation configuration set by "innodb_api_trx_level".
Definition: api0api.cc:2749
ib_ulint_t ib_col_get_meta(ib_tpl_t ib_tpl, ib_ulint_t i, ib_col_meta_t *ib_col_meta)
Get a column type, length and attributes from the tuple.
Definition: api0api.cc:2380
ib_ulint_t ib_cfg_bk_commit_interval()
Return configure value for background commit interval (in seconds)
Definition: api0api.cc:2755
ib_err_t ib_cursor_new_trx(ib_crsr_t ib_crsr, ib_trx_t ib_trx)
update the cursor with new transactions and also reset the cursor
Definition: api0api.cc:926
mode
Definition: file_handle.h:58
unsigned long int ib_ulint_t
Representation of an unsigned long int within InnoDB.
Definition: api0api.h:85
struct trx_t * ib_trx_t
InnoDB transaction handle, all database operations need to be covered by transactions.
Definition: api0api.h:425
int8_t ib_i8_t
A signed 8 bit integral type.
Definition: api0api.h:100
exclusive table lock
Definition: api0api.h:294
int(* ib_client_cmp_t)(const ib_col_meta_t *col_meta, const ib_byte_t *p1, ib_ulint_t p1_len, const ib_byte_t *p2, ib_ulint_t p2_len)
This function is used to compare two data fields for which the data type is such that we must use the...
Definition: api0api.h:440
ib_err_t ib_cursor_lock(ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode)
Lock an InnoDB cursor/table.
Definition: api0api.cc:2610
Any charset, varying length.
Definition: api0api.h:230
ib_tpl_t ib_sec_search_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for index/table search.
Definition: api0api.cc:2481
Closest match possible.
Definition: api0api.h:331
All consistent reads in the same trx read the same snapshot; full next-key locking used in locking re...
Definition: api0api.h:377
Definition: api0misc.h:60
ib_err_t ib_table_get_id(const char *table_name, ib_id_u64_t *table_id)
Get a table id.
Definition: api0api.cc:2573
ib_err_t ib_trx_rollback(ib_trx_t ib_trx)
Rollback a transaction.
Definition: api0api.cc:596
ib_bool_t ib_schema_lock_is_exclusive(const ib_trx_t ib_trx)
Checks if the data dictionary is latched in exclusive mode by a user transaction. ...
Definition: api0api.cc:2600
ib_index_type_t
Definition: api0api.h:302
ib_err_t ib_tuple_read_i32(ib_tpl_t ib_tpl, ib_ulint_t i, ib_i32_t *ival)
Read a signed int 32 bit column from an InnoDB tuple.
Definition: api0api.cc:2294
uint16_t ib_u16_t
An unsigned 16 bit integral type.
Definition: api0api.h:124
const std::string FILE("FILE")
ib_err_t ib_tuple_read_u64(ib_tpl_t ib_tpl, ib_ulint_t i, ib_u64_t *ival)
Read an unsigned int 64 bit column from an InnoDB tuple.
Definition: api0api.cc:2345
ib_match_mode_t
Various match modes used by ib_cursor_moveto()
Definition: api0api.h:330
ib_ulint_t ib_bool_t
Definition: api0api.h:161
Shared locks should be used to lock rows.
Definition: api0api.h:288
ib_err_t ib_trx_release(ib_trx_t ib_trx)
Release the resources of the transaction.
Definition: api0api.cc:566
int16_t ib_i16_t
A signed 16 bit integral type.
Definition: api0api.h:116
If search key is not found then position the cursor on the row that is greater than the search key...
Definition: api0api.h:310
ib_col_attr_t attr
Column attributes.
Definition: api0api.h:347
Somewhat Oracle-like isolation, except that in range UPDATE and DELETE we must block phantom rows wit...
Definition: api0api.h:367
Definition: api0misc.h:64
ib_cfg_type_t
Possible types for a configuration variable.
Definition: api0api.h:165
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:270
ib_ulint_t ib_col_get_len(ib_tpl_t ib_tpl, ib_ulint_t i)
Get the size of the data available in the column the tuple.
Definition: api0api.cc:1996
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:266
Similar to dynamic format but with pages compressed.
Definition: api0api.h:252
ib_trx_level_t
Transaction isolation levels.
Definition: api0api.h:359
ib_err_t ib_col_set_value(ib_tpl_t ib_tpl, ib_ulint_t col_no, const void *src, ib_ulint_t len, ib_bool_t need_cpy)
Set a column of the tuple.
Definition: api0api.cc:1813
Redundant row format, the column type and length is stored in the row.
Definition: api0api.h:238
Cursor instance for traversing tables/indexes.
Definition: api0api.cc:123
Binary large object, or a TEXT type.
Definition: api0api.h:208
const char * ib_get_idx_field_name(ib_crsr_t ib_crsr, ib_ulint_t i)
Get an index field name from the cursor.
Definition: api0api.cc:2149
ib_err_t ib_tuple_read_double(ib_tpl_t ib_tpl, ib_ulint_t col_no, double *dval)
Read a double column value from an InnoDB tuple.
Definition: api0api.cc:2687
uint32_t ib_u32_t
An unsigned 32 bit integral type.
Definition: api0api.h:140
Character varying length.
Definition: api0api.h:196
C (double) floating point value.
Definition: api0api.h:227
C (float) floating point value.
Definition: api0api.h:223
void ib_tuple_delete(ib_tpl_t ib_tpl)
Destroy an InnoDB tuple.
Definition: api0api.cc:2560
dberr_t
Definition: db0err.h:38
ib_col_type_t type
Type of the column.
Definition: api0api.h:345
ib_err_t ib_tuple_read_float(ib_tpl_t ib_tpl, ib_ulint_t col_no, float *fval)
Read a float value from an InnoDB tuple.
Definition: api0api.cc:2727
ib_err_t ib_cursor_moveto(ib_crsr_t ib_crsr, ib_tpl_t ib_tpl, ib_srch_mode_t ib_srch_mode, ib_ulint_t direction)
Search for key.
Definition: api0api.cc:1723
ib_err_t ib_tuple_read_u32(ib_tpl_t ib_tpl, ib_ulint_t i, ib_u32_t *ival)
Read an unsigned int 32 bit column from an InnoDB tuple.
Definition: api0api.cc:2311
ib_tpl_t ib_clust_read_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple for table row operations.
Definition: api0api.cc:2521
Definition: api0api.h:225
ib_bool_t ib_cursor_is_positioned(const ib_crsr_t ib_crsr)
Check if cursor is positioned.
Definition: api0api.cc:2589
ib_err_t ib_trx_commit(ib_trx_t ib_trx)
Commit a transaction.
Definition: api0api.cc:579
Custom precision type, this is a bit that is ignored by InnoDB and so can be set and queried by users...
Definition: api0api.h:274
case opt name
Definition: sslopt-case.h:32
unsigned int uint32
Definition: api0api.h:45
uint32_t uint32
Definition: my_inttypes.h:66
If search key is not found then position the cursor on the row that is less than the search key...
Definition: api0api.h:319
ib_err_t ib_cursor_first(ib_crsr_t ib_crsr)
Move cursor to the first record in the table.
Definition: api0api.cc:1693
void(* ib_cb_t)(void)
Generical InnoDB callback prototype.
Definition: api0api.h:387
ib_err_t ib_sdi_drop(space_id_t tablespace_id)
Drop SDI Index from tablespace.
Definition: api0api.cc:3236
If the search key not found then position the cursor on the row that is greater than or equal to the ...
Definition: api0api.h:314
ib_col_type_t
column types that are supported.
Definition: api0api.h:195
ib_err_t ib_cursor_insert_row(ib_crsr_t ib_crsr, const ib_tpl_t ib_tpl)
Insert a row to a table.
Definition: api0api.cc:1119
ib_u32_t type_len
Length of type.
Definition: api0api.h:349
Any charset, fixed length.
Definition: api0api.h:232
int(* ib_msg_log_t)(ib_msg_stream_t, const char *,...)
All log messages are written to this function.It should have the same behavior as fprintf(3)...
Definition: api0api.h:404
ib_err_t ib_tuple_read_i8(ib_tpl_t ib_tpl, ib_ulint_t i, ib_i8_t *ival)
Read a signed int 8 bit column from an InnoDB tuple.
Definition: api0api.cc:2226
void * ib_opaque_t
Definition: api0api.h:159
static const char * key
Definition: suite_stubs.c:14
ib_err_t ib_cursor_close(ib_crsr_t ib_crsr)
Close an InnoDB table and free the cursor.
Definition: api0api.cc:967
unsigned char ib_byte_t
Representation of a byte within InnoDB.
Definition: api0api.h:80
struct ib_tuple_t * ib_tpl_t
InnoDB tuple handle.
Definition: api0api.h:416
#define dval(x)
Definition: dtoa.cc:614
clustered index
Definition: api0api.h:303
System column, this column can be one of DATA_TRX_ID, DATA_ROLL_PTR or DATA_ROW_ID.
Definition: api0api.h:219
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
ib_srch_mode_t
InnoDB cursor search modes for ib_cursor_moveto().
Definition: api0api.h:309
ib_ulint_t ib_tuple_get_n_cols(const ib_tpl_t ib_tpl)
Return the number of columns in the tuple definition.
Definition: api0api.cc:2551
ib_err_t ib_tuple_read_u8(ib_tpl_t ib_tpl, ib_ulint_t i, ib_u8_t *ival)
Read an unsigned int 8 bit column from an InnoDB tuple.
Definition: api0api.cc:2243
void ib_cursor_set_cluster_access(ib_crsr_t ib_crsr)
Set need to access clustered index record flag.
Definition: api0api.cc:2649
int32_t ib_i32_t
A signed 32 bit integral type.
Definition: api0api.h:132
ib_err_t ib_tuple_write_double(ib_tpl_t ib_tpl, int col_no, double val)
Write a double value to a column.
Definition: api0api.cc:2668
ib_charset_t * charset
Column charset.
Definition: api0api.h:354
Future use, reserved.
Definition: api0api.h:264
Variable length binary.
Definition: api0api.h:206
unique index
Definition: api0api.h:304
Integer: can be any size from 1 - 8 bytes.
Definition: api0api.h:211
ib_err_t ib_sdi_flush(space_id_t space_id)
Flush SDI in a tablespace.
Definition: api0api.cc:3290
Fixed length character string.
Definition: api0api.h:199
The configuration parameter is of type ibool.
Definition: api0api.h:166
ib_opaque_t ib_charset_t
Definition: api0api.h:160
ib_u16_t client_type
16 bits of data relevant only to the client.
Definition: api0api.h:351
ib_u32_t ib_trx_read_only(ib_trx_t ib_trx)
Check if the transaction is read_only.
Definition: api0api.cc:551
ib_err_t ib_sdi_get(uint32_t tablespace_id, const ib_sdi_key_t *ib_sdi_key, void *comp_sdi, uint32_t *comp_sdi_len, uint32_t *uncomp_sdi_len, ib_trx_t trx)
Retrieve SDI from tablespace.
ib_err_t ib_tuple_read_i16(ib_tpl_t ib_tpl, ib_ulint_t i, ib_i16_t *ival)
Read a signed int 16 bit column from an InnoDB tuple.
Definition: api0api.cc:2260
The configuration parameter is a callback parameter.
Definition: api0api.h:190
ib_ulint_t ib_col_copy_value(ib_tpl_t ib_tpl, ib_ulint_t i, void *dst, ib_ulint_t len)
Copy a column value from the tuple.
Definition: api0api.cc:2103
const char * ib_col_get_name(ib_crsr_t ib_crsr, ib_ulint_t i)
Get a column type, length and attributes from the tuple.
Definition: api0api.cc:2132
ib_match_mode_t match_mode
ib_cursor_moveto match mode
Definition: api0api.cc:130
ib_err_t ib_sdi_delete(uint32_t tablespace_id, const ib_sdi_key_t *sdi_key, ib_trx_t trx)
Delete SDI from tablespace.
static const size_t REC_BUF_SLOT_SIZE
Used by ib_read_tuple to determine number of bytes to allocate for new slot if needed.
Definition: api0api.h:395
ib_u64_t ib_id_u64_t
Definition: api0api.h:162
ib_err_t ib_tuple_get_cluster_key(ib_crsr_t ib_crsr, ib_tpl_t *ib_dst_tpl, const ib_tpl_t ib_src_tpl)
Create a new cluster key search tuple and copy the contents of the secondary index key tuple columns ...
Definition: api0api.cc:2414
ib_err_t ib_tuple_read_i64(ib_tpl_t ib_tpl, ib_ulint_t i, ib_i64_t *ival)
Read a signed int 64 bit column from an InnoDB tuple.
Definition: api0api.cc:2328
ib_err_t ib_cursor_delete_row(ib_crsr_t ib_crsr)
Delete a row in a table.
Definition: api0api.cc:1524
InnoDB column meta data.
Definition: api0api.h:344
InnoDB tuple used for key operations.
Definition: api0api.cc:199
Fixed length binary, similar to IB_CHAR but the column is not padded to the right.
Definition: api0api.h:202
Intention exclusive, an intention lock should be used to lock tables.
Definition: api0api.h:285
ib_err_t ib_trx_start(ib_trx_t ib_trx, ib_trx_level_t ib_trx_level, ib_bool_t read_write, ib_bool_t auto_commit, void *thd)
Start a transaction that&#39;s been rolled back.
Definition: api0api.cc:497
No special attributes.
Definition: api0api.h:258
ib_tpl_t ib_clust_search_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for table key operations.
Definition: api0api.cc:2506
ib_err_t ib_cursor_open_index_using_name(ib_crsr_t ib_open_crsr, const char *index_name, ib_crsr_t *ib_crsr, int *idx_type, ib_id_u64_t *idx_id)
Open an InnoDB secondary index cursor and return a cursor handle to it.
Definition: api0api.cc:774
number of lock modes
Definition: api0api.h:299
Compact row format, the column type is not stored in the row.
Definition: api0api.h:241
This is used internally to note consistent read.
Definition: api0api.h:296
All plain SELECTs are converted to LOCK IN SHARE MODE reads.
Definition: api0api.h:382
ib_err_t ib_cursor_set_lock_mode(ib_crsr_t ib_crsr, ib_lck_mode_t ib_lck_mode)
Set the Lock mode of the cursor.
Definition: api0api.cc:2624
ib_err_t ib_tuple_write_float(ib_tpl_t ib_tpl, int col_no, float val)
Write a float value to a column.
Definition: api0api.cc:2709
The configuration parameter is of type ulong.
Definition: api0api.h:184
Compact row format.
Definition: api0api.h:249
The configuration parameter is of type char*.
Definition: api0api.h:187
Column is IB_INT and unsigned.
Definition: api0api.h:262
ib_tpl_t ib_sec_read_tuple_create(ib_crsr_t ib_crsr)
Create an InnoDB tuple used for index/table search.
Definition: api0api.cc:2494
ib_err_t ib_sdi_get_keys(uint32_t tablespace_id, ib_sdi_vector_t *ib_sdi_vector, ib_trx_t trx)
Get the SDI keys in a tablespace into vector.
Dirty read: non-locking SELECTs are performed so that we do not look at a possible earlier version of...
Definition: api0api.h:360
ib_u64_t ib_trx_get_start_time(ib_trx_t ib_trx)
Get a trx start time.
Definition: api0api.cc:559
ib_lck_mode_t
InnoDB lock modes.
Definition: api0api.h:281
ib_err_t ib_tuple_read_u16(ib_tpl_t ib_tpl, ib_ulint_t i, ib_u16_t *ival)
Read an unsigned int 16 bit column from an InnoDB tuple.
Definition: api0api.cc:2277
ib_trx_t ib_trx_begin(ib_trx_level_t ib_trx_level, ib_bool_t read_write, ib_bool_t auto_commit, void *thd)
Begin a transaction.
Definition: api0api.cc:529
void ib_cursor_stmt_begin(ib_crsr_t ib_crsr)
Inform the cursor that it&#39;s the start of an SQL statement.
Definition: api0api.cc:2659
const void * ib_col_get_value(ib_tpl_t ib_tpl, ib_ulint_t i)
Get a column value pointer from the tuple.
Definition: api0api.cc:2362
int ib_cfg_get_cfg()
Get generic configure status.
Definition: api0api.cc:2761
ib_err_t ib_cursor_read_row(ib_crsr_t ib_crsr, ib_tpl_t ib_tpl, ib_tpl_t cmp_tpl, int mode, void **row_buf, ib_ulint_t *row_len, ib_ulint_t *used_len)
Read current row.
Definition: api0api.cc:1592
const char * table_name
Definition: rules_table_service.cc:55