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