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