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