├── CMakeLists.txt ├── COPYING ├── COPYING.Google ├── COPYING.Percona ├── COPYING.Sun_Microsystems ├── ChangeLog ├── Makefile.am ├── Makefile.in ├── README ├── aclocal.m4 ├── aconf ├── compile ├── config.guess ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh └── missing ├── api ├── api0api.c ├── api0cfg.c ├── api0misc.c ├── api0sql.c ├── api0status.c └── api0ucode.c ├── btr ├── btr0btr.c ├── btr0cur.c ├── btr0pcur.c └── btr0sea.c ├── buf ├── buf0buddy.c ├── buf0buf.c ├── buf0flu.c ├── buf0lru.c └── buf0rea.c ├── config.h.cmake ├── config.h.in ├── configure ├── configure.in ├── data ├── data0data.c └── data0type.c ├── ddl └── ddl0ddl.c ├── dict ├── dict0boot.c ├── dict0crea.c ├── dict0dict.c ├── dict0load.c └── dict0mem.c ├── dyn └── dyn0dyn.c ├── eval ├── eval0eval.c └── eval0proc.c ├── fil └── fil0fil.c ├── fsp └── fsp0fsp.c ├── fut ├── fut0fut.c └── fut0lst.c ├── ha ├── ha0ha.c ├── ha0storage.c └── hash0hash.c ├── ibuf └── ibuf0ibuf.c ├── include ├── api0api.h ├── api0misc.h ├── api0ucode.h ├── btr0btr.h ├── btr0btr.ic ├── btr0cur.h ├── btr0cur.ic ├── btr0pcur.h ├── btr0pcur.ic ├── btr0sea.h ├── btr0sea.ic ├── btr0types.h ├── buf0buddy.h ├── buf0buddy.ic ├── buf0buf.h ├── buf0buf.ic ├── buf0flu.h ├── buf0flu.ic ├── buf0lru.h ├── buf0lru.ic ├── buf0rea.h ├── buf0types.h ├── data0data.h ├── data0data.ic ├── data0type.h ├── data0type.ic ├── data0types.h ├── db0err.h ├── ddl0ddl.h ├── dict0boot.h ├── dict0boot.ic ├── dict0crea.h ├── dict0crea.ic ├── dict0dict.h ├── dict0dict.ic ├── dict0load.h ├── dict0load.ic ├── dict0mem.h ├── dict0mem.ic ├── dict0types.h ├── dyn0dyn.h ├── dyn0dyn.ic ├── eval0eval.h ├── eval0eval.ic ├── eval0proc.h ├── eval0proc.ic ├── fil0fil.h ├── fsp0fsp.h ├── fsp0fsp.ic ├── fsp0types.h ├── fut0fut.h ├── fut0fut.ic ├── fut0lst.h ├── fut0lst.ic ├── ha0ha.h ├── ha0ha.ic ├── ha0storage.h ├── ha0storage.ic ├── hash0hash.h ├── hash0hash.ic ├── ib0config.h ├── ibuf0ibuf.h ├── ibuf0ibuf.ic ├── ibuf0types.h ├── lock0iter.h ├── lock0lock.h ├── lock0lock.ic ├── lock0priv.h ├── lock0priv.ic ├── lock0types.h ├── log0log.h ├── log0log.ic ├── log0recv.h ├── log0recv.ic ├── mach0data.h ├── mach0data.ic ├── mem0dbg.h ├── mem0dbg.ic ├── mem0mem.h ├── mem0mem.ic ├── mtr0log.h ├── mtr0log.ic ├── mtr0mtr.h ├── mtr0mtr.ic ├── mtr0types.h ├── os0file.h ├── os0proc.h ├── os0proc.ic ├── os0sync.h ├── os0sync.ic ├── os0thread.h ├── os0thread.ic ├── page0cur.h ├── page0cur.ic ├── page0page.h ├── page0page.ic ├── page0types.h ├── page0zip.h ├── page0zip.ic ├── pars0grm.h ├── pars0opt.h ├── pars0opt.ic ├── pars0pars.h ├── pars0pars.ic ├── pars0sym.h ├── pars0sym.ic ├── pars0types.h ├── que0que.h ├── que0que.ic ├── que0types.h ├── read0read.h ├── read0read.ic ├── read0types.h ├── rem0cmp.h ├── rem0cmp.ic ├── rem0rec.h ├── rem0rec.ic ├── rem0types.h ├── row0ext.h ├── row0ext.ic ├── row0ins.h ├── row0ins.ic ├── row0merge.h ├── row0prebuilt.h ├── row0purge.h ├── row0purge.ic ├── row0row.h ├── row0row.ic ├── row0sel.h ├── row0sel.ic ├── row0types.h ├── row0uins.h ├── row0uins.ic ├── row0umod.h ├── row0umod.ic ├── row0undo.h ├── row0undo.ic ├── row0upd.h ├── row0upd.ic ├── row0vers.h ├── row0vers.ic ├── srv0que.h ├── srv0srv.h ├── srv0srv.ic ├── srv0start.h ├── sync0arr.h ├── sync0arr.ic ├── sync0rw.h ├── sync0rw.ic ├── sync0sync.h ├── sync0sync.ic ├── sync0types.h ├── thr0loc.h ├── thr0loc.ic ├── trx0purge.h ├── trx0purge.ic ├── trx0rec.h ├── trx0rec.ic ├── trx0roll.h ├── trx0roll.ic ├── trx0rseg.h ├── trx0rseg.ic ├── trx0sys.h ├── trx0sys.ic ├── trx0trx.h ├── trx0trx.ic ├── trx0types.h ├── trx0undo.h ├── trx0undo.ic ├── trx0xa.h ├── univ.i ├── usr0sess.h ├── usr0sess.ic ├── usr0types.h ├── ut0byte.h ├── ut0byte.ic ├── ut0dbg.h ├── ut0list.h ├── ut0list.ic ├── ut0lst.h ├── ut0mem.h ├── ut0mem.ic ├── ut0rnd.h ├── ut0rnd.ic ├── ut0sort.h ├── ut0ut.h ├── ut0ut.ic ├── ut0vec.h └── ut0vec.ic ├── innodb.h ├── lock ├── lock0iter.c └── lock0lock.c ├── log ├── log0log.c └── log0recv.c ├── mach └── mach0data.c ├── make-header ├── mem └── mem0mem.c ├── mtr ├── mtr0log.c └── mtr0mtr.c ├── os ├── os0file.c ├── os0proc.c ├── os0sync.c └── os0thread.c ├── page ├── page0cur.c ├── page0page.c └── page0zip.c ├── pars ├── lexyy.c ├── make_bison.sh ├── make_flex.sh ├── pars0grm.c ├── pars0grm.y ├── pars0lex.l ├── pars0opt.c ├── pars0pars.c └── pars0sym.c ├── que └── que0que.c ├── read └── read0read.c ├── rem ├── rem0cmp.c └── rem0rec.c ├── row ├── row0ext.c ├── row0ins.c ├── row0merge.c ├── row0prebuilt.c ├── row0purge.c ├── row0row.c ├── row0sel.c ├── row0uins.c ├── row0umod.c ├── row0undo.c ├── row0upd.c └── row0vers.c ├── srv ├── srv0que.c ├── srv0srv.c └── srv0start.c ├── sync ├── sync0arr.c ├── sync0rw.c └── sync0sync.c ├── tests ├── CMakeLists.examples ├── CMakeLists.txt ├── Makefile.am ├── Makefile.examples ├── Makefile.in ├── README ├── ib_cfg.c ├── ib_compressed.c ├── ib_cursor.c ├── ib_ddl.c ├── ib_deadlock.c ├── ib_dict.c ├── ib_drop.c ├── ib_index.c ├── ib_logger.c ├── ib_mt_base.c ├── ib_mt_base.h ├── ib_mt_drv.c ├── ib_mt_drv.h ├── ib_mt_stress.c ├── ib_mt_t1.c ├── ib_mt_t2.c ├── ib_perf1.c ├── ib_recover.c ├── ib_search.c ├── ib_shutdown.c ├── ib_status.c ├── ib_tablename.c ├── ib_test1.c ├── ib_test2.c ├── ib_test3.c ├── ib_test5.c ├── ib_types.c ├── ib_update.c ├── ib_zip.c ├── test0aux.c └── test0aux.h ├── thr └── thr0loc.c ├── trx ├── trx0purge.c ├── trx0rec.c ├── trx0roll.c ├── trx0rseg.c ├── trx0sys.c ├── trx0trx.c └── trx0undo.c ├── usr └── usr0sess.c ├── ut ├── ut0byte.c ├── ut0dbg.c ├── ut0list.c ├── ut0mem.c ├── ut0rnd.c ├── ut0ut.c └── ut0vec.c └── win └── innodb.def /COPYING.Google: -------------------------------------------------------------------------------- 1 | Portions of this software contain modifications contributed by Google, Inc. 2 | These contributions are used with the following license: 3 | 4 | Copyright (c) 2008, Google Inc. All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | * Neither the name of the Google Inc. nor the names of its 16 | contributors may be used to endorse or promote products 17 | derived from this software without specific prior written 18 | permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /COPYING.Percona: -------------------------------------------------------------------------------- 1 | Portions of this software contain modifications contributed by Percona, Inc. 2 | These contributions are used with the following license: 3 | 4 | Copyright (c) 2008, 2009, Percona Inc. All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | * Neither the name of the Percona Inc. nor the names of its 16 | contributors may be used to endorse or promote products 17 | derived from this software without specific prior written 18 | permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /COPYING.Sun_Microsystems: -------------------------------------------------------------------------------- 1 | Portions of this software contain modifications contributed by 2 | Sun Microsystems, Inc. These contributions are used with the following 3 | license: 4 | 5 | Copyright (c) 2009, Sun Microsystems, Inc. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions 10 | are met: 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials 16 | provided with the distribution. 17 | * Neither the name of Sun Microsystems, Inc. nor the names of its 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is the source of the Embedded InnoDB 1.0.6.6750 2 | ==================================================== 3 | 4 | Requirements 5 | =============================================== 6 | Zlib >= 1.2.x Need the development header files and library 7 | CMake 2.6 or above for building binaries on Windows 8 | 9 | Unix 10 | =============================================== 11 | 12 | Instructions for compiling and installing: 13 | ------------------------------------------ 14 | 15 | 1. ./configure 16 | 17 | If you want to disable support for compressed tables you can run 18 | configure with the following command line argument: 19 | 20 | ./configure --disable-compression 21 | 22 | By default, support for compressed tables is enabled. 23 | 24 | If you want to disable support for shared libraries you can run 25 | configure with the following command line argument: 26 | 27 | ./configure --disable-shared 28 | 29 | By default, it will build both shared and static libraries 30 | 31 | The configure script attempts to select the optimal latching implementation 32 | for your configuration, if not explicitly set on the configure command line. 33 | If you need to force a particular selection you can use the following 34 | command line argument to select: 35 | 36 | --with-atomic-ops= one of [gcc_builtins|solaris|innodb] 37 | 38 | 2. make 39 | 40 | 3. make install 41 | 42 | 4. Enjoy! 43 | 44 | Windows 45 | =============================================== 46 | 47 | Instructions for compiling and installing: 48 | ------------------------------------------ 49 | 50 | 1. cmake -G 51 | The generator could be one of the followings: 52 | Visual Studio 7 = Generates Visual Studio .NET 2002 project files. 53 | Visual Studio 7 .NET 2003 = Generates Visual Studio .NET 2003 project files 54 | Visual Studio 8 2005 = Generates Visual Studio .NET 2005 project files 55 | Visual Studio 8 2005 Win64 = Generates Visual Studio .NET 2005 Win64 project files. 56 | Visual Studio 9 2008 = Generates Visual Studio 9 2008 project files. 57 | Visual Studio 9 2008 Win64 = Generates Visual Studio 9 2008 Win64 project files 58 | 59 | 2. start Visual Studio, and open solution file EMBEDDED_INNODB.sln 60 | 61 | 3. build ALL_BUILD 62 | 63 | 4. build INSTALL 64 | 65 | 5. Enjoy! 66 | 67 | See the online documentation for more detailed instructions: 68 | http://www.innodb.com/doc/embedded_innodb-1.0/ 69 | 70 | For more information about InnoDB, visit: 71 | http://www.innodb.com 72 | 73 | Please report any problems or issues with the software in the InnoDB Forums: 74 | http://forums.innodb.com/ 75 | 76 | Thank you for using Embedded InnoDB! 77 | -------------------------------------------------------------------------------- /dyn/dyn0dyn.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file dyn/dyn0dyn.c 21 | The dynamically allocated array 22 | 23 | Created 2/5/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "dyn0dyn.h" 27 | #ifdef UNIV_NONINL 28 | #include "dyn0dyn.ic" 29 | #endif 30 | 31 | /************************************************************//** 32 | Adds a new block to a dyn array. 33 | @return created block */ 34 | UNIV_INTERN 35 | dyn_block_t* 36 | dyn_array_add_block( 37 | /*================*/ 38 | dyn_array_t* arr) /*!< in: dyn array */ 39 | { 40 | mem_heap_t* heap; 41 | dyn_block_t* block; 42 | 43 | ut_ad(arr); 44 | ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N); 45 | 46 | if (arr->heap == NULL) { 47 | UT_LIST_INIT(arr->base); 48 | UT_LIST_ADD_FIRST(list, arr->base, arr); 49 | 50 | arr->heap = mem_heap_create(sizeof(dyn_block_t)); 51 | } 52 | 53 | block = dyn_array_get_last_block(arr); 54 | block->used = block->used | DYN_BLOCK_FULL_FLAG; 55 | 56 | heap = arr->heap; 57 | 58 | block = mem_heap_alloc(heap, sizeof(dyn_block_t)); 59 | 60 | block->used = 0; 61 | 62 | UT_LIST_ADD_LAST(list, arr->base, block); 63 | 64 | return(block); 65 | } 66 | -------------------------------------------------------------------------------- /fut/fut0fut.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file fut/fut0fut.c 21 | File-based utilities 22 | 23 | Created 12/13/1995 Heikki Tuuri 24 | ***********************************************************************/ 25 | 26 | #include "fut0fut.h" 27 | 28 | #ifdef UNIV_NONINL 29 | #include "fut0fut.ic" 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /include/api0misc.h: -------------------------------------------------------------------------------- 1 | /****************************************************** 2 | Interface between Innobase and client. This file contains 3 | the functions that don't have a proper home yet. 4 | 5 | (c) 2008 Oracle Corpn./Innobase Oy 6 | *******************************************************/ 7 | 8 | #include "univ.i" 9 | #include "os0file.h" 10 | #include "que0que.h" 11 | #include "trx0trx.h" 12 | 13 | /************************************************************************** 14 | Determines if the currently running transaction has been interrupted. 15 | @return TRUE if interrupted */ 16 | UNIV_INTERN 17 | ibool 18 | trx_is_interrupted( 19 | /*===============*/ 20 | const trx_t* trx); /*!< in: transaction */ 21 | 22 | /********************************************************************** 23 | Create a temporary file using the OS specific function. */ 24 | UNIV_INTERN 25 | int 26 | ib_create_tempfile( 27 | /*===============*/ 28 | const char* filename); /*!< in: temp filename prefix */ 29 | 30 | /******************************************************************** 31 | Handles user errors and lock waits detected by the database engine. 32 | @return TRUE if it was a lock wait and we should continue running the query thread */ 33 | UNIV_INTERN 34 | ibool 35 | ib_handle_errors( 36 | /*=============*/ 37 | enum db_err* new_err, /*!< out: possible new error 38 | encountered in lock wait, or if 39 | no new error, the value of 40 | trx->error_state at the entry of this 41 | function */ 42 | trx_t* trx, /*!< in: transaction */ 43 | que_thr_t* thr, /*!< in: query thread */ 44 | trx_savept_t* savept); /*!< in: savepoint or NULL */ 45 | 46 | /************************************************************************* 47 | Sets a lock on a table. 48 | @return error code or DB_SUCCESS */ 49 | UNIV_INTERN 50 | enum db_err 51 | ib_trx_lock_table_with_retry( 52 | /*=========================*/ 53 | trx_t* trx, /*!< in/out: transaction */ 54 | dict_table_t* table, /*!< in: table to lock */ 55 | enum lock_mode mode); /*!< in: lock mode */ 56 | 57 | /************************************************************************* 58 | Updates the table modification counter and calculates new estimates 59 | for table and index statistics if necessary. */ 60 | UNIV_INTERN 61 | void 62 | ib_update_statistics_if_needed( 63 | /*===========================*/ 64 | dict_table_t* table); /*!< in/out: table */ 65 | -------------------------------------------------------------------------------- /include/btr0sea.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /********************************************************************//** 20 | @file include/btr0sea.ic 21 | The index tree adaptive search 22 | 23 | Created 2/17/1996 Heikki Tuuri 24 | *************************************************************************/ 25 | 26 | #include "dict0mem.h" 27 | #include "btr0cur.h" 28 | #include "buf0buf.h" 29 | 30 | /*********************************************************************//** 31 | Updates the search info. */ 32 | UNIV_INTERN 33 | void 34 | btr_search_info_update_slow( 35 | /*========================*/ 36 | btr_search_t* info, /*!< in/out: search info */ 37 | btr_cur_t* cursor);/*!< in: cursor which was just positioned */ 38 | 39 | /********************************************************************//** 40 | Returns search info for an index. 41 | @return search info; search mutex reserved */ 42 | UNIV_INLINE 43 | btr_search_t* 44 | btr_search_get_info( 45 | /*================*/ 46 | dict_index_t* index) /*!< in: index */ 47 | { 48 | ut_ad(index); 49 | 50 | return(index->search_info); 51 | } 52 | 53 | /*********************************************************************//** 54 | Updates the search info. */ 55 | UNIV_INLINE 56 | void 57 | btr_search_info_update( 58 | /*===================*/ 59 | dict_index_t* index, /*!< in: index of the cursor */ 60 | btr_cur_t* cursor) /*!< in: cursor which was just positioned */ 61 | { 62 | btr_search_t* info; 63 | 64 | #ifdef UNIV_SYNC_DEBUG 65 | ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); 66 | ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); 67 | #endif /* UNIV_SYNC_DEBUG */ 68 | 69 | info = btr_search_get_info(index); 70 | 71 | info->hash_analysis++; 72 | 73 | if (info->hash_analysis < BTR_SEARCH_HASH_ANALYSIS) { 74 | 75 | /* Do nothing */ 76 | 77 | return; 78 | 79 | } 80 | 81 | ut_ad(cursor->flag != BTR_CUR_HASH); 82 | 83 | btr_search_info_update_slow(info, cursor); 84 | } 85 | -------------------------------------------------------------------------------- /include/btr0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /********************************************************************//** 20 | @file include/btr0types.h 21 | The index tree general types 22 | 23 | Created 2/17/1996 Heikki Tuuri 24 | *************************************************************************/ 25 | 26 | #ifndef btr0types_h 27 | #define btr0types_h 28 | 29 | #include "univ.i" 30 | 31 | #include "rem0types.h" 32 | #include "page0types.h" 33 | 34 | /** Persistent cursor */ 35 | typedef struct btr_pcur_struct btr_pcur_t; 36 | /** B-tree cursor */ 37 | typedef struct btr_cur_struct btr_cur_t; 38 | /** B-tree search information for the adaptive hash index */ 39 | typedef struct btr_search_struct btr_search_t; 40 | 41 | /** The size of a reference to data stored on a different page. 42 | The reference is stored at the end of the prefix of the field 43 | in the index record. */ 44 | #define BTR_EXTERN_FIELD_REF_SIZE 20 45 | 46 | /** A BLOB field reference full of zero, for use in assertions and tests. 47 | Initially, BLOB field references are set to zero, in 48 | dtuple_convert_big_rec(). */ 49 | extern const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE]; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/buf0buddy.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/buf0buddy.h 21 | Binary buddy allocator for compressed pages 22 | 23 | Created December 2006 by Marko Makela 24 | *******************************************************/ 25 | 26 | #ifndef buf0buddy_h 27 | #define buf0buddy_h 28 | 29 | #ifdef UNIV_MATERIALIZE 30 | # undef UNIV_INLINE 31 | # define UNIV_INLINE 32 | #endif 33 | 34 | #include "univ.i" 35 | #include "buf0types.h" 36 | 37 | /**********************************************************************//** 38 | Allocate a block. The thread calling this function must hold 39 | buf_pool_mutex and must not hold buf_pool_zip_mutex or any 40 | block->mutex. The buf_pool_mutex may only be released and reacquired 41 | if lru != NULL. This function should only be used for allocating 42 | compressed page frames or control blocks (buf_page_t). Allocated 43 | control blocks must be properly initialized immediately after 44 | buf_buddy_alloc() has returned the memory, before releasing 45 | buf_pool_mutex. 46 | @return allocated block, possibly NULL if lru == NULL */ 47 | UNIV_INLINE 48 | void* 49 | buf_buddy_alloc( 50 | /*============*/ 51 | ulint size, /*!< in: block size, up to UNIV_PAGE_SIZE */ 52 | ibool* lru) /*!< in: pointer to a variable that will be assigned 53 | TRUE if storage was allocated from the LRU list 54 | and buf_pool_mutex was temporarily released, 55 | or NULL if the LRU list should not be used */ 56 | __attribute__((malloc)); 57 | 58 | /**********************************************************************//** 59 | Release a block. */ 60 | UNIV_INLINE 61 | void 62 | buf_buddy_free( 63 | /*===========*/ 64 | void* buf, /*!< in: block to be freed, must not be 65 | pointed to by the buffer pool */ 66 | ulint size) /*!< in: block size, up to UNIV_PAGE_SIZE */ 67 | __attribute__((nonnull)); 68 | 69 | /************************************************************************** 70 | Get the offset of the buddy of a compressed page frame. */ 71 | UNIV_INTERN 72 | void 73 | buf_buddy_var_init(void); 74 | /*====================*/ 75 | 76 | /** Statistics of buddy blocks of a given size. */ 77 | struct buf_buddy_stat_struct { 78 | /** Number of blocks allocated from the buddy system. */ 79 | ulint used; 80 | /** Number of blocks relocated by the buddy system. */ 81 | ib_uint64_t relocated; 82 | /** Total duration of block relocations, in microseconds. */ 83 | ib_uint64_t relocated_usec; 84 | }; 85 | 86 | /** Statistics of buddy blocks of a given size. */ 87 | typedef struct buf_buddy_stat_struct buf_buddy_stat_t; 88 | 89 | /** Statistics of the buddy system, indexed by block size. 90 | Protected by buf_pool_mutex. */ 91 | extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1]; 92 | 93 | #ifndef UNIV_NONINL 94 | # include "buf0buddy.ic" 95 | #endif 96 | 97 | #endif /* buf0buddy_h */ 98 | -------------------------------------------------------------------------------- /include/buf0lru.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/buf0lru.ic 21 | The database buffer replacement algorithm 22 | 23 | Created 11/5/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | -------------------------------------------------------------------------------- /include/buf0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/buf0types.h 21 | The database buffer pool global types for the directory 22 | 23 | Created 11/17/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef buf0types_h 27 | #define buf0types_h 28 | 29 | /** Buffer page (uncompressed or compressed) */ 30 | typedef struct buf_page_struct buf_page_t; 31 | /** Buffer block for which an uncompressed page exists */ 32 | typedef struct buf_block_struct buf_block_t; 33 | /** Buffer pool chunk comprising buf_block_t */ 34 | typedef struct buf_chunk_struct buf_chunk_t; 35 | /** Buffer pool comprising buf_chunk_t */ 36 | typedef struct buf_pool_struct buf_pool_t; 37 | /** Buffer pool statistics struct */ 38 | typedef struct buf_pool_stat_struct buf_pool_stat_t; 39 | 40 | /** A buffer frame. @see page_t */ 41 | typedef byte buf_frame_t; 42 | 43 | /** Flags for flush types */ 44 | enum buf_flush { 45 | BUF_FLUSH_LRU = 0, /*!< flush via the LRU list */ 46 | BUF_FLUSH_SINGLE_PAGE, /*!< flush a single page */ 47 | BUF_FLUSH_LIST, /*!< flush via the flush list 48 | of dirty blocks */ 49 | BUF_FLUSH_N_TYPES /*!< index of last element + 1 */ 50 | }; 51 | 52 | /** Flags for io_fix types */ 53 | enum buf_io_fix { 54 | BUF_IO_NONE = 0, /**< no pending I/O */ 55 | BUF_IO_READ, /**< read pending */ 56 | BUF_IO_WRITE /**< write pending */ 57 | }; 58 | 59 | /** Parameters of binary buddy system for compressed pages (buf0buddy.h) */ 60 | /* @{ */ 61 | #if UNIV_WORD_SIZE <= 4 /* 32-bit system */ 62 | /** Base-2 logarithm of the smallest buddy block size */ 63 | # define BUF_BUDDY_LOW_SHIFT 6 64 | #else /* 64-bit system */ 65 | /** Base-2 logarithm of the smallest buddy block size */ 66 | # define BUF_BUDDY_LOW_SHIFT 7 67 | #endif 68 | #define BUF_BUDDY_LOW (1 << BUF_BUDDY_LOW_SHIFT) 69 | /*!< minimum block size in the binary 70 | buddy system; must be at least 71 | sizeof(buf_page_t) */ 72 | #define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT) 73 | /*!< number of buddy sizes */ 74 | 75 | /** twice the maximum block size of the buddy system; 76 | the underlying memory is aligned by this amount: 77 | this must be equal to UNIV_PAGE_SIZE */ 78 | #define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES) 79 | /* @} */ 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /include/data0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /********************************************************************//** 20 | @file include/data0types.h 21 | Some type definitions 22 | 23 | Created 9/21/2000 Heikki Tuuri 24 | *************************************************************************/ 25 | 26 | #ifndef data0types_h 27 | #define data0types_h 28 | 29 | /* SQL data field struct */ 30 | typedef struct dfield_struct dfield_t; 31 | 32 | /* SQL data tuple struct */ 33 | typedef struct dtuple_struct dtuple_t; 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /include/dict0boot.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/dict0boot.ic 21 | Data dictionary creation and booting 22 | 23 | Created 4/18/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | /**********************************************************************//** 27 | Writes the current value of the row id counter to the dictionary header file 28 | page. */ 29 | UNIV_INTERN 30 | void 31 | dict_hdr_flush_row_id(void); 32 | /*=======================*/ 33 | 34 | 35 | /**********************************************************************//** 36 | Returns a new row id. 37 | @return the new id */ 38 | UNIV_INLINE 39 | dulint 40 | dict_sys_get_new_row_id(void) 41 | /*=========================*/ 42 | { 43 | dulint id; 44 | 45 | mutex_enter(&(dict_sys->mutex)); 46 | 47 | id = dict_sys->row_id; 48 | 49 | if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) { 50 | 51 | dict_hdr_flush_row_id(); 52 | } 53 | 54 | UT_DULINT_INC(dict_sys->row_id); 55 | 56 | mutex_exit(&(dict_sys->mutex)); 57 | 58 | return(id); 59 | } 60 | 61 | /**********************************************************************//** 62 | Reads a row id from a record or other 6-byte stored form. 63 | @return row id */ 64 | UNIV_INLINE 65 | dulint 66 | dict_sys_read_row_id( 67 | /*=================*/ 68 | byte* field) /*!< in: record field */ 69 | { 70 | #if DATA_ROW_ID_LEN != 6 71 | # error "DATA_ROW_ID_LEN != 6" 72 | #endif 73 | 74 | return(mach_read_from_6(field)); 75 | } 76 | 77 | /**********************************************************************//** 78 | Writes a row id to a record or other 6-byte stored form. */ 79 | UNIV_INLINE 80 | void 81 | dict_sys_write_row_id( 82 | /*==================*/ 83 | byte* field, /*!< in: record field */ 84 | dulint row_id) /*!< in: row id */ 85 | { 86 | #if DATA_ROW_ID_LEN != 6 87 | # error "DATA_ROW_ID_LEN != 6" 88 | #endif 89 | 90 | mach_write_to_6(field, row_id); 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /include/dict0crea.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/dict0crea.ic 21 | Database object creation 22 | 23 | Created 1/8/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | -------------------------------------------------------------------------------- /include/dict0load.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/dict0load.ic 21 | Loads to the memory cache database object definitions 22 | from dictionary tables 23 | 24 | Created 4/24/1996 Heikki Tuuri 25 | *******************************************************/ 26 | 27 | -------------------------------------------------------------------------------- /include/dict0mem.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file include/dict0mem.ic 21 | Data dictionary memory object creation 22 | 23 | Created 1/8/1996 Heikki Tuuri 24 | ***********************************************************************/ 25 | 26 | 27 | -------------------------------------------------------------------------------- /include/dict0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/dict0types.h 21 | Data dictionary global types 22 | 23 | Created 1/8/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef dict0types_h 27 | #define dict0types_h 28 | 29 | typedef struct dict_sys_struct dict_sys_t; 30 | typedef struct dict_col_struct dict_col_t; 31 | typedef struct dict_field_struct dict_field_t; 32 | typedef struct dict_index_struct dict_index_t; 33 | typedef struct dict_table_struct dict_table_t; 34 | typedef struct dict_foreign_struct dict_foreign_t; 35 | 36 | /* A cluster object is a table object with the type field set to 37 | DICT_CLUSTERED */ 38 | 39 | typedef dict_table_t dict_cluster_t; 40 | 41 | typedef struct ind_node_struct ind_node_t; 42 | typedef struct tab_node_struct tab_node_t; 43 | 44 | /* Space id and page no where the dictionary header resides */ 45 | #define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */ 46 | #define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/eval0proc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1998, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/eval0proc.h 21 | Executes SQL stored procedures and their control structures 22 | 23 | Created 1/20/1998 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef eval0proc_h 27 | #define eval0proc_h 28 | 29 | #include "univ.i" 30 | #include "que0types.h" 31 | #include "pars0sym.h" 32 | #include "pars0pars.h" 33 | 34 | /**********************************************************************//** 35 | Performs an execution step of a procedure node. 36 | @return query thread to run next or NULL */ 37 | UNIV_INLINE 38 | que_thr_t* 39 | proc_step( 40 | /*======*/ 41 | que_thr_t* thr); /*!< in: query thread */ 42 | /**********************************************************************//** 43 | Performs an execution step of an if-statement node. 44 | @return query thread to run next or NULL */ 45 | UNIV_INTERN 46 | que_thr_t* 47 | if_step( 48 | /*====*/ 49 | que_thr_t* thr); /*!< in: query thread */ 50 | /**********************************************************************//** 51 | Performs an execution step of a while-statement node. 52 | @return query thread to run next or NULL */ 53 | UNIV_INTERN 54 | que_thr_t* 55 | while_step( 56 | /*=======*/ 57 | que_thr_t* thr); /*!< in: query thread */ 58 | /**********************************************************************//** 59 | Performs an execution step of a for-loop node. 60 | @return query thread to run next or NULL */ 61 | UNIV_INTERN 62 | que_thr_t* 63 | for_step( 64 | /*=====*/ 65 | que_thr_t* thr); /*!< in: query thread */ 66 | /**********************************************************************//** 67 | Performs an execution step of an assignment statement node. 68 | @return query thread to run next or NULL */ 69 | UNIV_INTERN 70 | que_thr_t* 71 | assign_step( 72 | /*========*/ 73 | que_thr_t* thr); /*!< in: query thread */ 74 | /**********************************************************************//** 75 | Performs an execution step of a procedure call node. 76 | @return query thread to run next or NULL */ 77 | UNIV_INLINE 78 | que_thr_t* 79 | proc_eval_step( 80 | /*===========*/ 81 | que_thr_t* thr); /*!< in: query thread */ 82 | /**********************************************************************//** 83 | Performs an execution step of an exit statement node. 84 | @return query thread to run next or NULL */ 85 | UNIV_INTERN 86 | que_thr_t* 87 | exit_step( 88 | /*======*/ 89 | que_thr_t* thr); /*!< in: query thread */ 90 | /**********************************************************************//** 91 | Performs an execution step of a return-statement node. 92 | @return query thread to run next or NULL */ 93 | UNIV_INTERN 94 | que_thr_t* 95 | return_step( 96 | /*========*/ 97 | que_thr_t* thr); /*!< in: query thread */ 98 | 99 | 100 | #ifndef UNIV_NONINL 101 | #include "eval0proc.ic" 102 | #endif 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /include/eval0proc.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1998, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/eval0proc.ic 21 | Executes SQL stored procedures and their control structures 22 | 23 | Created 1/20/1998 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "pars0pars.h" 27 | #include "que0que.h" 28 | #include "eval0eval.h" 29 | 30 | /**********************************************************************//** 31 | Performs an execution step of a procedure node. 32 | @return query thread to run next or NULL */ 33 | UNIV_INLINE 34 | que_thr_t* 35 | proc_step( 36 | /*======*/ 37 | que_thr_t* thr) /*!< in: query thread */ 38 | { 39 | proc_node_t* node; 40 | 41 | ut_ad(thr); 42 | 43 | node = thr->run_node; 44 | ut_ad(que_node_get_type(node) == QUE_NODE_PROC); 45 | 46 | if (thr->prev_node == que_node_get_parent(node)) { 47 | /* Start execution from the first statement in the statement 48 | list */ 49 | 50 | thr->run_node = node->stat_list; 51 | } else { 52 | /* Move to the next statement */ 53 | ut_ad(que_node_get_next(thr->prev_node) == NULL); 54 | 55 | thr->run_node = NULL; 56 | } 57 | 58 | if (thr->run_node == NULL) { 59 | thr->run_node = que_node_get_parent(node); 60 | } 61 | 62 | return(thr); 63 | } 64 | 65 | /**********************************************************************//** 66 | Performs an execution step of a procedure call node. 67 | @return query thread to run next or NULL */ 68 | UNIV_INLINE 69 | que_thr_t* 70 | proc_eval_step( 71 | /*===========*/ 72 | que_thr_t* thr) /*!< in: query thread */ 73 | { 74 | func_node_t* node; 75 | 76 | ut_ad(thr); 77 | 78 | node = thr->run_node; 79 | ut_ad(que_node_get_type(node) == QUE_NODE_FUNC); 80 | 81 | /* Evaluate the procedure */ 82 | 83 | eval_exp(node); 84 | 85 | thr->run_node = que_node_get_parent(node); 86 | 87 | return(thr); 88 | } 89 | -------------------------------------------------------------------------------- /include/fsp0fsp.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/fsp0fsp.ic 21 | File space management 22 | 23 | Created 12/18/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | /***********************************************************************//** 27 | Checks if a page address is an extent descriptor page address. 28 | @return TRUE if a descriptor page */ 29 | UNIV_INLINE 30 | ibool 31 | fsp_descr_page( 32 | /*===========*/ 33 | ulint zip_size,/*!< in: compressed page size in bytes; 34 | 0 for uncompressed pages */ 35 | ulint page_no)/*!< in: page number */ 36 | { 37 | ut_ad(ut_is_2pow(zip_size)); 38 | 39 | if (!zip_size) { 40 | return(UNIV_UNLIKELY((page_no & (UNIV_PAGE_SIZE - 1)) 41 | == FSP_XDES_OFFSET)); 42 | } 43 | 44 | return(UNIV_UNLIKELY((page_no & (zip_size - 1)) == FSP_XDES_OFFSET)); 45 | } 46 | -------------------------------------------------------------------------------- /include/fut0fut.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file include/fut0fut.h 21 | File-based utilities 22 | 23 | Created 12/13/1995 Heikki Tuuri 24 | ***********************************************************************/ 25 | 26 | 27 | #ifndef fut0fut_h 28 | #define fut0fut_h 29 | 30 | #include "univ.i" 31 | 32 | #include "fil0fil.h" 33 | #include "mtr0mtr.h" 34 | 35 | /********************************************************************//** 36 | Gets a pointer to a file address and latches the page. 37 | @return pointer to a byte in a frame; the file page in the frame is 38 | bufferfixed and latched */ 39 | UNIV_INLINE 40 | byte* 41 | fut_get_ptr( 42 | /*========*/ 43 | ulint space, /*!< in: space id */ 44 | ulint zip_size,/*!< in: compressed page size in bytes 45 | or 0 for uncompressed pages */ 46 | fil_addr_t addr, /*!< in: file address */ 47 | ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH */ 48 | mtr_t* mtr); /*!< in: mtr handle */ 49 | 50 | #ifndef UNIV_NONINL 51 | #include "fut0fut.ic" 52 | #endif 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /include/fut0fut.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file include/fut0fut.ic 21 | File-based utilities 22 | 23 | Created 12/13/1995 Heikki Tuuri 24 | ***********************************************************************/ 25 | 26 | #include "sync0rw.h" 27 | #include "buf0buf.h" 28 | 29 | /********************************************************************//** 30 | Gets a pointer to a file address and latches the page. 31 | @return pointer to a byte in a frame; the file page in the frame is 32 | bufferfixed and latched */ 33 | UNIV_INLINE 34 | byte* 35 | fut_get_ptr( 36 | /*========*/ 37 | ulint space, /*!< in: space id */ 38 | ulint zip_size,/*!< in: compressed page size in bytes 39 | or 0 for uncompressed pages */ 40 | fil_addr_t addr, /*!< in: file address */ 41 | ulint rw_latch, /*!< in: RW_S_LATCH, RW_X_LATCH */ 42 | mtr_t* mtr) /*!< in: mtr handle */ 43 | { 44 | buf_block_t* block; 45 | byte* ptr; 46 | 47 | ut_ad(addr.boffset < UNIV_PAGE_SIZE); 48 | ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); 49 | 50 | block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr); 51 | ptr = buf_block_get_frame(block) + addr.boffset; 52 | 53 | buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); 54 | 55 | return(ptr); 56 | } 57 | -------------------------------------------------------------------------------- /include/ibuf0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/ibuf0types.h 21 | Insert buffer global types 22 | 23 | Created 7/29/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef ibuf0types_h 27 | #define ibuf0types_h 28 | 29 | typedef struct ibuf_struct ibuf_t; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/lock0iter.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/lock0iter.h 21 | Lock queue iterator type and function prototypes. 22 | 23 | Created July 16, 2007 Vasil Dimov 24 | *******************************************************/ 25 | 26 | #ifndef lock0iter_h 27 | #define lock0iter_h 28 | 29 | #include "univ.i" 30 | #include "lock0types.h" 31 | 32 | typedef struct lock_queue_iterator_struct { 33 | const lock_t* current_lock; 34 | /* In case this is a record lock queue (not table lock queue) 35 | then bit_no is the record number within the heap in which the 36 | record is stored. */ 37 | ulint bit_no; 38 | } lock_queue_iterator_t; 39 | 40 | /*******************************************************************//** 41 | Initialize lock queue iterator so that it starts to iterate from 42 | "lock". bit_no specifies the record number within the heap where the 43 | record is stored. It can be undefined (ULINT_UNDEFINED) in two cases: 44 | 1. If the lock is a table lock, thus we have a table lock queue; 45 | 2. If the lock is a record lock and it is a wait lock. In this case 46 | bit_no is calculated in this function by using 47 | lock_rec_find_set_bit(). There is exactly one bit set in the bitmap 48 | of a wait lock. */ 49 | UNIV_INTERN 50 | void 51 | lock_queue_iterator_reset( 52 | /*======================*/ 53 | lock_queue_iterator_t* iter, /*!< out: iterator */ 54 | const lock_t* lock, /*!< in: lock to start from */ 55 | ulint bit_no);/*!< in: record number in the 56 | heap */ 57 | 58 | /*******************************************************************//** 59 | Gets the previous lock in the lock queue, returns NULL if there are no 60 | more locks (i.e. the current lock is the first one). The iterator is 61 | receded (if not-NULL is returned). 62 | @return previous lock or NULL */ 63 | 64 | const lock_t* 65 | lock_queue_iterator_get_prev( 66 | /*=========================*/ 67 | lock_queue_iterator_t* iter); /*!< in/out: iterator */ 68 | 69 | #endif /* lock0iter_h */ 70 | -------------------------------------------------------------------------------- /include/lock0lock.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/lock0lock.ic 21 | The transaction lock system 22 | 23 | Created 5/7/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "sync0sync.h" 27 | #include "srv0srv.h" 28 | #include "dict0dict.h" 29 | #include "row0row.h" 30 | #include "trx0sys.h" 31 | #include "trx0trx.h" 32 | #include "buf0buf.h" 33 | #include "page0page.h" 34 | #include "page0cur.h" 35 | #include "row0vers.h" 36 | #include "que0que.h" 37 | #include "btr0cur.h" 38 | #include "read0read.h" 39 | #include "log0recv.h" 40 | 41 | /*********************************************************************//** 42 | Calculates the fold value of a page file address: used in inserting or 43 | searching for a lock in the hash table. 44 | @return folded value */ 45 | UNIV_INLINE 46 | ulint 47 | lock_rec_fold( 48 | /*==========*/ 49 | ulint space, /*!< in: space */ 50 | ulint page_no)/*!< in: page number */ 51 | { 52 | return(ut_fold_ulint_pair(space, page_no)); 53 | } 54 | 55 | /*********************************************************************//** 56 | Calculates the hash value of a page file address: used in inserting or 57 | searching for a lock in the hash table. 58 | @return hashed value */ 59 | UNIV_INLINE 60 | ulint 61 | lock_rec_hash( 62 | /*==========*/ 63 | ulint space, /*!< in: space */ 64 | ulint page_no)/*!< in: page number */ 65 | { 66 | return(hash_calc_hash(lock_rec_fold(space, page_no), 67 | lock_sys->rec_hash)); 68 | } 69 | 70 | /*********************************************************************//** 71 | Checks if some transaction has an implicit x-lock on a record in a clustered 72 | index. 73 | @return transaction which has the x-lock, or NULL */ 74 | UNIV_INLINE 75 | trx_t* 76 | lock_clust_rec_some_has_impl( 77 | /*=========================*/ 78 | const rec_t* rec, /*!< in: user record */ 79 | dict_index_t* index, /*!< in: clustered index */ 80 | const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ 81 | { 82 | trx_id_t trx_id; 83 | 84 | ut_ad(mutex_own(&kernel_mutex)); 85 | ut_ad(dict_index_is_clust(index)); 86 | ut_ad(page_rec_is_user_rec(rec)); 87 | 88 | trx_id = row_get_rec_trx_id(rec, index, offsets); 89 | 90 | if (trx_is_active(trx_id)) { 91 | /* The modifying or inserting transaction is active */ 92 | 93 | return(trx_get_on_id(trx_id)); 94 | } 95 | 96 | return(NULL); 97 | } 98 | 99 | /*********************************************************************//** 100 | Gets the heap_no of the smallest user record on a page. 101 | @return heap_no of smallest user record, or PAGE_HEAP_NO_SUPREMUM */ 102 | UNIV_INLINE 103 | ulint 104 | lock_get_min_heap_no( 105 | /*=================*/ 106 | const buf_block_t* block) /*!< in: buffer block */ 107 | { 108 | const page_t* page = block->frame; 109 | 110 | if (page_is_comp(page)) { 111 | return(rec_get_heap_no_new( 112 | page 113 | + rec_get_next_offs(page + PAGE_NEW_INFIMUM, 114 | TRUE))); 115 | } else { 116 | return(rec_get_heap_no_old( 117 | page 118 | + rec_get_next_offs(page + PAGE_OLD_INFIMUM, 119 | FALSE))); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /include/lock0priv.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/lock0priv.h 21 | Lock module internal structures and methods. 22 | 23 | Created July 12, 2007 Vasil Dimov 24 | *******************************************************/ 25 | 26 | #ifndef lock0priv_h 27 | #define lock0priv_h 28 | 29 | #ifndef LOCK_MODULE_IMPLEMENTATION 30 | /* If you need to access members of the structures defined in this 31 | file, please write appropriate functions that retrieve them and put 32 | those functions in lock/ */ 33 | #error Do not include lock0priv.h outside of the lock/ module 34 | #endif 35 | 36 | #include "univ.i" 37 | #include "dict0types.h" 38 | #include "hash0hash.h" 39 | #include "trx0types.h" 40 | #include "ut0lst.h" 41 | 42 | /** A table lock */ 43 | typedef struct lock_table_struct lock_table_t; 44 | /** A table lock */ 45 | struct lock_table_struct { 46 | dict_table_t* table; /*!< database table in dictionary 47 | cache */ 48 | UT_LIST_NODE_T(lock_t) 49 | locks; /*!< list of locks on the same 50 | table */ 51 | }; 52 | 53 | /** Record lock for a page */ 54 | typedef struct lock_rec_struct lock_rec_t; 55 | /** Record lock for a page */ 56 | struct lock_rec_struct { 57 | ulint space; /*!< space id */ 58 | ulint page_no; /*!< page number */ 59 | ulint n_bits; /*!< number of bits in the lock 60 | bitmap; NOTE: the lock bitmap is 61 | placed immediately after the 62 | lock struct */ 63 | }; 64 | 65 | /** Lock struct */ 66 | struct lock_struct { 67 | trx_t* trx; /*!< transaction owning the 68 | lock */ 69 | UT_LIST_NODE_T(lock_t) 70 | trx_locks; /*!< list of the locks of the 71 | transaction */ 72 | ulint type_mode; /*!< lock type, mode, LOCK_GAP or 73 | LOCK_REC_NOT_GAP, 74 | LOCK_INSERT_INTENTION, 75 | wait flag, ORed */ 76 | hash_node_t hash; /*!< hash chain node for a record 77 | lock */ 78 | dict_index_t* index; /*!< index for a record lock */ 79 | union { 80 | lock_table_t tab_lock;/*!< table lock */ 81 | lock_rec_t rec_lock;/*!< record lock */ 82 | } un_member; /*!< lock details */ 83 | }; 84 | 85 | /*********************************************************************//** 86 | Gets the type of a lock. 87 | @return LOCK_TABLE or LOCK_REC */ 88 | UNIV_INLINE 89 | ulint 90 | lock_get_type_low( 91 | /*==============*/ 92 | const lock_t* lock); /*!< in: lock */ 93 | 94 | /*********************************************************************//** 95 | Gets the previous record lock set on a record. 96 | @return previous lock on the same record, NULL if none exists */ 97 | UNIV_INTERN 98 | const lock_t* 99 | lock_rec_get_prev( 100 | /*==============*/ 101 | const lock_t* in_lock,/*!< in: record lock */ 102 | ulint heap_no);/*!< in: heap number of the record */ 103 | 104 | #ifndef UNIV_NONINL 105 | #include "lock0priv.ic" 106 | #endif 107 | 108 | #endif /* lock0priv_h */ 109 | -------------------------------------------------------------------------------- /include/lock0priv.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/lock0priv.ic 21 | Lock module internal inline methods. 22 | 23 | Created July 16, 2007 Vasil Dimov 24 | *******************************************************/ 25 | 26 | /* This file contains only methods which are used in 27 | lock/lock0* files, other than lock/lock0lock.c. 28 | I.e. lock/lock0lock.c contains more internal inline 29 | methods but they are used only in that file. */ 30 | 31 | #ifndef LOCK_MODULE_IMPLEMENTATION 32 | #error Do not include lock0priv.ic outside of the lock/ module 33 | #endif 34 | 35 | /*********************************************************************//** 36 | Gets the type of a lock. 37 | @return LOCK_TABLE or LOCK_REC */ 38 | UNIV_INLINE 39 | ulint 40 | lock_get_type_low( 41 | /*==============*/ 42 | const lock_t* lock) /*!< in: lock */ 43 | { 44 | ut_ad(lock); 45 | 46 | return(lock->type_mode & LOCK_TYPE_MASK); 47 | } 48 | 49 | /* vim: set filetype=c: */ 50 | -------------------------------------------------------------------------------- /include/lock0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/lock0types.h 21 | The transaction lock system global types 22 | 23 | Created 5/7/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef lock0types_h 27 | #define lock0types_h 28 | 29 | #define lock_t ib_lock_t 30 | typedef struct lock_struct lock_t; 31 | typedef struct lock_sys_struct lock_sys_t; 32 | 33 | /* Basic lock modes */ 34 | enum lock_mode { 35 | LOCK_IS = 0, /* intention shared */ 36 | LOCK_IX, /* intention exclusive */ 37 | LOCK_S, /* shared */ 38 | LOCK_X, /* exclusive */ 39 | LOCK_AUTO_INC, /* locks the auto-inc counter of a table 40 | in an exclusive mode */ 41 | LOCK_NONE, /* this is used elsewhere to note consistent read */ 42 | LOCK_NUM = LOCK_NONE/* number of lock modes */ 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/log0recv.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/log0recv.ic 21 | Recovery 22 | 23 | Created 9/20/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "univ.i" 27 | 28 | /*******************************************************************//** 29 | Returns TRUE if recovery is currently running. 30 | @return recv_recovery_on */ 31 | UNIV_INLINE 32 | ibool 33 | recv_recovery_is_on(void) 34 | /*=====================*/ 35 | { 36 | return(UNIV_UNLIKELY(recv_recovery_on)); 37 | } 38 | 39 | #ifdef UNIV_LOG_ARCHIVE 40 | /** TRUE when applying redo log records from an archived log file */ 41 | extern ibool recv_recovery_from_backup_on; 42 | 43 | /*******************************************************************//** 44 | Returns TRUE if recovery from backup is currently running. 45 | @return recv_recovery_from_backup_on */ 46 | UNIV_INLINE 47 | ibool 48 | recv_recovery_from_backup_is_on(void) 49 | /*=================================*/ 50 | { 51 | return(recv_recovery_from_backup_on); 52 | } 53 | #endif /* UNIV_LOG_ARCHIVE */ 54 | -------------------------------------------------------------------------------- /include/mtr0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/mtr0types.h 21 | Mini-transaction buffer global types 22 | 23 | Created 11/26/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef mtr0types_h 27 | #define mtr0types_h 28 | 29 | typedef struct mtr_struct mtr_t; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/os0file.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextgres/oss-embedded-innodb/20f627d05773b6fdc7eb25059882e10e96dc6525/include/os0file.h -------------------------------------------------------------------------------- /include/os0proc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/os0proc.h 21 | The interface to the operating system 22 | process control primitives 23 | 24 | Created 9/30/1995 Heikki Tuuri 25 | *******************************************************/ 26 | 27 | #ifndef os0proc_h 28 | #define os0proc_h 29 | 30 | #include "univ.i" 31 | 32 | /* Required for HugeTLB support. */ 33 | #ifdef UNIV_LINUX 34 | #include 35 | #include 36 | #endif 37 | 38 | typedef void* os_process_t; 39 | typedef unsigned long int os_process_id_t; 40 | 41 | extern ibool os_use_large_pages; 42 | /* Large page size. This may be a boot-time option on some platforms */ 43 | extern ulint os_large_page_size; 44 | 45 | /****************************************************************//** 46 | Converts the current process id to a number. It is not guaranteed that the 47 | number is unique. In Linux returns the 'process number' of the current 48 | thread. That number is the same as one sees in 'top', for example. In Linux 49 | the thread id is not the same as one sees in 'top'. 50 | @return process id as a number */ 51 | UNIV_INTERN 52 | ulint 53 | os_proc_get_number(void); 54 | /*====================*/ 55 | /****************************************************************//** 56 | Allocates large pages memory. 57 | @return allocated memory */ 58 | UNIV_INTERN 59 | void* 60 | os_mem_alloc_large( 61 | /*===============*/ 62 | ulint* n); /*!< in/out: number of bytes */ 63 | /****************************************************************//** 64 | Frees large pages memory. */ 65 | UNIV_INTERN 66 | void 67 | os_mem_free_large( 68 | /*==============*/ 69 | void *ptr, /*!< in: pointer returned by 70 | os_mem_alloc_large() */ 71 | ulint size); /*!< in: size returned by 72 | os_mem_alloc_large() */ 73 | /******************************************************************//** 74 | Reset the variables. */ 75 | UNIV_INTERN 76 | void 77 | os_proc_var_init(void); 78 | /*==================*/ 79 | 80 | #ifndef UNIV_NONINL 81 | #include "os0proc.ic" 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /include/os0proc.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/os0proc.ic 21 | The interface to the operating system 22 | process control primitives 23 | 24 | Created 9/30/1995 Heikki Tuuri 25 | *******************************************************/ 26 | 27 | 28 | -------------------------------------------------------------------------------- /include/os0sync.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/os0sync.ic 21 | The interface to the operating system synchronization primitives. 22 | 23 | Created 9/6/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifdef __WIN__ 27 | #include 28 | #elif defined(HAVE_PTHREAD_H) 29 | #include 30 | #else 31 | #error "POSIX thread support missing" 32 | #endif /* __WIN__ */ 33 | 34 | /**********************************************************//** 35 | Acquires ownership of a fast mutex. Currently in Windows this is the same 36 | as os_fast_mutex_lock! 37 | @return 0 if success, != 0 if was reserved by another thread */ 38 | UNIV_INLINE 39 | ulint 40 | os_fast_mutex_trylock( 41 | /*==================*/ 42 | os_fast_mutex_t* fast_mutex) /*!< in: mutex to acquire */ 43 | { 44 | #ifdef __WIN__ 45 | EnterCriticalSection(fast_mutex); 46 | 47 | return(0); 48 | #else 49 | return((ulint) pthread_mutex_trylock(fast_mutex)); 50 | #endif 51 | } 52 | -------------------------------------------------------------------------------- /include/os0thread.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/os0thread.ic 21 | The interface to the operating system 22 | process and thread control primitives 23 | 24 | Created 9/8/1995 Heikki Tuuri 25 | *******************************************************/ 26 | -------------------------------------------------------------------------------- /include/pars0opt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/pars0opt.h 21 | Simple SQL optimizer 22 | 23 | Created 12/21/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef pars0opt_h 27 | #define pars0opt_h 28 | 29 | #include "univ.i" 30 | #include "que0types.h" 31 | #include "usr0types.h" 32 | #include "pars0sym.h" 33 | #include "dict0types.h" 34 | #include "row0sel.h" 35 | 36 | /*******************************************************************//** 37 | Optimizes a select. Decides which indexes to tables to use. The tables 38 | are accessed in the order that they were written to the FROM part in the 39 | select statement. */ 40 | UNIV_INTERN 41 | void 42 | opt_search_plan( 43 | /*============*/ 44 | sel_node_t* sel_node); /*!< in: parsed select node */ 45 | /*******************************************************************//** 46 | Looks for occurrences of the columns of the table in the query subgraph and 47 | adds them to the list of columns if an occurrence of the same column does not 48 | already exist in the list. If the column is already in the list, puts a value 49 | indirection to point to the occurrence in the column list, except if the 50 | column occurrence we are looking at is in the column list, in which case 51 | nothing is done. */ 52 | UNIV_INTERN 53 | void 54 | opt_find_all_cols( 55 | /*==============*/ 56 | ibool copy_val, /*!< in: if TRUE, new found columns are 57 | added as columns to copy */ 58 | dict_index_t* index, /*!< in: index to use */ 59 | sym_node_list_t* col_list, /*!< in: base node of a list where 60 | to add new found columns */ 61 | plan_t* plan, /*!< in: plan or NULL */ 62 | que_node_t* exp); /*!< in: expression or condition */ 63 | /********************************************************************//** 64 | Prints info of a query plan. */ 65 | UNIV_INTERN 66 | void 67 | opt_print_query_plan( 68 | /*=================*/ 69 | sel_node_t* sel_node); /*!< in: select node */ 70 | 71 | #ifndef UNIV_NONINL 72 | #include "pars0opt.ic" 73 | #endif 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /include/pars0opt.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/pars0opt.ic 21 | Simple SQL optimizer 22 | 23 | Created 12/21/1997 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/pars0pars.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/pars0pars.ic 21 | SQL parser 22 | 23 | Created 11/19/1996 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/pars0sym.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/pars0sym.ic 21 | SQL parser symbol table 22 | 23 | Created 12/15/1997 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/pars0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1998, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/pars0types.h 21 | SQL parser global types 22 | 23 | Created 1/11/1998 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef pars0types_h 27 | #define pars0types_h 28 | 29 | typedef struct pars_info_struct pars_info_t; 30 | typedef struct pars_user_func_struct pars_user_func_t; 31 | typedef struct pars_bound_lit_struct pars_bound_lit_t; 32 | typedef struct pars_bound_id_struct pars_bound_id_t; 33 | typedef struct sym_node_struct sym_node_t; 34 | typedef struct sym_tab_struct sym_tab_t; 35 | typedef struct pars_res_word_struct pars_res_word_t; 36 | typedef struct func_node_struct func_node_t; 37 | typedef struct order_node_struct order_node_t; 38 | typedef struct proc_node_struct proc_node_t; 39 | typedef struct elsif_node_struct elsif_node_t; 40 | typedef struct if_node_struct if_node_t; 41 | typedef struct while_node_struct while_node_t; 42 | typedef struct for_node_struct for_node_t; 43 | typedef struct exit_node_struct exit_node_t; 44 | typedef struct return_node_struct return_node_t; 45 | typedef struct assign_node_struct assign_node_t; 46 | typedef struct col_assign_node_struct col_assign_node_t; 47 | 48 | typedef UT_LIST_BASE_NODE_T(sym_node_t) sym_node_list_t; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/que0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/que0types.h 21 | Query graph global types 22 | 23 | Created 5/27/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef que0types_h 27 | #define que0types_h 28 | 29 | #include "data0data.h" 30 | #include "dict0types.h" 31 | 32 | /* Pseudotype for all graph nodes */ 33 | typedef void que_node_t; 34 | 35 | typedef struct que_fork_struct que_fork_t; 36 | 37 | /* Query graph root is a fork node */ 38 | typedef que_fork_t que_t; 39 | 40 | typedef struct que_thr_struct que_thr_t; 41 | typedef struct que_common_struct que_common_t; 42 | 43 | /* Common struct at the beginning of each query graph node; the name of this 44 | substruct must be 'common' */ 45 | 46 | struct que_common_struct{ 47 | ulint type; /*!< query node type */ 48 | que_node_t* parent; /*!< back pointer to parent node, or NULL */ 49 | que_node_t* brother;/* pointer to a possible brother node */ 50 | dfield_t val; /*!< evaluated value for an expression */ 51 | ulint val_buf_size; 52 | /* buffer size for the evaluated value data, 53 | if the buffer has been allocated dynamically: 54 | if this field is != 0, and the node is a 55 | symbol node or a function node, then we 56 | have to free the data field in val 57 | explicitly */ 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/read0read.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/read0read.ic 21 | Cursor read 22 | 23 | Created 2/16/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | /*********************************************************************//** 27 | Gets the nth trx id in a read view. 28 | @return trx id */ 29 | UNIV_INLINE 30 | trx_id_t 31 | read_view_get_nth_trx_id( 32 | /*=====================*/ 33 | const read_view_t* view, /*!< in: read view */ 34 | ulint n) /*!< in: position */ 35 | { 36 | ut_ad(n < view->n_trx_ids); 37 | 38 | return(*(view->trx_ids + n)); 39 | } 40 | 41 | /*********************************************************************//** 42 | Sets the nth trx id in a read view. */ 43 | UNIV_INLINE 44 | void 45 | read_view_set_nth_trx_id( 46 | /*=====================*/ 47 | read_view_t* view, /*!< in: read view */ 48 | ulint n, /*!< in: position */ 49 | trx_id_t trx_id) /*!< in: trx id to set */ 50 | { 51 | ut_ad(n < view->n_trx_ids); 52 | 53 | *(view->trx_ids + n) = trx_id; 54 | } 55 | 56 | /*********************************************************************//** 57 | Checks if a read view sees the specified transaction. 58 | @return TRUE if sees */ 59 | UNIV_INLINE 60 | ibool 61 | read_view_sees_trx_id( 62 | /*==================*/ 63 | const read_view_t* view, /*!< in: read view */ 64 | trx_id_t trx_id) /*!< in: trx id */ 65 | { 66 | ulint n_ids; 67 | int cmp; 68 | ulint i; 69 | 70 | if (ut_dulint_cmp(trx_id, view->up_limit_id) < 0) { 71 | 72 | return(TRUE); 73 | } 74 | 75 | if (ut_dulint_cmp(trx_id, view->low_limit_id) >= 0) { 76 | 77 | return(FALSE); 78 | } 79 | 80 | /* We go through the trx ids in the array smallest first: this order 81 | may save CPU time, because if there was a very long running 82 | transaction in the trx id array, its trx id is looked at first, and 83 | the first two comparisons may well decide the visibility of trx_id. */ 84 | 85 | n_ids = view->n_trx_ids; 86 | 87 | for (i = 0; i < n_ids; i++) { 88 | 89 | cmp = ut_dulint_cmp( 90 | trx_id, 91 | read_view_get_nth_trx_id(view, n_ids - i - 1)); 92 | if (cmp <= 0) { 93 | return(cmp < 0); 94 | } 95 | } 96 | 97 | return(TRUE); 98 | } 99 | -------------------------------------------------------------------------------- /include/read0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/read0types.h 21 | Cursor read 22 | 23 | Created 2/16/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef read0types_h 27 | #define read0types_h 28 | 29 | typedef struct read_view_struct read_view_t; 30 | typedef struct cursor_view_struct cursor_view_t; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /include/rem0cmp.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /*******************************************************************//** 20 | @file include/rem0cmp.ic 21 | Comparison services for records 22 | 23 | Created 7/1/1994 Heikki Tuuri 24 | ************************************************************************/ 25 | 26 | /*************************************************************//** 27 | This function is used to compare two data fields for which we know the 28 | data type. 29 | @return 1, 0, -1, if data1 is greater, equal, less than data2, respectively */ 30 | UNIV_INLINE 31 | int 32 | cmp_data_data( 33 | /*==========*/ 34 | void* cmp_ctx,/*!< in: client compare context */ 35 | ulint mtype, /*!< in: main type */ 36 | ulint prtype, /*!< in: precise type */ 37 | const byte* data1, /*!< in: data field (== a pointer to a memory 38 | buffer) */ 39 | ulint len1, /*!< in: data field length or UNIV_SQL_NULL */ 40 | const byte* data2, /*!< in: data field (== a pointer to a memory 41 | buffer) */ 42 | ulint len2) /*!< in: data field length or UNIV_SQL_NULL */ 43 | { 44 | return(cmp_data_data_slow( 45 | cmp_ctx, mtype, prtype, data1, len1, data2, len2)); 46 | } 47 | 48 | /*************************************************************//** 49 | This function is used to compare two dfields where at least the first 50 | has its data type field set. 51 | @return 1, 0, -1, if dfield1 is greater, equal, less than dfield2, 52 | respectively */ 53 | UNIV_INLINE 54 | int 55 | cmp_dfield_dfield( 56 | /*==============*/ 57 | void* cmp_ctx,/*!< in: client compare context */ 58 | const dfield_t* dfield1,/*!< in: data field; must have type field set */ 59 | const dfield_t* dfield2)/*!< in: data field */ 60 | { 61 | const dtype_t* type; 62 | 63 | ut_ad(dfield_check_typed(dfield1)); 64 | 65 | type = dfield_get_type(dfield1); 66 | 67 | return(cmp_data_data( 68 | cmp_ctx, type->mtype, type->prtype, 69 | (const byte*) dfield_get_data(dfield1), 70 | dfield_get_len(dfield1), 71 | (const byte*) dfield_get_data(dfield2), 72 | dfield_get_len(dfield2))); 73 | } 74 | 75 | /*************************************************************//** 76 | This function is used to compare two physical records. Only the common 77 | first fields are compared. 78 | @return 1, 0 , -1 if rec1 is greater, equal, less, respectively, than 79 | rec2; only the common first fields are compared */ 80 | UNIV_INLINE 81 | int 82 | cmp_rec_rec( 83 | /*========*/ 84 | const rec_t* rec1, /*!< in: physical record */ 85 | const rec_t* rec2, /*!< in: physical record */ 86 | const ulint* offsets1,/*!< in: rec_get_offsets(rec1, index) */ 87 | const ulint* offsets2,/*!< in: rec_get_offsets(rec2, index) */ 88 | dict_index_t* index) /*!< in: data dictionary index */ 89 | { 90 | ulint match_f = 0; 91 | ulint match_b = 0; 92 | 93 | return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index, 94 | &match_f, &match_b)); 95 | } 96 | -------------------------------------------------------------------------------- /include/rem0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /********************************************************************//** 20 | @file include/rem0types.h 21 | Record manager global types 22 | 23 | Created 5/30/1994 Heikki Tuuri 24 | *************************************************************************/ 25 | 26 | #ifndef rem0types_h 27 | #define rem0types_h 28 | 29 | /* We define the physical record simply as an array of bytes */ 30 | typedef byte rec_t; 31 | 32 | /* Maximum values for various fields (for non-blob tuples) */ 33 | #define REC_MAX_N_FIELDS (1024 - 1) 34 | #define REC_MAX_HEAP_NO (2 * 8192 - 1) 35 | #define REC_MAX_N_OWNED (16 - 1) 36 | 37 | /* REC_MAX_INDEX_COL_LEN is measured in bytes and is the maximum 38 | indexed column length (or indexed prefix length). It is set to 3*256, 39 | so that one can create a column prefix index on 256 characters of a 40 | TEXT or VARCHAR column also in the UTF-8 charset. In that charset, 41 | a character may take at most 3 bytes. 42 | This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data 43 | files would be at risk! */ 44 | #define REC_MAX_INDEX_COL_LEN 768 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/row0ext.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0ext.h 21 | Caching of externally stored column prefixes 22 | 23 | Created September 2006 Marko Makela 24 | *******************************************************/ 25 | 26 | #ifndef row0ext_h 27 | #define row0ext_h 28 | 29 | #include "univ.i" 30 | #include "row0types.h" 31 | #include "data0types.h" 32 | #include "mem0mem.h" 33 | 34 | /********************************************************************//** 35 | Creates a cache of column prefixes of externally stored columns. 36 | @return own: column prefix cache */ 37 | UNIV_INTERN 38 | row_ext_t* 39 | row_ext_create( 40 | /*===========*/ 41 | ulint n_ext, /*!< in: number of externally stored columns */ 42 | const ulint* ext, /*!< in: col_no's of externally stored columns 43 | in the InnoDB table object, as reported by 44 | dict_col_get_no(); NOT relative to the records 45 | in the clustered index */ 46 | const dtuple_t* tuple, /*!< in: data tuple containing the field 47 | references of the externally stored 48 | columns; must be indexed by col_no; 49 | the clustered index record must be 50 | covered by a lock or a page latch 51 | to prevent deletion (rollback or purge). */ 52 | ulint zip_size,/*!< compressed page size in bytes, or 0 */ 53 | mem_heap_t* heap); /*!< in: heap where created */ 54 | 55 | /********************************************************************//** 56 | Looks up a column prefix of an externally stored column. 57 | @return column prefix, or NULL if the column is not stored externally, 58 | or pointer to field_ref_zero if the BLOB pointer is unset */ 59 | UNIV_INLINE 60 | const byte* 61 | row_ext_lookup_ith( 62 | /*===============*/ 63 | const row_ext_t* ext, /*!< in/out: column prefix cache */ 64 | ulint i, /*!< in: index of ext->ext[] */ 65 | ulint* len); /*!< out: length of prefix, in bytes, 66 | at most REC_MAX_INDEX_COL_LEN */ 67 | /********************************************************************//** 68 | Looks up a column prefix of an externally stored column. 69 | @return column prefix, or NULL if the column is not stored externally, 70 | or pointer to field_ref_zero if the BLOB pointer is unset */ 71 | UNIV_INLINE 72 | const byte* 73 | row_ext_lookup( 74 | /*===========*/ 75 | const row_ext_t* ext, /*!< in: column prefix cache */ 76 | ulint col, /*!< in: column number in the InnoDB 77 | table object, as reported by 78 | dict_col_get_no(); NOT relative to the 79 | records in the clustered index */ 80 | ulint* len); /*!< out: length of prefix, in bytes, 81 | at most REC_MAX_INDEX_COL_LEN */ 82 | 83 | /** Prefixes of externally stored columns */ 84 | struct row_ext_struct{ 85 | ulint n_ext; /*!< number of externally stored columns */ 86 | const ulint* ext; /*!< col_no's of externally stored columns */ 87 | byte* buf; /*!< backing store of the column prefix cache */ 88 | ulint len[1]; /*!< prefix lengths; 0 if not cached */ 89 | }; 90 | 91 | #ifndef UNIV_NONINL 92 | #include "row0ext.ic" 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /include/row0ext.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0ext.ic 21 | Caching of externally stored column prefixes 22 | 23 | Created September 2006 Marko Makela 24 | *******************************************************/ 25 | 26 | #include "rem0types.h" 27 | #include "btr0types.h" 28 | 29 | /********************************************************************//** 30 | Looks up a column prefix of an externally stored column. 31 | @return column prefix, or NULL if the column is not stored externally, 32 | or pointer to field_ref_zero if the BLOB pointer is unset */ 33 | UNIV_INLINE 34 | const byte* 35 | row_ext_lookup_ith( 36 | /*===============*/ 37 | const row_ext_t* ext, /*!< in/out: column prefix cache */ 38 | ulint i, /*!< in: index of ext->ext[] */ 39 | ulint* len) /*!< out: length of prefix, in bytes, 40 | at most REC_MAX_INDEX_COL_LEN */ 41 | { 42 | ut_ad(ext); 43 | ut_ad(len); 44 | ut_ad(i < ext->n_ext); 45 | 46 | *len = ext->len[i]; 47 | 48 | if (UNIV_UNLIKELY(*len == 0)) { 49 | /* The BLOB could not be fetched to the cache. */ 50 | return(field_ref_zero); 51 | } else { 52 | return(ext->buf + i * REC_MAX_INDEX_COL_LEN); 53 | } 54 | } 55 | 56 | /********************************************************************//** 57 | Looks up a column prefix of an externally stored column. 58 | @return column prefix, or NULL if the column is not stored externally, 59 | or pointer to field_ref_zero if the BLOB pointer is unset */ 60 | UNIV_INLINE 61 | const byte* 62 | row_ext_lookup( 63 | /*===========*/ 64 | const row_ext_t* ext, /*!< in: column prefix cache */ 65 | ulint col, /*!< in: column number in the InnoDB 66 | table object, as reported by 67 | dict_col_get_no(); NOT relative to the 68 | records in the clustered index */ 69 | ulint* len) /*!< out: length of prefix, in bytes, 70 | at most REC_MAX_INDEX_COL_LEN */ 71 | { 72 | ulint i; 73 | 74 | ut_ad(ext); 75 | ut_ad(len); 76 | 77 | for (i = 0; i < ext->n_ext; i++) { 78 | if (col == ext->ext[i]) { 79 | return(row_ext_lookup_ith(ext, i, len)); 80 | } 81 | } 82 | 83 | return(NULL); 84 | } 85 | -------------------------------------------------------------------------------- /include/row0ins.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0ins.ic 21 | Insert into a table 22 | 23 | Created 4/20/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | 27 | -------------------------------------------------------------------------------- /include/row0purge.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0purge.h 21 | Purge obsolete records 22 | 23 | Created 3/14/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef row0purge_h 27 | #define row0purge_h 28 | 29 | #include "univ.i" 30 | #include "data0data.h" 31 | #include "btr0types.h" 32 | #include "btr0pcur.h" 33 | #include "dict0types.h" 34 | #include "trx0types.h" 35 | #include "que0types.h" 36 | #include "row0types.h" 37 | 38 | /********************************************************************//** 39 | Creates a purge node to a query graph. 40 | @return own: purge node */ 41 | UNIV_INTERN 42 | purge_node_t* 43 | row_purge_node_create( 44 | /*==================*/ 45 | que_thr_t* parent, /*!< in: parent node, i.e., a thr node */ 46 | mem_heap_t* heap); /*!< in: memory heap where created */ 47 | /***********************************************************//** 48 | Does the purge operation for a single undo log record. This is a high-level 49 | function used in an SQL execution graph. 50 | @return query thread to run next or NULL */ 51 | UNIV_INTERN 52 | que_thr_t* 53 | row_purge_step( 54 | /*===========*/ 55 | que_thr_t* thr); /*!< in: query thread */ 56 | 57 | /* Purge node structure */ 58 | 59 | struct purge_node_struct{ 60 | que_common_t common; /*!< node type: QUE_NODE_PURGE */ 61 | /*----------------------*/ 62 | /* Local storage for this graph node */ 63 | roll_ptr_t roll_ptr;/* roll pointer to undo log record */ 64 | trx_undo_rec_t* undo_rec;/* undo log record */ 65 | trx_undo_inf_t* reservation;/* reservation for the undo log record in 66 | the purge array */ 67 | undo_no_t undo_no;/* undo number of the record */ 68 | ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC, 69 | ... */ 70 | btr_pcur_t pcur; /*!< persistent cursor used in searching the 71 | clustered index record */ 72 | ibool found_clust;/* TRUE if the clustered index record 73 | determined by ref was found in the clustered 74 | index, and we were able to position pcur on 75 | it */ 76 | dict_table_t* table; /*!< table where purge is done */ 77 | ulint cmpl_info;/* compiler analysis info of an update */ 78 | upd_t* update; /*!< update vector for a clustered index 79 | record */ 80 | dtuple_t* ref; /*!< NULL, or row reference to the next row to 81 | handle */ 82 | dtuple_t* row; /*!< NULL, or a copy (also fields copied to 83 | heap) of the indexed fields of the row to 84 | handle */ 85 | dict_index_t* index; /*!< NULL, or the next index whose record should 86 | be handled */ 87 | mem_heap_t* heap; /*!< memory heap used as auxiliary storage for 88 | row; this must be emptied after a successful 89 | purge of a row */ 90 | }; 91 | 92 | #ifndef UNIV_NONINL 93 | #include "row0purge.ic" 94 | #endif 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /include/row0purge.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | 20 | /**************************************************//** 21 | @file include/row0purge.ic 22 | Purge obsolete records 23 | 24 | Created 3/14/1997 Heikki Tuuri 25 | *******************************************************/ 26 | -------------------------------------------------------------------------------- /include/row0row.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0row.ic 21 | General row routines 22 | 23 | Created 4/20/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "dict0dict.h" 27 | #include "rem0rec.h" 28 | #include "trx0undo.h" 29 | 30 | /*********************************************************************//** 31 | Reads the trx id field from a clustered index record. 32 | @return value of the field */ 33 | UNIV_INLINE 34 | trx_id_t 35 | row_get_rec_trx_id( 36 | /*===============*/ 37 | const rec_t* rec, /*!< in: record */ 38 | dict_index_t* index, /*!< in: clustered index */ 39 | const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ 40 | { 41 | ulint offset; 42 | 43 | ut_ad(dict_index_is_clust(index)); 44 | ut_ad(rec_offs_validate(rec, index, offsets)); 45 | 46 | offset = index->trx_id_offset; 47 | 48 | if (!offset) { 49 | offset = row_get_trx_id_offset(rec, index, offsets); 50 | } 51 | 52 | return(trx_read_trx_id(rec + offset)); 53 | } 54 | 55 | /*********************************************************************//** 56 | Reads the roll pointer field from a clustered index record. 57 | @return value of the field */ 58 | UNIV_INLINE 59 | roll_ptr_t 60 | row_get_rec_roll_ptr( 61 | /*=================*/ 62 | const rec_t* rec, /*!< in: record */ 63 | dict_index_t* index, /*!< in: clustered index */ 64 | const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ 65 | { 66 | ulint offset; 67 | 68 | ut_ad(dict_index_is_clust(index)); 69 | ut_ad(rec_offs_validate(rec, index, offsets)); 70 | 71 | offset = index->trx_id_offset; 72 | 73 | if (!offset) { 74 | offset = row_get_trx_id_offset(rec, index, offsets); 75 | } 76 | 77 | return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN)); 78 | } 79 | 80 | /*******************************************************************//** 81 | Builds from a secondary index record a row reference with which we can 82 | search the clustered index record. */ 83 | UNIV_INLINE 84 | void 85 | row_build_row_ref_fast( 86 | /*===================*/ 87 | dtuple_t* ref, /*!< in/out: typed data tuple where the 88 | reference is built */ 89 | const ulint* map, /*!< in: array of field numbers in rec 90 | telling how ref should be built from 91 | the fields of rec */ 92 | const rec_t* rec, /*!< in: record in the index; must be 93 | preserved while ref is used, as we do 94 | not copy field values to heap */ 95 | const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ 96 | { 97 | dfield_t* dfield; 98 | const byte* field; 99 | ulint len; 100 | ulint ref_len; 101 | ulint field_no; 102 | ulint i; 103 | 104 | ut_ad(rec_offs_validate(rec, NULL, offsets)); 105 | ut_ad(!rec_offs_any_extern(offsets)); 106 | ref_len = dtuple_get_n_fields(ref); 107 | 108 | for (i = 0; i < ref_len; i++) { 109 | dfield = dtuple_get_nth_field(ref, i); 110 | 111 | field_no = *(map + i); 112 | 113 | if (field_no != ULINT_UNDEFINED) { 114 | 115 | field = rec_get_nth_field(rec, offsets, 116 | field_no, &len); 117 | dfield_set_data(dfield, field, len); 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /include/row0sel.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0sel.ic 21 | Select 22 | 23 | Created 12/19/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "que0que.h" 27 | 28 | /*********************************************************************//** 29 | Gets the plan node for the nth table in a join. 30 | @return plan node */ 31 | UNIV_INLINE 32 | plan_t* 33 | sel_node_get_nth_plan( 34 | /*==================*/ 35 | sel_node_t* node, /*!< in: select node */ 36 | ulint i) /*!< in: get ith plan node */ 37 | { 38 | ut_ad(i < node->n_tables); 39 | 40 | return(node->plans + i); 41 | } 42 | 43 | /*********************************************************************//** 44 | Resets the cursor defined by sel_node to the SEL_NODE_OPEN state, which means 45 | that it will start fetching from the start of the result set again, regardless 46 | of where it was before, and it will set intention locks on the tables. */ 47 | UNIV_INLINE 48 | void 49 | sel_node_reset_cursor( 50 | /*==================*/ 51 | sel_node_t* node) /*!< in: select node */ 52 | { 53 | node->state = SEL_NODE_OPEN; 54 | } 55 | 56 | /**********************************************************************//** 57 | Performs an execution step of an open or close cursor statement node. 58 | @return query thread to run next or NULL */ 59 | UNIV_INLINE 60 | que_thr_t* 61 | open_step( 62 | /*======*/ 63 | que_thr_t* thr) /*!< in: query thread */ 64 | { 65 | sel_node_t* sel_node; 66 | open_node_t* node; 67 | ulint err; 68 | 69 | ut_ad(thr); 70 | 71 | node = (open_node_t*) thr->run_node; 72 | ut_ad(que_node_get_type(node) == QUE_NODE_OPEN); 73 | 74 | sel_node = node->cursor_def; 75 | 76 | err = DB_SUCCESS; 77 | 78 | if (node->op_type == ROW_SEL_OPEN_CURSOR) { 79 | 80 | /* if (sel_node->state == SEL_NODE_CLOSED) { */ 81 | 82 | sel_node_reset_cursor(sel_node); 83 | /* } else { 84 | err = DB_ERROR; 85 | } */ 86 | } else { 87 | if (sel_node->state != SEL_NODE_CLOSED) { 88 | 89 | sel_node->state = SEL_NODE_CLOSED; 90 | } else { 91 | err = DB_ERROR; 92 | } 93 | } 94 | 95 | if (UNIV_EXPECT(err, DB_SUCCESS) != DB_SUCCESS) { 96 | /* SQL error detected */ 97 | ib_logger(ib_stream, "SQL error %lu\n", (ulong) err); 98 | 99 | ut_error; 100 | } 101 | 102 | thr->run_node = que_node_get_parent(node); 103 | 104 | return(thr); 105 | } 106 | -------------------------------------------------------------------------------- /include/row0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0types.h 21 | Row operation global types 22 | 23 | Created 12/27/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef row0types_h 27 | #define row0types_h 28 | 29 | typedef struct plan_struct plan_t; 30 | 31 | typedef struct upd_struct upd_t; 32 | 33 | typedef struct upd_field_struct upd_field_t; 34 | 35 | typedef struct upd_node_struct upd_node_t; 36 | 37 | typedef struct del_node_struct del_node_t; 38 | 39 | typedef struct ins_node_struct ins_node_t; 40 | 41 | typedef struct sel_node_struct sel_node_t; 42 | 43 | typedef struct open_node_struct open_node_t; 44 | 45 | typedef struct fetch_node_struct fetch_node_t; 46 | 47 | typedef struct row_printf_node_struct row_printf_node_t; 48 | typedef struct sel_buf_struct sel_buf_t; 49 | 50 | typedef struct undo_node_struct undo_node_t; 51 | 52 | typedef struct purge_node_struct purge_node_t; 53 | 54 | typedef struct row_ext_struct row_ext_t; 55 | 56 | typedef void* table_handle_t; 57 | 58 | typedef struct row_prebuilt_struct row_prebuilt_t; 59 | 60 | /* Insert node types */ 61 | typedef enum ib_ins_mode_enum { 62 | /* The first two modes are only 63 | used by the internal SQL parser */ 64 | INS_SEARCHED, /* INSERT INTO ... SELECT ... */ 65 | INS_VALUES, /* INSERT INTO ... VALUES ... */ 66 | INS_DIRECT /* Insert the row directly */ 67 | } ib_ins_mode_t; 68 | 69 | /* Node execution states */ 70 | typedef enum ib_ins_state_enum { 71 | INS_NODE_SET_IX_LOCK = 1, /* we should set an IX lock on table */ 72 | INS_NODE_ALLOC_ROW_ID, /* row id should be allocated */ 73 | INS_NODE_INSERT_ENTRIES /* index entries should be built and 74 | inserted */ 75 | } ib_ins_state_t; 76 | 77 | /* Flags for positioning the cursor. */ 78 | typedef enum ib_cur_op_enum { 79 | ROW_SEL_MOVETO, /* required when openeing a cursor */ 80 | ROW_SEL_NEXT, /* move to next record */ 81 | ROW_SEL_PREV /* move to previous record */ 82 | } ib_cur_op_t; 83 | 84 | /* Various match modes when fetching a record from a table. */ 85 | typedef enum ib_match_enum { 86 | ROW_SEL_DEFAULT, /* closest match possible */ 87 | ROW_SEL_EXACT, /* search using a complete key value */ 88 | ROW_SEL_EXACT_PREFIX /* search using a key prefix which 89 | must match to rows: the prefix may 90 | contain an incomplete field (the 91 | last field in prefix may be just 92 | a prefix of a fixed length column) */ 93 | } ib_match_t; 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /include/row0uins.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0uins.h 21 | Fresh insert undo 22 | 23 | Created 2/25/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef row0uins_h 27 | #define row0uins_h 28 | 29 | #include "univ.i" 30 | #include "data0data.h" 31 | #include "dict0types.h" 32 | #include "trx0types.h" 33 | #include "que0types.h" 34 | #include "row0types.h" 35 | #include "mtr0mtr.h" 36 | 37 | /***********************************************************//** 38 | Undoes a fresh insert of a row to a table. A fresh insert means that 39 | the same clustered index unique key did not have any record, even delete 40 | marked, at the time of the insert. InnoDB is eager in a rollback: 41 | if it figures out that an index record will be removed in the purge 42 | anyway, it will remove it in the rollback. 43 | @return DB_SUCCESS */ 44 | UNIV_INTERN 45 | ulint 46 | row_undo_ins( 47 | /*=========*/ 48 | undo_node_t* node); /*!< in: row undo node */ 49 | 50 | #ifndef UNIV_NONINL 51 | #include "row0uins.ic" 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/row0uins.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0uins.ic 21 | Fresh insert undo 22 | 23 | Created 2/25/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | -------------------------------------------------------------------------------- /include/row0umod.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0umod.h 21 | Undo modify of a row 22 | 23 | Created 2/27/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef row0umod_h 27 | #define row0umod_h 28 | 29 | #include "univ.i" 30 | #include "data0data.h" 31 | #include "dict0types.h" 32 | #include "trx0types.h" 33 | #include "que0types.h" 34 | #include "row0types.h" 35 | #include "mtr0mtr.h" 36 | 37 | /***********************************************************//** 38 | Undoes a modify operation on a row of a table. 39 | @return DB_SUCCESS or error code */ 40 | UNIV_INTERN 41 | ulint 42 | row_undo_mod( 43 | /*=========*/ 44 | undo_node_t* node, /*!< in: row undo node */ 45 | que_thr_t* thr); /*!< in: query thread */ 46 | 47 | 48 | #ifndef UNIV_NONINL 49 | #include "row0umod.ic" 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/row0umod.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0umod.ic 21 | Undo modify of a row 22 | 23 | Created 2/27/1997 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/row0undo.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0undo.ic 21 | Row undo 22 | 23 | Created 1/8/1997 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/row0vers.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/row0vers.ic 21 | Row versions 22 | 23 | Created 2/6/1997 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "row0row.h" 27 | #include "dict0dict.h" 28 | #include "read0read.h" 29 | #include "page0page.h" 30 | #include "log0recv.h" 31 | -------------------------------------------------------------------------------- /include/srv0que.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/srv0que.h 21 | Server query execution 22 | 23 | Created 6/5/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef srv0que_h 27 | #define srv0que_h 28 | 29 | #include "univ.i" 30 | #include "que0types.h" 31 | 32 | /**********************************************************************//** 33 | Enqueues a task to server task queue and releases a worker thread, if there 34 | is a suspended one. */ 35 | UNIV_INTERN 36 | void 37 | srv_que_task_enqueue_low( 38 | /*=====================*/ 39 | que_thr_t* thr); /*!< in: query thread */ 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /include/srv0srv.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/srv0srv.ic 21 | Server main program 22 | 23 | Created 10/4/1995 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/sync0arr.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/sync0arr.ic 21 | The wait array for synchronization primitives 22 | 23 | Inline code 24 | 25 | Created 9/5/1995 Heikki Tuuri 26 | *******************************************************/ 27 | 28 | -------------------------------------------------------------------------------- /include/sync0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/sync0types.h 21 | Global types for sync 22 | 23 | Created 9/5/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef sync0types_h 27 | #define sync0types_h 28 | 29 | /** Rename mutex_t to avoid name space collision on some systems */ 30 | #define mutex_t ib_mutex_t 31 | /** InnoDB mutex */ 32 | typedef struct mutex_struct mutex_t; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/thr0loc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/thr0loc.h 21 | The thread local storage 22 | 23 | Created 10/5/1995 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | /* This module implements storage private to each thread, 27 | a capability useful in some situations like storing the 28 | OS handle to the current thread, or its priority. */ 29 | 30 | #ifndef thr0loc_h 31 | #define thr0loc_h 32 | 33 | #include "univ.i" 34 | #include "os0thread.h" 35 | 36 | /****************************************************************//** 37 | Initializes the thread local storage module. */ 38 | UNIV_INTERN 39 | void 40 | thr_local_init(void); 41 | /*================*/ 42 | /******************************************************************//** 43 | Close the thread local storage module. */ 44 | UNIV_INTERN 45 | void 46 | thr_local_close(void); 47 | /*=================*/ 48 | /*******************************************************************//** 49 | Creates a local storage struct for the calling new thread. */ 50 | UNIV_INTERN 51 | void 52 | thr_local_create(void); 53 | /*==================*/ 54 | /*******************************************************************//** 55 | Frees the local storage struct for the specified thread. */ 56 | UNIV_INTERN 57 | void 58 | thr_local_free( 59 | /*===========*/ 60 | os_thread_id_t id); /*!< in: thread id */ 61 | /*******************************************************************//** 62 | Gets the slot number in the thread table of a thread. 63 | @return slot number */ 64 | UNIV_INTERN 65 | ulint 66 | thr_local_get_slot_no( 67 | /*==================*/ 68 | os_thread_id_t id); /*!< in: thread id of the thread */ 69 | /*******************************************************************//** 70 | Sets in the local storage the slot number in the thread table of a thread. */ 71 | UNIV_INTERN 72 | void 73 | thr_local_set_slot_no( 74 | /*==================*/ 75 | os_thread_id_t id, /*!< in: thread id of the thread */ 76 | ulint slot_no);/*!< in: slot number */ 77 | /*******************************************************************//** 78 | Returns pointer to the 'in_ibuf' field within the current thread local 79 | storage. 80 | @return pointer to the in_ibuf field */ 81 | UNIV_INTERN 82 | ibool* 83 | thr_local_get_in_ibuf_field(void); 84 | /*=============================*/ 85 | 86 | #ifndef UNIV_NONINL 87 | #include "thr0loc.ic" 88 | #endif 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /include/thr0loc.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/thr0loc.ic 21 | Thread local storage 22 | 23 | Created 10/4/1995 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/trx0purge.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/trx0purge.ic 21 | Purge old versions 22 | 23 | Created 3/26/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "trx0undo.h" 27 | 28 | /********************************************************************//** 29 | Calculates the file address of an undo log header when we have the file 30 | address of its history list node. 31 | @return file address of the log */ 32 | UNIV_INLINE 33 | fil_addr_t 34 | trx_purge_get_log_from_hist( 35 | /*========================*/ 36 | fil_addr_t node_addr) /*!< in: file address of the history 37 | list node of the log */ 38 | { 39 | node_addr.boffset -= TRX_UNDO_HISTORY_NODE; 40 | 41 | return(node_addr); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /include/trx0rec.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/trx0rec.ic 21 | Transaction undo log record 22 | 23 | Created 3/26/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef UNIV_HOTBACKUP 27 | /**********************************************************************//** 28 | Reads from an undo log record the record type. 29 | @return record type */ 30 | UNIV_INLINE 31 | ulint 32 | trx_undo_rec_get_type( 33 | /*==================*/ 34 | const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 35 | { 36 | return(mach_read_from_1(undo_rec + 2) & (TRX_UNDO_CMPL_INFO_MULT - 1)); 37 | } 38 | 39 | /**********************************************************************//** 40 | Reads from an undo log record the record compiler info. 41 | @return compiler info */ 42 | UNIV_INLINE 43 | ulint 44 | trx_undo_rec_get_cmpl_info( 45 | /*=======================*/ 46 | const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 47 | { 48 | return(mach_read_from_1(undo_rec + 2) / TRX_UNDO_CMPL_INFO_MULT); 49 | } 50 | 51 | /**********************************************************************//** 52 | Returns TRUE if an undo log record contains an extern storage field. 53 | @return TRUE if extern */ 54 | UNIV_INLINE 55 | ibool 56 | trx_undo_rec_get_extern_storage( 57 | /*============================*/ 58 | const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 59 | { 60 | if (mach_read_from_1(undo_rec + 2) & TRX_UNDO_UPD_EXTERN) { 61 | 62 | return(TRUE); 63 | } 64 | 65 | return(FALSE); 66 | } 67 | 68 | /**********************************************************************//** 69 | Reads the undo log record number. 70 | @return undo no */ 71 | UNIV_INLINE 72 | undo_no_t 73 | trx_undo_rec_get_undo_no( 74 | /*=====================*/ 75 | const trx_undo_rec_t* undo_rec) /*!< in: undo log record */ 76 | { 77 | const byte* ptr; 78 | 79 | ptr = undo_rec + 3; 80 | 81 | return(mach_dulint_read_much_compressed(ptr)); 82 | } 83 | 84 | /**********************************************************************//** 85 | Returns the start of the undo record data area. 86 | @return offset to the data area */ 87 | UNIV_INLINE 88 | ulint 89 | trx_undo_rec_get_offset( 90 | /*====================*/ 91 | undo_no_t undo_no) /*!< in: undo no read from node */ 92 | { 93 | return (3 + mach_dulint_get_much_compressed_size(undo_no)); 94 | } 95 | 96 | /***********************************************************************//** 97 | Copies the undo record to the heap. 98 | @return own: copy of undo log record */ 99 | UNIV_INLINE 100 | trx_undo_rec_t* 101 | trx_undo_rec_copy( 102 | /*==============*/ 103 | const trx_undo_rec_t* undo_rec, /*!< in: undo log record */ 104 | mem_heap_t* heap) /*!< in: heap where copied */ 105 | { 106 | ulint len; 107 | 108 | len = mach_read_from_2(undo_rec) 109 | - ut_align_offset(undo_rec, UNIV_PAGE_SIZE); 110 | return(mem_heap_dup(heap, undo_rec, len)); 111 | } 112 | #endif /* !UNIV_HOTBACKUP */ 113 | -------------------------------------------------------------------------------- /include/trx0roll.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/trx0roll.ic 21 | Transaction rollback 22 | 23 | Created 3/26/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | /*******************************************************************//** 27 | Returns pointer to nth element in an undo number array. 28 | @return pointer to the nth element */ 29 | UNIV_INLINE 30 | trx_undo_inf_t* 31 | trx_undo_arr_get_nth_info( 32 | /*======================*/ 33 | trx_undo_arr_t* arr, /*!< in: undo number array */ 34 | ulint n) /*!< in: position */ 35 | { 36 | ut_ad(arr); 37 | ut_ad(n < arr->n_cells); 38 | 39 | return(arr->infos + n); 40 | } 41 | -------------------------------------------------------------------------------- /include/trx0xa.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /* 20 | * Start of xa.h header 21 | * 22 | * Define a symbol to prevent multiple inclusions of this header file 23 | */ 24 | #ifndef XA_H 25 | #define XA_H 26 | 27 | /* 28 | * Transaction branch identification: XID and NULLXID: 29 | */ 30 | #ifndef XIDDATASIZE 31 | 32 | /** Sizes of transaction identifier */ 33 | #define XIDDATASIZE 128 /*!< maximum size of a transaction 34 | identifier, in bytes */ 35 | #define MAXGTRIDSIZE 64 /*!< maximum size in bytes of gtrid */ 36 | #define MAXBQUALSIZE 64 /*!< maximum size in bytes of bqual */ 37 | 38 | /** X/Open XA distributed transaction identifier */ 39 | struct xid_t { 40 | long formatID; /*!< format identifier; -1 41 | means that the XID is null */ 42 | long gtrid_length; /*!< value from 1 through 64 */ 43 | long bqual_length; /*!< value from 1 through 64 */ 44 | char data[XIDDATASIZE]; /*!< distributed transaction 45 | identifier */ 46 | }; 47 | 48 | /** X/Open XA distributed transaction identifier */ 49 | typedef struct xid_t XID; 50 | 51 | #endif 52 | /** X/Open XA distributed transaction status codes */ 53 | /* @{ */ 54 | #define XA_OK 0 /*!< normal execution */ 55 | #define XAER_ASYNC -2 /*!< asynchronous operation already 56 | outstanding */ 57 | #define XAER_RMERR -3 /*!< a resource manager error 58 | occurred in the transaction 59 | branch */ 60 | #define XAER_NOTA -4 /*!< the XID is not valid */ 61 | #define XAER_INVAL -5 /*!< invalid arguments were given */ 62 | #define XAER_PROTO -6 /*!< routine invoked in an improper 63 | context */ 64 | #define XAER_RMFAIL -7 /*!< resource manager unavailable */ 65 | #define XAER_DUPID -8 /*!< the XID already exists */ 66 | #define XAER_OUTSIDE -9 /*!< resource manager doing 67 | work outside transaction */ 68 | /* @} */ 69 | 70 | #endif /* ifndef XA_H */ 71 | /* 72 | * End of xa.h header 73 | */ 74 | -------------------------------------------------------------------------------- /include/usr0sess.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/usr0sess.h 21 | Sessions 22 | 23 | Created 6/25/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef usr0sess_h 27 | #define usr0sess_h 28 | 29 | #include "univ.i" 30 | #include "ut0byte.h" 31 | #include "trx0types.h" 32 | #include "srv0srv.h" 33 | #include "trx0types.h" 34 | #include "usr0types.h" 35 | #include "que0types.h" 36 | #include "data0data.h" 37 | #include "rem0rec.h" 38 | 39 | /*********************************************************************//** 40 | Opens a session. 41 | @return own: session object */ 42 | UNIV_INTERN 43 | sess_t* 44 | sess_open(void); 45 | /*============*/ 46 | /*********************************************************************//** 47 | Closes a session, freeing the memory occupied by it. */ 48 | UNIV_INTERN 49 | void 50 | sess_close( 51 | /*=======*/ 52 | sess_t* sess); /*!< in, own: session object */ 53 | 54 | /** The session handle. All fields are protected by the kernel mutex */ 55 | struct sess_struct{ 56 | ulint state; /*!< state of the session */ 57 | trx_t* trx; /*!< transaction object permanently 58 | assigned for the session: the 59 | transaction instance designated by the 60 | trx id changes, but the memory 61 | structure is preserved */ 62 | UT_LIST_BASE_NODE_T(que_t) 63 | graphs; /*!< query graphs belonging to this 64 | session */ 65 | }; 66 | 67 | /* Session states */ 68 | #define SESS_ACTIVE 1 69 | #define SESS_ERROR 2 /* session contains an error message 70 | which has not yet been communicated 71 | to the client */ 72 | #ifndef UNIV_NONINL 73 | #include "usr0sess.ic" 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /include/usr0sess.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/usr0sess.ic 21 | Sessions 22 | 23 | Created 6/25/1996 Heikki Tuuri 24 | *******************************************************/ 25 | -------------------------------------------------------------------------------- /include/usr0types.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file include/usr0types.h 21 | Users and sessions global types 22 | 23 | Created 6/25/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #ifndef usr0types_h 27 | #define usr0types_h 28 | 29 | typedef struct sess_struct sess_t; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /include/ut0list.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /*******************************************************************//** 20 | @file include/ut0list.ic 21 | A double-linked list 22 | 23 | Created 4/26/2006 Osku Salerma 24 | ************************************************************************/ 25 | 26 | /****************************************************************//** 27 | Get the first node in the list. 28 | @return first node, or NULL */ 29 | UNIV_INLINE 30 | ib_list_node_t* 31 | ib_list_get_first( 32 | /*==============*/ 33 | ib_list_t* list) /*!< in: list */ 34 | { 35 | return(list->first); 36 | } 37 | 38 | /****************************************************************//** 39 | Get the last node in the list. 40 | @return last node, or NULL */ 41 | UNIV_INLINE 42 | ib_list_node_t* 43 | ib_list_get_last( 44 | /*=============*/ 45 | ib_list_t* list) /*!< in: list */ 46 | { 47 | return(list->last); 48 | } 49 | -------------------------------------------------------------------------------- /include/ut0mem.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nextgres/oss-embedded-innodb/20f627d05773b6fdc7eb25059882e10e96dc6525/include/ut0mem.h -------------------------------------------------------------------------------- /include/ut0sort.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file include/ut0sort.h 21 | Sort utility 22 | 23 | Created 11/9/1995 Heikki Tuuri 24 | ***********************************************************************/ 25 | 26 | #ifndef ut0sort_h 27 | #define ut0sort_h 28 | 29 | #include "univ.i" 30 | 31 | /* This module gives a macro definition of the body of 32 | a standard sort function for an array of elements of any 33 | type. The comparison function is given as a parameter to 34 | the macro. The sort algorithm is mergesort which has logarithmic 35 | worst case. 36 | */ 37 | 38 | /*******************************************************************//** 39 | This macro expands to the body of a standard sort function. 40 | The sort function uses mergesort and must be defined separately 41 | for each type of array. 42 | Also the comparison function has to be defined individually 43 | for each array cell type. SORT_FUN is the sort function name. 44 | The function takes the array to be sorted (ARR), 45 | the array of auxiliary space (AUX_ARR) of same size, 46 | and the low (LOW), inclusive, and high (HIGH), noninclusive, 47 | limits for the sort interval as arguments. 48 | CMP_FUN is the comparison function name. It takes as arguments 49 | two elements from the array and returns 1, if the first is bigger, 50 | 0 if equal, and -1 if the second bigger. */ 51 | 52 | #define UT_SORT_FUNCTION_BODY(\ 53 | CMP_CTX, SORT_FUN, ARR, AUX_ARR, LOW, HIGH, CMP_FUN)\ 54 | {\ 55 | ulint ut_sort_mid77;\ 56 | ulint ut_sort_i77;\ 57 | ulint ut_sort_low77;\ 58 | ulint ut_sort_high77;\ 59 | \ 60 | ut_ad((LOW) < (HIGH));\ 61 | ut_ad(ARR);\ 62 | ut_ad(AUX_ARR);\ 63 | \ 64 | if ((LOW) == (HIGH) - 1) {\ 65 | return;\ 66 | } else if ((LOW) == (HIGH) - 2) {\ 67 | if (CMP_FUN((CMP_CTX),(ARR)[LOW], (ARR)[(HIGH) - 1]) > 0) {\ 68 | (AUX_ARR)[LOW] = (ARR)[LOW];\ 69 | (ARR)[LOW] = (ARR)[(HIGH) - 1];\ 70 | (ARR)[(HIGH) - 1] = (AUX_ARR)[LOW];\ 71 | }\ 72 | return;\ 73 | }\ 74 | \ 75 | ut_sort_mid77 = ((LOW) + (HIGH)) / 2;\ 76 | \ 77 | SORT_FUN((CMP_CTX), (ARR), (AUX_ARR), (LOW), ut_sort_mid77);\ 78 | SORT_FUN((CMP_CTX), (ARR), (AUX_ARR), ut_sort_mid77, (HIGH));\ 79 | \ 80 | ut_sort_low77 = (LOW);\ 81 | ut_sort_high77 = ut_sort_mid77;\ 82 | \ 83 | for (ut_sort_i77 = (LOW); ut_sort_i77 < (HIGH); ut_sort_i77++) {\ 84 | \ 85 | if (ut_sort_low77 >= ut_sort_mid77) {\ 86 | (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ 87 | ut_sort_high77++;\ 88 | } else if (ut_sort_high77 >= (HIGH)) {\ 89 | (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ 90 | ut_sort_low77++;\ 91 | } else if (CMP_FUN((CMP_CTX),(ARR)[ut_sort_low77],\ 92 | (ARR)[ut_sort_high77]) > 0) {\ 93 | (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_high77];\ 94 | ut_sort_high77++;\ 95 | } else {\ 96 | (AUX_ARR)[ut_sort_i77] = (ARR)[ut_sort_low77];\ 97 | ut_sort_low77++;\ 98 | }\ 99 | }\ 100 | \ 101 | memcpy((void*) ((ARR) + (LOW)), (AUX_ARR) + (LOW),\ 102 | ((HIGH) - (LOW)) * sizeof *(ARR));\ 103 | }\ 104 | 105 | 106 | #endif 107 | 108 | -------------------------------------------------------------------------------- /include/ut0vec.ic: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /*******************************************************************//** 20 | @file include/ut0vec.ic 21 | A vector of pointers to data items 22 | 23 | Created 4/6/2006 Osku Salerma 24 | ************************************************************************/ 25 | 26 | /****************************************************************//** 27 | Get number of elements in vector. 28 | @return number of elements in vector */ 29 | UNIV_INLINE 30 | ulint 31 | ib_vector_size( 32 | /*===========*/ 33 | const ib_vector_t* vec) /*!< in: vector */ 34 | { 35 | return(vec->used); 36 | } 37 | 38 | /****************************************************************//** 39 | Get n'th element. 40 | @return n'th element */ 41 | UNIV_INLINE 42 | void* 43 | ib_vector_get( 44 | /*==========*/ 45 | ib_vector_t* vec, /*!< in: vector */ 46 | ulint n) /*!< in: element index to get */ 47 | { 48 | ut_a(n < ib_vector_size(vec)); 49 | 50 | return(vec->data[n]); 51 | } 52 | 53 | /****************************************************************//** 54 | Get n'th element as a const pointer. 55 | @return n'th element */ 56 | UNIV_INLINE 57 | const void* 58 | ib_vector_get_const( 59 | /*================*/ 60 | const ib_vector_t* vec, /*!< in: vector */ 61 | ulint n) /*!< in: element index to get */ 62 | { 63 | ut_a(n < ib_vector_size(vec)); 64 | 65 | return(vec->data[n]); 66 | } 67 | 68 | /****************************************************************//** 69 | Set n'th element and return the previous value. 70 | @return n'th element */ 71 | UNIV_INLINE 72 | void* 73 | ib_vector_set( 74 | /*==========*/ 75 | ib_vector_t* vec, /*!< in: vector */ 76 | ulint n, /*!< in: element index to set */ 77 | void* p) /*!< in: new value to set */ 78 | { 79 | void* prev; 80 | 81 | ut_a(n < ib_vector_size(vec)); 82 | 83 | prev = vec->data[n]; 84 | vec->data[n] = p; 85 | 86 | return(prev); 87 | } 88 | 89 | /******************************************************************** 90 | Remove the last element from the vector. 91 | @return last vector element */ 92 | UNIV_INLINE 93 | void* 94 | ib_vector_pop( 95 | /*==========*/ 96 | ib_vector_t* vec) /*!< in/out: vector */ 97 | { 98 | void* elem; 99 | 100 | ut_a(vec->used > 0); 101 | --vec->used; 102 | elem = vec->data[vec->used]; 103 | 104 | ut_d(vec->data[vec->used] = NULL); 105 | UNIV_MEM_INVALID(&vec->data[vec->used], sizeof(*vec->data)); 106 | 107 | return(elem); 108 | } 109 | 110 | /****************************************************************//** 111 | Free the underlying heap of the vector. Note that vec is invalid 112 | after this call. */ 113 | UNIV_INLINE 114 | void 115 | ib_vector_free( 116 | /*===========*/ 117 | ib_vector_t* vec) /*!< in, own: vector */ 118 | { 119 | mem_heap_free(vec->heap); 120 | } 121 | 122 | /****************************************************************//** 123 | Test whether a vector is empty or not. 124 | @return TRUE if empty */ 125 | UNIV_INLINE 126 | ibool 127 | ib_vector_is_empty( 128 | /*===============*/ 129 | const ib_vector_t* vec) /*!< in: vector */ 130 | { 131 | return(ib_vector_size(vec) == 0); 132 | } 133 | -------------------------------------------------------------------------------- /lock/lock0iter.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file lock/lock0iter.c 21 | Lock queue iterator. Can iterate over table and record 22 | lock queues. 23 | 24 | Created July 16, 2007 Vasil Dimov 25 | *******************************************************/ 26 | 27 | #define LOCK_MODULE_IMPLEMENTATION 28 | 29 | #include "univ.i" 30 | #include "lock0iter.h" 31 | #include "lock0lock.h" 32 | #include "lock0priv.h" 33 | #include "ut0dbg.h" 34 | #include "ut0lst.h" 35 | 36 | /*******************************************************************//** 37 | Initialize lock queue iterator so that it starts to iterate from 38 | "lock". bit_no specifies the record number within the heap where the 39 | record is stored. It can be undefined (ULINT_UNDEFINED) in two cases: 40 | 1. If the lock is a table lock, thus we have a table lock queue; 41 | 2. If the lock is a record lock and it is a wait lock. In this case 42 | bit_no is calculated in this function by using 43 | lock_rec_find_set_bit(). There is exactly one bit set in the bitmap 44 | of a wait lock. */ 45 | UNIV_INTERN 46 | void 47 | lock_queue_iterator_reset( 48 | /*======================*/ 49 | lock_queue_iterator_t* iter, /*!< out: iterator */ 50 | const lock_t* lock, /*!< in: lock to start from */ 51 | ulint bit_no) /*!< in: record number in the 52 | heap */ 53 | { 54 | iter->current_lock = lock; 55 | 56 | if (bit_no != ULINT_UNDEFINED) { 57 | 58 | iter->bit_no = bit_no; 59 | } else { 60 | 61 | switch (lock_get_type_low(lock)) { 62 | case LOCK_TABLE: 63 | iter->bit_no = ULINT_UNDEFINED; 64 | break; 65 | case LOCK_REC: 66 | iter->bit_no = lock_rec_find_set_bit(lock); 67 | ut_a(iter->bit_no != ULINT_UNDEFINED); 68 | break; 69 | default: 70 | ut_error; 71 | } 72 | } 73 | } 74 | 75 | /*******************************************************************//** 76 | Gets the previous lock in the lock queue, returns NULL if there are no 77 | more locks (i.e. the current lock is the first one). The iterator is 78 | receded (if not-NULL is returned). 79 | @return previous lock or NULL */ 80 | UNIV_INTERN 81 | const lock_t* 82 | lock_queue_iterator_get_prev( 83 | /*=========================*/ 84 | lock_queue_iterator_t* iter) /*!< in/out: iterator */ 85 | { 86 | const lock_t* prev_lock; 87 | 88 | switch (lock_get_type_low(iter->current_lock)) { 89 | case LOCK_REC: 90 | prev_lock = lock_rec_get_prev( 91 | iter->current_lock, iter->bit_no); 92 | break; 93 | case LOCK_TABLE: 94 | prev_lock = UT_LIST_GET_PREV( 95 | un_member.tab_lock.locks, iter->current_lock); 96 | break; 97 | default: 98 | ut_error; 99 | } 100 | 101 | if (prev_lock != NULL) { 102 | 103 | iter->current_lock = prev_lock; 104 | } 105 | 106 | return(prev_lock); 107 | } 108 | -------------------------------------------------------------------------------- /mach/mach0data.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /******************************************************************//** 20 | @file mach/mach0data.c 21 | Utilities for converting data from the database file 22 | to the machine format. 23 | 24 | Created 11/28/1995 Heikki Tuuri 25 | ***********************************************************************/ 26 | 27 | #include "mach0data.h" 28 | 29 | #ifdef UNIV_NONINL 30 | #include "mach0data.ic" 31 | #endif 32 | 33 | /*********************************************************//** 34 | Reads a ulint in a compressed form if the log record fully contains it. 35 | @return pointer to end of the stored field, NULL if not complete */ 36 | UNIV_INTERN 37 | byte* 38 | mach_parse_compressed( 39 | /*==================*/ 40 | byte* ptr, /*!< in: pointer to buffer from where to read */ 41 | byte* end_ptr,/*!< in: pointer to end of the buffer */ 42 | ulint* val) /*!< out: read value (< 2^32) */ 43 | { 44 | ulint flag; 45 | 46 | ut_ad(ptr && end_ptr && val); 47 | 48 | if (ptr >= end_ptr) { 49 | 50 | return(NULL); 51 | } 52 | 53 | flag = mach_read_from_1(ptr); 54 | 55 | if (flag < 0x80UL) { 56 | *val = flag; 57 | return(ptr + 1); 58 | 59 | } else if (flag < 0xC0UL) { 60 | if (end_ptr < ptr + 2) { 61 | return(NULL); 62 | } 63 | 64 | *val = mach_read_from_2(ptr) & 0x7FFFUL; 65 | 66 | return(ptr + 2); 67 | 68 | } else if (flag < 0xE0UL) { 69 | if (end_ptr < ptr + 3) { 70 | return(NULL); 71 | } 72 | 73 | *val = mach_read_from_3(ptr) & 0x3FFFFFUL; 74 | 75 | return(ptr + 3); 76 | } else if (flag < 0xF0UL) { 77 | if (end_ptr < ptr + 4) { 78 | return(NULL); 79 | } 80 | 81 | *val = mach_read_from_4(ptr) & 0x1FFFFFFFUL; 82 | 83 | return(ptr + 4); 84 | } else { 85 | ut_ad(flag == 0xF0UL); 86 | 87 | if (end_ptr < ptr + 5) { 88 | return(NULL); 89 | } 90 | 91 | *val = mach_read_from_4(ptr + 1); 92 | return(ptr + 5); 93 | } 94 | } 95 | 96 | /*********************************************************//** 97 | Reads a dulint in a compressed form if the log record fully contains it. 98 | @return pointer to end of the stored field, NULL if not complete */ 99 | UNIV_INTERN 100 | byte* 101 | mach_dulint_parse_compressed( 102 | /*=========================*/ 103 | byte* ptr, /*!< in: pointer to buffer from where to read */ 104 | byte* end_ptr,/*!< in: pointer to end of the buffer */ 105 | dulint* val) /*!< out: read value */ 106 | { 107 | ulint high; 108 | ulint low; 109 | ulint size; 110 | 111 | ut_ad(ptr && end_ptr && val); 112 | 113 | if (end_ptr < ptr + 5) { 114 | 115 | return(NULL); 116 | } 117 | 118 | high = mach_read_compressed(ptr); 119 | 120 | size = mach_get_compressed_size(high); 121 | 122 | ptr += size; 123 | 124 | if (end_ptr < ptr + 4) { 125 | 126 | return(NULL); 127 | } 128 | 129 | low = mach_read_from_4(ptr); 130 | 131 | *val = ut_dulint_create(high, low); 132 | 133 | return(ptr + 4); 134 | } 135 | -------------------------------------------------------------------------------- /make-header: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use constant { 4 | API_END => qr/\/\*\s*API_END_INCLUDE\s*\*\//i, 5 | API_BEGIN => qr/\/\*\s*API_BEGIN_INCLUDE\s*\*\//i 6 | }; 7 | 8 | if ($#ARGV < 0) { 9 | print STDERR "No input files given\n"; 10 | exit(1); 11 | } 12 | 13 | print <) { 53 | if ($line =~ API_BEGIN) { 54 | $copy = 1; 55 | } elsif ($line =~ API_END) { 56 | $copy = 0; 57 | } elsif ($copy == 1) { 58 | print $line; 59 | } 60 | } 61 | close(F); 62 | } 63 | print < "$OUTFILE" 31 | 32 | rm "$TMPFILE" 33 | -------------------------------------------------------------------------------- /pars/make_flex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | # 5 | # This program is free software; you can redistribute it and/or modify it under 6 | # the terms of the GNU General Public License as published by the Free Software 7 | # Foundation; version 2 of the License. 8 | # 9 | # This program is distributed in the hope that it will be useful, but WITHOUT 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License along with 14 | # this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | # Place, Suite 330, Boston, MA 02111-1307 USA 16 | # 17 | # generate lexer files from flex input files. 18 | 19 | set -eu 20 | 21 | TMPFILE=_flex_tmp.c 22 | OUTFILE=lexyy.c 23 | 24 | flex -o $TMPFILE pars0lex.l 25 | 26 | # AIX needs its includes done in a certain order, so include "univ.i" first 27 | # to be sure we get it right. 28 | echo '#include "univ.i"' > $OUTFILE 29 | 30 | # flex assigns a pointer to an int in one place without a cast, resulting in 31 | # a warning on Win64. Add the cast. Also define some symbols as static. 32 | sed -e ' 33 | s/'"$TMPFILE"'/'"$OUTFILE"'/; 34 | s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/; 35 | s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/; 36 | s/\(void yy_switch_to_buffer\)/__attribute__((unused)) static \1/; 37 | s/\(void yy\(push\|pop\)_buffer_state\)/__attribute__((unused)) static \1/; 38 | s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/; 39 | s/\(\(int\|void\) yy[gs]et_\)/__attribute__((unused)) static \1/; 40 | s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; 41 | s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; 42 | s/\(int yylex_destroy\)/__attribute__((unused)) static \1/; 43 | s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/; 44 | s/^\(\(FILE\|char\) *\* *yyget\)/__attribute__((unused)) static \1/; 45 | s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; 46 | ' < $TMPFILE >> $OUTFILE 47 | 48 | rm $TMPFILE 49 | -------------------------------------------------------------------------------- /srv/srv0que.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file srv/srv0que.c 21 | Server query execution 22 | 23 | Created 6/5/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/CMakeLists.examples: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Oracle/Innobase Oy 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; version 2 of the License. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | 16 | # This is the CMakeLists for Embedded InnoDB 17 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) 18 | 19 | PROJECT (TESTS) 20 | 21 | IF(DEFINED WIN32) 22 | ADD_DEFINITIONS("-D__WIN__ -D_WINDOWS -D_CRT_SECURE_NO_DEPRECATE") 23 | ENDIF(DEFINED WIN32) 24 | 25 | IF(DEFINED UNIX) 26 | SET(LIBS innodb pthread z m) 27 | ELSE(DEFINED UNIX) 28 | SET(LIBS innodb) 29 | ENDIF(DEFINED UNIX) 30 | 31 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/../include) 32 | 33 | ADD_EXECUTABLE(ib_cfg ib_cfg.c test0aux.c) 34 | ADD_EXECUTABLE(ib_compressed ib_compressed.c test0aux.c) 35 | ADD_EXECUTABLE(ib_cursor ib_cursor.c test0aux.c) 36 | ADD_EXECUTABLE(ib_index ib_index.c test0aux.c) 37 | ADD_EXECUTABLE(ib_logger ib_logger.c test0aux.c) 38 | ADD_EXECUTABLE(ib_search ib_search.c test0aux.c) 39 | ADD_EXECUTABLE(ib_status ib_status.c test0aux.c) 40 | ADD_EXECUTABLE(ib_test1 ib_test1.c test0aux.c) 41 | ADD_EXECUTABLE(ib_test2 ib_test2.c test0aux.c) 42 | ADD_EXECUTABLE(ib_test3 ib_test3.c test0aux.c) 43 | ADD_EXECUTABLE(ib_test5 ib_test5.c test0aux.c) 44 | ADD_EXECUTABLE(ib_types ib_types.c test0aux.c) 45 | ADD_EXECUTABLE(ib_update ib_update.c test0aux.c) 46 | 47 | IF(DEFINED UNIX) 48 | ADD_EXECUTABLE(ib_mt_drv ib_mt_drv.c ib_mt_base.c ib_mt_t1.c ib_mt_t2.c test0aux.c) 49 | ADD_EXECUTABLE(ib_mt_stress ib_mt_stress.c test0aux.c) 50 | ADD_EXECUTABLE(ib_perf1 ib_perf1.c test0aux.c) 51 | ENDIF(DEFINED UNIX) 52 | 53 | LINK_DIRECTORIES(${EMBEDDED_INNODB}) 54 | 55 | TARGET_LINK_LIBRARIES(ib_cfg ${LIBS}) 56 | TARGET_LINK_LIBRARIES(ib_compressed ${LIBS}) 57 | TARGET_LINK_LIBRARIES(ib_cursor ${LIBS}) 58 | TARGET_LINK_LIBRARIES(ib_index ${LIBS}) 59 | TARGET_LINK_LIBRARIES(ib_logger ${LIBS}) 60 | TARGET_LINK_LIBRARIES(ib_search ${LIBS}) 61 | TARGET_LINK_LIBRARIES(ib_status ${LIBS}) 62 | TARGET_LINK_LIBRARIES(ib_test1 ${LIBS}) 63 | TARGET_LINK_LIBRARIES(ib_test2 ${LIBS}) 64 | TARGET_LINK_LIBRARIES(ib_test3 ${LIBS}) 65 | TARGET_LINK_LIBRARIES(ib_test5 ${LIBS}) 66 | TARGET_LINK_LIBRARIES(ib_types ${LIBS}) 67 | TARGET_LINK_LIBRARIES(ib_update ${LIBS}) 68 | 69 | IF(DEFINED UNIX) 70 | TARGET_LINK_LIBRARIES(ib_perf1 ${LIBS}) 71 | ENDIF(DEFINED UNIX) 72 | 73 | IF(DEFINED WIN32) 74 | # for some reason, LINK_DIRECTORIES() does not work correctly 75 | SET_TARGET_PROPERTIES(ib_cfg PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 76 | SET_TARGET_PROPERTIES(ib_compressed PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 77 | SET_TARGET_PROPERTIES(ib_cursor PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 78 | SET_TARGET_PROPERTIES(ib_index PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 79 | SET_TARGET_PROPERTIES(ib_logger PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 80 | SET_TARGET_PROPERTIES(ib_search PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 81 | SET_TARGET_PROPERTIES(ib_status PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 82 | SET_TARGET_PROPERTIES(ib_test1 PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 83 | SET_TARGET_PROPERTIES(ib_test2 PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 84 | SET_TARGET_PROPERTIES(ib_test3 PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 85 | SET_TARGET_PROPERTIES(ib_test5 PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 86 | SET_TARGET_PROPERTIES(ib_types PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 87 | SET_TARGET_PROPERTIES(ib_update PROPERTIES LINK_FLAGS "/LIBPATH:..\\lib") 88 | ELSEIF(DEFINED UNIX) 89 | TARGET_LINK_LIBRARIES(ib_mt_drv ${LIBS}) 90 | TARGET_LINK_LIBRARIES(ib_mt_stress ${LIBS}) 91 | TARGET_LINK_LIBRARIES(ib_perf1 ${LIBS}) 92 | ENDIF(DEFINED WIN32) 93 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 Oracle/Innobase Oy 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; version 2 of the License. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | 16 | # Process this file with automake to create Makefile.in 17 | # 18 | noinst_PROGRAMS = ib_cfg \ 19 | ib_compressed \ 20 | ib_cursor \ 21 | ib_drop \ 22 | ib_ddl \ 23 | ib_dict \ 24 | ib_index \ 25 | ib_logger \ 26 | ib_mt_drv \ 27 | ib_mt_stress \ 28 | ib_recover \ 29 | ib_search \ 30 | ib_shutdown \ 31 | ib_status \ 32 | ib_tablename \ 33 | ib_test1 \ 34 | ib_test2 \ 35 | ib_test3 \ 36 | ib_test5 \ 37 | ib_types \ 38 | ib_update \ 39 | ib_zip 40 | if HAVE_PTHREAD_BARRIER 41 | noinst_PROGRAMS += ib_deadlock \ 42 | ib_perf1 43 | endif 44 | 45 | embeddeddir = $(datadir)/$(INSTDIR)/examples 46 | embedded_DATA = \ 47 | Makefile.examples \ 48 | README \ 49 | ib_cfg.c \ 50 | ib_compressed.c \ 51 | ib_cursor.c \ 52 | ib_index.c \ 53 | ib_logger.c \ 54 | ib_mt_stress.c \ 55 | ib_search.c \ 56 | ib_status.c \ 57 | ib_test1.c \ 58 | ib_test2.c \ 59 | ib_test3.c \ 60 | ib_test5.c \ 61 | ib_types.c \ 62 | test0aux.c \ 63 | test0aux.h \ 64 | ib_update.c 65 | if HAVE_PTHREAD_BARRIER 66 | embedded_DATA += ib_perf1.c 67 | endif 68 | 69 | noinst_HEADERS = ib_mt_base.h \ 70 | ib_mt_drv.h \ 71 | test0aux.h 72 | 73 | # We want these in the dist tarball 74 | EXTRA_DIST = \ 75 | CMakeLists.txt \ 76 | CMakeLists.examples \ 77 | Makefile.examples \ 78 | README 79 | 80 | ib_cfg_SOURCES = test0aux.c ib_cfg.c 81 | ib_compressed_SOURCES = test0aux.c ib_compressed.c 82 | ib_ddl_SOURCES = test0aux.c ib_ddl.c 83 | if HAVE_PTHREAD_BARRIER 84 | ib_deadlock_SOURCES = test0aux.c ib_deadlock.c 85 | endif 86 | ib_drop_SOURCES = test0aux.c ib_drop.c 87 | ib_dict_SOURCES = test0aux.c ib_dict.c 88 | ib_index_SOURCES = test0aux.c ib_index.c 89 | ib_test1_SOURCES = test0aux.c ib_test1.c 90 | ib_tablename_SOURCES = test0aux.c ib_tablename.c 91 | ib_test2_SOURCES = test0aux.c ib_test2.c 92 | ib_test3_SOURCES = test0aux.c ib_test3.c 93 | ib_test5_SOURCES = test0aux.c ib_test5.c 94 | ib_mt_stress_SOURCES = test0aux.c ib_mt_stress.c 95 | ib_mt_drv_SOURCES = test0aux.c ib_mt_drv.c ib_mt_base.c \ 96 | ib_mt_t1.c ib_mt_t2.c 97 | if HAVE_PTHREAD_BARRIER 98 | ib_perf1_SOURCES = test0aux.c ib_perf1.c 99 | endif 100 | ib_recover_SOURCES = test0aux.c ib_recover.c 101 | ib_search_SOURCES = test0aux.c ib_search.c 102 | ib_shutdown_SOURCES = test0aux.c ib_shutdown.c 103 | ib_status_SOURCES = test0aux.c ib_status.c 104 | ib_types_SOURCES = test0aux.c ib_types.c 105 | ib_cursor_SOURCES = test0aux.c ib_cursor.c 106 | ib_logger_SOURCES = test0aux.c ib_logger.c 107 | ib_update_SOURCES = test0aux.c ib_update.c 108 | ib_zip_SOURCES = test0aux.c ib_zip.c 109 | 110 | INCLUDES = -I@top_srcdir@/include -I@top_srcdir@/tests 111 | 112 | LDADD = @top_srcdir@/libinnodb.la -lpthread -lm 113 | -------------------------------------------------------------------------------- /tests/Makefile.examples: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Oracle/Innobase Oy 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; version 2 of the License. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | 16 | CC=gcc 17 | TOP=../../.. 18 | AUX=test0aux.o 19 | CFLAGS=-g -Wall 20 | INC=-I$(TOP)/include/embedded_innodb-1.0 -I. 21 | LIB=-L$(TOP)/lib -linnodb -lpthread -lz -lm 22 | 23 | all: ib_cfg ib_compressed ib_cursor ib_mt_stress ib_perf1 \ 24 | ib_status ib_test1 ib_test2 ib_test3 ib_test5 ib_types \ 25 | ib_update 26 | 27 | ib_cfg: ib_cfg.o $(AUX) 28 | $(CC) -o ib_cfg ib_cfg.o $(AUX) $(LIB) 29 | 30 | ib_compressed: ib_compressed.o $(AUX) 31 | $(CC) -o ib_compressed ib_compressed.o $(AUX) $(LIB) 32 | 33 | ib_cursor: ib_cursor.o $(AUX) 34 | $(CC) -o ib_cursor ib_cursor.o $(AUX) $(LIB) 35 | 36 | ib_index: ib_index.o $(AUX) 37 | $(CC) -o ib_index ib_index.o $(AUX) $(LIB) 38 | 39 | ib_logger: ib_logger.o $(AUX) 40 | $(CC) -o ib_logger ib_logger.o $(AUX) $(LIB) 41 | 42 | ib_mt_stress: ib_mt_stress.o $(AUX) 43 | $(CC) -o ib_mt_stress ib_mt_stress.o $(AUX) $(LIB) 44 | 45 | ib_perf1: ib_perf1.o $(AUX) 46 | $(CC) -o ib_perf1 ib_perf1.o $(AUX) $(LIB) 47 | 48 | ib_status: ib_status.o $(AUX) 49 | $(CC) -o ib_status ib_status.o $(AUX) $(LIB) 50 | 51 | ib_test1: ib_test1.o $(AUX) 52 | $(CC) -o ib_test1 ib_test1.o $(AUX) $(LIB) 53 | 54 | ib_test2: ib_test2.o $(AUX) 55 | $(CC) -o ib_test2 ib_test2.o $(AUX) $(LIB) 56 | 57 | ib_test3: ib_test3.o $(AUX) 58 | $(CC) -o ib_test3 ib_test3.o $(AUX) $(LIB) 59 | 60 | ib_test5: ib_test5.o $(AUX) 61 | $(CC) -o ib_test5 ib_test5.o $(AUX) $(LIB) 62 | 63 | ib_types: ib_types.o $(AUX) 64 | $(CC) -o ib_types ib_types.o $(AUX) $(LIB) 65 | 66 | ib_update: ib_update.o $(AUX) 67 | $(CC) -o ib_update ib_update.o $(AUX) $(LIB) 68 | 69 | .c.o: 70 | $(CC) -c $(CFLAGS) $(INC) $< 71 | -------------------------------------------------------------------------------- /tests/README: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2009 Oracle/Innobase Oy 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; version 2 of the License. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 | 16 | Requirements 17 | ============================================================================== 18 | ZLib 1.2.3 http://www.zlib.net 19 | PThreads library unix only 20 | CMake 2.6 or above Windows only 21 | 22 | 23 | Build 24 | ============================================================================== 25 | You may have to tweak the include and library paths in the Makefile.examples 26 | file for your installation. By default it looks in "../..". 27 | 28 | * Unix 29 | It should just be a matter of running: 30 | 31 | make -f Makefile.examples 32 | 33 | * Windows 34 | 1. cmake -G 35 | The generator could be one of the followings: 36 | Visual Studio 7 = Generates Visual Studio .NET 2002 project files. 37 | Visual Studio 7 .NET 2003 = Generates Visual Studio .NET 2003 project files 38 | Visual Studio 8 2005 = Generates Visual Studio .NET 2005 project files 39 | Visual Studio 8 2005 Win64 = Generates Visual Studio .NET 2005 Win64 project files. 40 | Visual Studio 9 2008 = Generates Visual Studio 9 2008 project files. 41 | Visual Studio 9 2008 Win64 = Generates Visual Studio 9 2008 Win64 project files 42 | 43 | 2. start Visual Studio, and open solution file TESTS.sln 44 | 45 | 3. build ALL_BUILD 46 | 47 | 48 | Running 49 | ============================================================================== 50 | Once the examples are built, in order to run them it should just be a matter 51 | of invoking the binary. However, potential issues that you should be aware off 52 | are: 53 | 54 | * Missing libraries 55 | On Unix systems: You may need to set the LD_LIBRARY_PATH e.g., 56 | LD_LIBRARY_PATH=../../lib ./ib_test1 57 | 58 | On Windows: You may need to set the PATH e.g., 59 | set PATH=%PATH%;../../lib 60 | 61 | Important 62 | ============================================================================== 63 | Remember to delete all data and log files before running the examples. Some 64 | of the programs will fail on an assertion if the table already exists. 65 | 66 | 67 | -------------------------------------------------------------------------------- /tests/ib_compressed.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2009 Innobase Oy. All rights reserved. 3 | Copyright (c) 2009 Oracle. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | ************************************************************************/ 19 | 20 | /* Simple test that creates a few compressed tables and checks 21 | for valid page_size */ 22 | 23 | #include 24 | #include 25 | 26 | #include "innodb.h" 27 | 28 | #include "test0aux.h" 29 | 30 | /* use a common database name "test" so it can be cleaned up by 31 | "make test-clean" if we exit abnormally */ 32 | #ifdef DBNAME 33 | #undef DBNAME 34 | #endif /* DBNAME */ 35 | #define DBNAME "test" 36 | 37 | /* use a name that is not going to collide with names from other tests */ 38 | #define TABLENAME DBNAME "/t_compressed" 39 | 40 | int 41 | main(int argc, char* argv[]) 42 | { 43 | ib_tbl_sch_t ib_tbl_sch = NULL; 44 | ib_id_t table_id; 45 | int valid_page_sizes[] = {0, 1, 2, 4, 8, 16}; 46 | int invalid_page_sizes[] = {3, 5, 6, 14, 17, 32, 128, 301}; 47 | int i; 48 | 49 | OK(ib_init()); 50 | 51 | test_configure(); 52 | 53 | OK(ib_startup("barracuda")); 54 | 55 | OK(ib_cfg_set("file_per_table", IB_TRUE)); 56 | 57 | OK(ib_database_create(DBNAME)); 58 | 59 | for (i = 0; 60 | i < sizeof(valid_page_sizes) / sizeof(valid_page_sizes[0]); 61 | i++) { 62 | 63 | ib_trx_t ib_trx; 64 | 65 | OK(ib_table_schema_create(TABLENAME, &ib_tbl_sch, 66 | IB_TBL_COMPRESSED, 67 | valid_page_sizes[i])); 68 | 69 | OK(ib_table_schema_add_col(ib_tbl_sch, "c1", IB_INT, 70 | IB_COL_UNSIGNED, 0 /* ignored */, 71 | sizeof(int))); 72 | 73 | ib_trx = ib_trx_begin(IB_TRX_REPEATABLE_READ); 74 | 75 | OK(ib_schema_lock_exclusive(ib_trx)); 76 | 77 | OK(ib_table_create(ib_trx, ib_tbl_sch, &table_id)); 78 | 79 | OK(ib_trx_commit(ib_trx)); 80 | 81 | ib_table_schema_delete(ib_tbl_sch); 82 | 83 | ib_trx = ib_trx_begin(IB_TRX_REPEATABLE_READ); 84 | 85 | OK(ib_schema_lock_exclusive(ib_trx)); 86 | 87 | OK(ib_table_drop(ib_trx, TABLENAME)); 88 | 89 | OK(ib_trx_commit(ib_trx)); 90 | } 91 | 92 | for (i = 0; 93 | i < sizeof(invalid_page_sizes) / sizeof(invalid_page_sizes[0]); 94 | i++) { 95 | 96 | ib_err_t ib_err; 97 | 98 | ib_err = ib_table_schema_create(TABLENAME, &ib_tbl_sch, 99 | IB_TBL_COMPRESSED, 100 | invalid_page_sizes[i]); 101 | 102 | if (ib_err == DB_SUCCESS) { 103 | fprintf(stderr, "Creating a compressed table with " 104 | "page size %d succeeded but should have " 105 | "failed", invalid_page_sizes[i]); 106 | exit(EXIT_FAILURE); 107 | } 108 | 109 | } 110 | 111 | /* ignore errors as there may be tables left over from other tests */ 112 | OK(ib_database_drop(DBNAME)); 113 | 114 | OK(ib_shutdown(IB_SHUTDOWN_NORMAL)); 115 | 116 | return(EXIT_SUCCESS); 117 | } 118 | -------------------------------------------------------------------------------- /tests/ib_logger.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2008 Innobase Oy. All rights reserved. 3 | Copyright (c) 2009 Oracle. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | ************************************************************************/ 19 | 20 | /* Create a log function that doesn't print anything. Set it as the 21 | default InnoDB message logger. This function should not print any 22 | messages to stderr. It should simply startup and shutdown InnoDB. */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "test0aux.h" 30 | 31 | #ifdef UNIV_DEBUG_VALGRIND 32 | #include 33 | #endif 34 | 35 | #define DATABASE "test" 36 | #define TABLE "t" 37 | 38 | /********************************************************************* 39 | Just ignore all messages. */ 40 | static 41 | int 42 | null_logger( 43 | /*========*/ 44 | FILE* stream, 45 | const char* fmt, 46 | ...) 47 | { 48 | return(0); 49 | } 50 | 51 | int main(int argc, char* argv[]) 52 | { 53 | ib_err_t err; 54 | 55 | err = ib_init(); 56 | assert(err == DB_SUCCESS); 57 | 58 | test_configure(); 59 | 60 | ib_logger_set(null_logger, NULL); 61 | 62 | err = ib_startup("barracuda"); 63 | assert(err == DB_SUCCESS); 64 | 65 | err = ib_shutdown(IB_SHUTDOWN_NORMAL); 66 | assert(err == DB_SUCCESS); 67 | 68 | return(EXIT_SUCCESS); 69 | } 70 | -------------------------------------------------------------------------------- /tests/ib_mt_base.h: -------------------------------------------------------------------------------- 1 | #ifndef _MT_BASE_H 2 | #define _MT_BASE_H 3 | 4 | /********************************************************************* 5 | Open a table and return a cursor for the table. */ 6 | ib_err_t 7 | open_table( 8 | /*=======*/ 9 | const char* dbname, /*!< in: database name */ 10 | const char* name, /*!< in: table name */ 11 | ib_trx_t ib_trx, /*!< in: transaction */ 12 | ib_crsr_t* crsr); /*!< out: innodb cursor */ 13 | 14 | #endif /* _MT_BASE_H */ 15 | -------------------------------------------------------------------------------- /tests/ib_mt_drv.h: -------------------------------------------------------------------------------- 1 | #ifndef _MT_DRV_H 2 | #define _MT_DRV_H 3 | 4 | #include 5 | 6 | /* Type of DML operations */ 7 | typedef enum dml_op_type { 8 | DML_OP_TYPE_SELECT = 0, 9 | DML_OP_TYPE_INSERT, 10 | DML_OP_TYPE_UPDATE, 11 | DML_OP_TYPE_DELETE, 12 | DML_OP_TYPE_MAX, 13 | } dml_op_type_t; 14 | 15 | /* Type of DDL operations */ 16 | typedef enum ddl_op_type { 17 | DDL_OP_TYPE_CREATE = 0, 18 | DDL_OP_TYPE_DROP, 19 | DDL_OP_TYPE_ALTER, 20 | DDL_OP_TYPE_TRUNCATE, 21 | DDL_OP_TYPE_MAX, 22 | } ddl_op_type_t; 23 | 24 | /* Call back function definition for various DML and DDL operations */ 25 | typedef ib_err_t fn(void*); 26 | 27 | /* to hold statistics of a particular type of operation */ 28 | typedef struct op_err_struct { 29 | int n_ops; /* Total ops performed */ 30 | int n_errs; /* Total errors */ 31 | int errs[DB_SCHEMA_NOT_LOCKED]; 32 | /* This is taken from db_err.h 33 | and it is going to be a very sparse 34 | array but we can live with it for 35 | testing. */ 36 | pthread_mutex_t mutex; /*mutex protecting this struct. */ 37 | } op_err_t; 38 | 39 | /* To hold function pointers and other parameters for a table */ 40 | typedef struct tbl_class { 41 | const char name[32]; 42 | const char db_name[32]; 43 | ib_tbl_fmt_t format; 44 | ib_ulint_t page_size; 45 | fn* dml_fn[DML_OP_TYPE_MAX]; 46 | fn* ddl_fn[DDL_OP_TYPE_MAX]; 47 | } tbl_class_t; 48 | 49 | /* Arguments to be passed to the callback functions */ 50 | typedef struct call_back_args { 51 | ib_trx_t trx; 52 | int isolation_level; 53 | int run_number; 54 | int batch_size; 55 | ib_bool_t print_res; 56 | op_err_t* err_st; 57 | tbl_class_t* tbl; 58 | } cb_args_t; 59 | 60 | /********************************************************************** 61 | Update the error stats */ 62 | void 63 | update_err_stats( 64 | /*=============*/ 65 | op_err_t* e, /*!< in: error stat struct */ 66 | ib_err_t err); /*!< in: error code */ 67 | 68 | #endif /* _MT_DRV_H */ 69 | -------------------------------------------------------------------------------- /tests/ib_shutdown.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2008 Innobase Oy. All rights reserved. 3 | Copyright (c) 2008 Oracle. All rights reserved. 4 | Copyright (c) 2009 Oracle. All rights reserved. 5 | 6 | This program is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; version 2 of the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | 19 | ************************************************************************/ 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef WIN32 25 | #include 26 | #else 27 | #include /* For sleep() */ 28 | #include /* For getopt_long() */ 29 | #endif 30 | 31 | #include "test0aux.h" 32 | 33 | #ifdef UNIV_DEBUG_VALGRIND 34 | #include 35 | #endif 36 | 37 | #ifndef WIN32 38 | static int use_sys_malloc = 0; 39 | 40 | /********************************************************************* 41 | Get the runtime options. */ 42 | static 43 | void 44 | get_options( 45 | /*========*/ 46 | int argc, 47 | char* argv[]) 48 | { 49 | int opt; 50 | int optind; 51 | 52 | struct option longopts[] = { 53 | {"use-sys-malloc", required_argument, NULL, 1}, 54 | {NULL, 0, NULL, 0}}; 55 | 56 | while ((opt = getopt_long(argc, argv, "", longopts, &optind)) != -1) { 57 | switch(opt) { 58 | case 1: 59 | use_sys_malloc = 1; 60 | break; 61 | default: 62 | fprintf(stderr, "usage: %s [--use-sys-malloc ]\n", 63 | argv[0]); 64 | exit(EXIT_FAILURE); 65 | } 66 | } 67 | } 68 | #endif 69 | 70 | int main(int argc, char* argv[]) 71 | { 72 | int i; 73 | 74 | #ifndef WIN32 75 | get_options(argc, argv); 76 | #endif 77 | for (i = 0; i < 10; ++i) { 78 | ib_ulint_t err; 79 | 80 | printf(" *** STARTING INNODB *** \n"); 81 | 82 | err = ib_init(); 83 | assert(err == DB_SUCCESS); 84 | 85 | test_configure(); 86 | 87 | #ifdef WIN32 88 | Sleep(2); 89 | #else 90 | if (use_sys_malloc) { 91 | printf("Using system malloc\n"); 92 | err = ib_cfg_set_bool_on("use_sys_malloc"); 93 | } else { 94 | err = ib_cfg_set_bool_off("use_sys_malloc"); 95 | } 96 | assert(err == DB_SUCCESS); 97 | 98 | sleep(2); 99 | #endif 100 | 101 | err = ib_shutdown(IB_SHUTDOWN_NORMAL); 102 | assert(err == DB_SUCCESS); 103 | 104 | printf(" *** SHUTDOWN OF INNODB COMPLETE *** \n"); 105 | 106 | /* Note: We check for whether variables are reset 107 | to their default values externally. */ 108 | #ifdef UNIV_DEBUG_VALGRIND 109 | VALGRIND_DO_LEAK_CHECK; 110 | #endif 111 | } 112 | 113 | return(EXIT_SUCCESS); 114 | } 115 | -------------------------------------------------------------------------------- /tests/ib_status.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2009 Innobase Oy. All rights reserved. 3 | Copyright (c) 2009 Oracle. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | ************************************************************************/ 19 | #include 20 | #include 21 | 22 | #include "innodb.h" 23 | 24 | #include "test0aux.h" 25 | 26 | void 27 | get_all() 28 | { 29 | static const char* var_names[] = { 30 | /* IO system related */ 31 | "read_req_pending", 32 | "write_req_pending", 33 | "fsync_req_pending", 34 | "write_req_done", 35 | "read_req_done", 36 | "fsync_req_done", 37 | "bytes_total_written", 38 | "bytes_total_read", 39 | 40 | /* Buffer pool related */ 41 | "buffer_pool_current_size", 42 | "buffer_pool_data_pages", 43 | "buffer_pool_dirty_pages", 44 | "buffer_pool_misc_pages", 45 | "buffer_pool_free_pages", 46 | "buffer_pool_read_reqs", 47 | "buffer_pool_reads", 48 | "buffer_pool_waited_for_free", 49 | "buffer_pool_pages_flushed", 50 | "buffer_pool_write_reqs", 51 | "buffer_pool_total_pages", 52 | "buffer_pool_pages_read", 53 | "buffer_pool_pages_written", 54 | 55 | /* Double write buffer related */ 56 | "double_write_pages_written", 57 | "double_write_invoked", 58 | 59 | /* Log related */ 60 | "log_buffer_slot_waits", 61 | "log_write_reqs", 62 | "log_write_flush_count", 63 | "log_bytes_written", 64 | "log_fsync_req_done", 65 | "log_write_req_pending", 66 | "log_fsync_req_pending", 67 | 68 | /* Lock related */ 69 | "lock_row_waits", 70 | "lock_row_waiting", 71 | "lock_total_wait_time_in_secs", 72 | "lock_wait_time_avg_in_secs", 73 | "lock_max_wait_time_in_secs", 74 | 75 | /* Row operations */ 76 | "row_total_read", 77 | "row_total_inserted", 78 | "row_total_updated", 79 | "row_total_deleted", 80 | 81 | /* Miscellaneous */ 82 | "page_size", 83 | "have_atomic_builtins", 84 | NULL 85 | }; 86 | 87 | const char** ptr; 88 | ib_i64_t val; 89 | 90 | for (ptr = var_names; *ptr ; ++ptr) { 91 | ib_err_t err; 92 | 93 | err = ib_status_get_i64(*ptr, &val); 94 | assert(err == DB_SUCCESS); 95 | 96 | printf("%s: %d\n", *ptr, (int) val); 97 | } 98 | } 99 | 100 | int 101 | main(int argc, char** argv) 102 | { 103 | ib_err_t err; 104 | 105 | err = ib_init(); 106 | assert(err == DB_SUCCESS); 107 | 108 | test_configure(); 109 | 110 | err = ib_startup("barracuda"); 111 | assert(err == DB_SUCCESS); 112 | 113 | get_all(); 114 | 115 | err = ib_shutdown(IB_SHUTDOWN_NORMAL); 116 | assert(err == DB_SUCCESS); 117 | 118 | return(0); 119 | } 120 | -------------------------------------------------------------------------------- /tests/ib_tablename.c: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | Copyright (c) 2009 Innobase Oy. All rights reserved. 3 | Copyright (c) 2009 Oracle. All rights reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | ************************************************************************/ 19 | 20 | /* Test to check whether invalid table names are rejected. */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "test0aux.h" 28 | 29 | /********************************************************************* 30 | All attempts to create the table should fail */ 31 | static 32 | void 33 | create_table(void) 34 | /*=============*/ 35 | { 36 | ib_err_t err = DB_SUCCESS; 37 | ib_tbl_sch_t ib_tbl_sch = NULL; 38 | 39 | err = ib_table_schema_create("", &ib_tbl_sch, IB_TBL_COMPACT, 0); 40 | assert(err == DB_DATA_MISMATCH); 41 | 42 | err = ib_table_schema_create("a", &ib_tbl_sch, IB_TBL_COMPACT, 0); 43 | assert(err == DB_DATA_MISMATCH); 44 | 45 | err = ib_table_schema_create("ab", &ib_tbl_sch, IB_TBL_COMPACT, 0); 46 | assert(err == DB_DATA_MISMATCH); 47 | 48 | err = ib_table_schema_create(".", &ib_tbl_sch, IB_TBL_COMPACT, 0); 49 | assert(err == DB_DATA_MISMATCH); 50 | 51 | err = ib_table_schema_create("./", &ib_tbl_sch, IB_TBL_COMPACT, 0); 52 | assert(err == DB_DATA_MISMATCH); 53 | 54 | err = ib_table_schema_create("../", &ib_tbl_sch, IB_TBL_COMPACT, 0); 55 | assert(err == DB_DATA_MISMATCH); 56 | 57 | err = ib_table_schema_create("/", &ib_tbl_sch, IB_TBL_COMPACT, 0); 58 | assert(err == DB_DATA_MISMATCH); 59 | 60 | err = ib_table_schema_create("/aaaaa", &ib_tbl_sch, IB_TBL_COMPACT, 0); 61 | assert(err == DB_DATA_MISMATCH); 62 | 63 | err = ib_table_schema_create("/a/a", &ib_tbl_sch, IB_TBL_COMPACT, 0); 64 | assert(err == DB_DATA_MISMATCH); 65 | 66 | err = ib_table_schema_create("abcdef/", &ib_tbl_sch, IB_TBL_COMPACT, 0); 67 | assert(err == DB_DATA_MISMATCH); 68 | 69 | err = ib_table_schema_create("a/b", &ib_tbl_sch, IB_TBL_COMPACT, 0); 70 | assert(err == DB_SUCCESS); 71 | 72 | ib_table_schema_delete(ib_tbl_sch); 73 | } 74 | 75 | int main(int argc, char* argv[]) 76 | { 77 | ib_err_t err; 78 | 79 | err = ib_init(); 80 | assert(err == DB_SUCCESS); 81 | 82 | test_configure(); 83 | 84 | err = ib_startup("barracuda"); 85 | assert(err == DB_SUCCESS); 86 | 87 | create_table(); 88 | 89 | err = ib_shutdown(IB_SHUTDOWN_NORMAL); 90 | assert(err == DB_SUCCESS); 91 | 92 | return(EXIT_SUCCESS); 93 | } 94 | -------------------------------------------------------------------------------- /usr/usr0sess.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /**************************************************//** 20 | @file usr/usr0sess.c 21 | Sessions 22 | 23 | Created 6/25/1996 Heikki Tuuri 24 | *******************************************************/ 25 | 26 | #include "usr0sess.h" 27 | 28 | #ifdef UNIV_NONINL 29 | #include "usr0sess.ic" 30 | #endif 31 | 32 | #include "trx0trx.h" 33 | 34 | /*********************************************************************//** 35 | Opens a session. 36 | @return own: session object */ 37 | UNIV_INTERN 38 | sess_t* 39 | sess_open(void) 40 | /*===========*/ 41 | { 42 | sess_t* sess; 43 | 44 | ut_ad(mutex_own(&kernel_mutex)); 45 | 46 | sess = mem_alloc(sizeof(sess_t)); 47 | 48 | sess->state = SESS_ACTIVE; 49 | 50 | sess->trx = trx_create(sess); 51 | 52 | UT_LIST_INIT(sess->graphs); 53 | 54 | return(sess); 55 | } 56 | 57 | /*********************************************************************//** 58 | Closes a session, freeing the memory occupied by it. */ 59 | UNIV_INTERN 60 | void 61 | sess_close( 62 | /*=======*/ 63 | sess_t* sess) /*!< in, own: session object */ 64 | { 65 | ut_ad(!mutex_own(&kernel_mutex)); 66 | 67 | ut_a(UT_LIST_GET_LEN(sess->graphs) == 0); 68 | 69 | trx_free_for_background(sess->trx); 70 | mem_free(sess); 71 | } 72 | -------------------------------------------------------------------------------- /ut/ut0byte.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /***************************************************************//** 20 | @file ut/ut0byte.c 21 | Byte utilities 22 | 23 | Created 5/11/1994 Heikki Tuuri 24 | ********************************************************************/ 25 | 26 | #include "ut0byte.h" 27 | 28 | #ifdef UNIV_NONINL 29 | #include "ut0byte.ic" 30 | #endif 31 | 32 | /** Zero value for a dulint */ 33 | UNIV_INTERN const dulint ut_dulint_zero = {0, 0}; 34 | 35 | /** Maximum value for a dulint */ 36 | UNIV_INTERN const dulint ut_dulint_max = {0xFFFFFFFFUL, 0xFFFFFFFFUL}; 37 | 38 | #ifdef notdefined /* unused code */ 39 | #include "ut0sort.h" 40 | 41 | /************************************************************//** 42 | Sort function for dulint arrays. */ 43 | UNIV_INTERN 44 | void 45 | ut_dulint_sort( 46 | /*===========*/ 47 | dulint* arr, /*!< in/out: array to be sorted */ 48 | dulint* aux_arr,/*!< in/out: auxiliary array (same size as arr) */ 49 | ulint low, /*!< in: low bound of sort interval, inclusive */ 50 | ulint high) /*!< in: high bound of sort interval, noninclusive */ 51 | { 52 | UT_SORT_FUNCTION_BODY(ut_dulint_sort, arr, aux_arr, low, high, 53 | ut_dulint_cmp); 54 | } 55 | #endif /* notdefined */ 56 | -------------------------------------------------------------------------------- /ut/ut0rnd.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /***************************************************************//** 20 | @file ut/ut0rnd.c 21 | Random numbers and hashing 22 | 23 | Created 5/11/1994 Heikki Tuuri 24 | ********************************************************************/ 25 | 26 | #include "ut0rnd.h" 27 | 28 | #ifdef UNIV_NONINL 29 | #include "ut0rnd.ic" 30 | #endif 31 | 32 | /** These random numbers are used in ut_find_prime */ 33 | /*@{*/ 34 | #define UT_RANDOM_1 1.0412321 35 | #define UT_RANDOM_2 1.1131347 36 | #define UT_RANDOM_3 1.0132677 37 | /*@}*/ 38 | 39 | /** Seed value of ut_rnd_gen_ulint(). */ 40 | UNIV_INTERN ulint ut_rnd_ulint_counter = 65654363; 41 | 42 | /***********************************************************//** 43 | Looks for a prime number slightly greater than the given argument. 44 | The prime is chosen so that it is not near any power of 2. 45 | @return prime */ 46 | UNIV_INTERN 47 | ulint 48 | ut_find_prime( 49 | /*==========*/ 50 | ulint n) /*!< in: positive number > 100 */ 51 | { 52 | ulint pow2; 53 | ulint i; 54 | 55 | n += 100; 56 | 57 | pow2 = 1; 58 | while (pow2 * 2 < n) { 59 | pow2 = 2 * pow2; 60 | } 61 | 62 | if ((double)n < 1.05 * (double)pow2) { 63 | n = (ulint) ((double)n * UT_RANDOM_1); 64 | } 65 | 66 | pow2 = 2 * pow2; 67 | 68 | if ((double)n > 0.95 * (double)pow2) { 69 | n = (ulint) ((double)n * UT_RANDOM_2); 70 | } 71 | 72 | if (n > pow2 - 20) { 73 | n += 30; 74 | } 75 | 76 | /* Now we have n far enough from powers of 2. To make 77 | n more random (especially, if it was not near 78 | a power of 2), we then multiply it by a random number. */ 79 | 80 | n = (ulint) ((double)n * UT_RANDOM_3); 81 | 82 | for (;; n++) { 83 | i = 2; 84 | while (i * i <= n) { 85 | if (n % i == 0) { 86 | goto next_n; 87 | } 88 | i++; 89 | } 90 | 91 | /* Found a prime */ 92 | break; 93 | next_n: ; 94 | } 95 | 96 | return(n); 97 | } 98 | -------------------------------------------------------------------------------- /ut/ut0vec.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. 4 | 5 | This program is free software; you can redistribute it and/or modify it under 6 | the terms of the GNU General Public License as published by the Free Software 7 | Foundation; version 2 of the License. 8 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License along with 14 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple 15 | Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | *****************************************************************************/ 18 | 19 | /*******************************************************************//** 20 | @file ut/ut0vec.c 21 | A vector of pointers to data items 22 | 23 | Created 4/6/2006 Osku Salerma 24 | ************************************************************************/ 25 | 26 | #include "ut0vec.h" 27 | #ifdef UNIV_NONINL 28 | #include "ut0vec.ic" 29 | #endif 30 | #include 31 | 32 | /****************************************************************//** 33 | Create a new vector with the given initial size. 34 | @return vector */ 35 | UNIV_INTERN 36 | ib_vector_t* 37 | ib_vector_create( 38 | /*=============*/ 39 | mem_heap_t* heap, /*!< in: heap */ 40 | ulint size) /*!< in: initial size */ 41 | { 42 | ib_vector_t* vec; 43 | 44 | ut_a(size > 0); 45 | 46 | vec = mem_heap_alloc(heap, sizeof(*vec)); 47 | 48 | vec->heap = heap; 49 | vec->data = mem_heap_alloc(heap, sizeof(void*) * size); 50 | vec->used = 0; 51 | vec->total = size; 52 | 53 | return(vec); 54 | } 55 | 56 | /****************************************************************//** 57 | Push a new element to the vector, increasing its size if necessary. */ 58 | UNIV_INTERN 59 | void 60 | ib_vector_push( 61 | /*===========*/ 62 | ib_vector_t* vec, /*!< in: vector */ 63 | void* elem) /*!< in: data element */ 64 | { 65 | if (vec->used >= vec->total) { 66 | void** new_data; 67 | ulint new_total = vec->total * 2; 68 | 69 | new_data = mem_heap_alloc(vec->heap, 70 | sizeof(void*) * new_total); 71 | memcpy(new_data, vec->data, sizeof(void*) * vec->total); 72 | 73 | vec->data = new_data; 74 | vec->total = new_total; 75 | } 76 | 77 | vec->data[vec->used] = elem; 78 | vec->used++; 79 | } 80 | -------------------------------------------------------------------------------- /win/innodb.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | ; Embedded InnoDB 3 | 4 | EXPORTS 5 | ; init functions 6 | ib_init 7 | ib_startup 8 | ib_shutdown 9 | ib_api_version 10 | ; transactions 11 | ib_trx_start 12 | ib_trx_begin 13 | ib_trx_state 14 | ib_trx_release 15 | ib_trx_commit 16 | ib_trx_rollback 17 | 18 | ib_database_create 19 | ib_database_drop 20 | 21 | ib_schema_lock_shared 22 | ib_schema_lock_exclusive 23 | ib_schema_lock_is_shared 24 | ib_schema_lock_is_exclusive 25 | ib_schema_unlock 26 | ib_schema_tables_iterate 27 | 28 | ib_cursor_lock 29 | ib_table_lock 30 | ib_cursor_set_lock_mode 31 | 32 | ib_table_schema_add_col 33 | ib_table_schema_add_index 34 | ib_table_schema_create 35 | ib_table_schema_delete 36 | ib_table_schema_visit 37 | 38 | ib_index_schema_create 39 | ib_index_schema_delete 40 | ib_index_schema_add_col 41 | ib_index_schema_set_clustered 42 | ib_index_schema_set_unique 43 | 44 | ib_cursor_open_table 45 | ib_cursor_set_simple_select 46 | ib_cursor_open_table_using_id 47 | ib_cursor_open_index_using_id 48 | ib_cursor_open_index_using_name 49 | ib_cursor_reset 50 | ib_cursor_close 51 | 52 | ib_cursor_insert_row 53 | ib_cursor_update_row 54 | ib_cursor_delete_row 55 | ib_cursor_read_row 56 | ib_cursor_first 57 | ib_cursor_prev 58 | ib_cursor_next 59 | ib_cursor_last 60 | ib_cursor_moveto 61 | ib_cursor_attach_trx 62 | ib_cursor_set_match_mode 63 | ib_cursor_set_cluster_access 64 | ib_cursor_truncate 65 | ib_cursor_is_positioned 66 | ib_cursor_stmt_begin 67 | 68 | ib_col_set_value 69 | ib_col_get_len 70 | ib_col_copy_value 71 | ib_col_get_value 72 | ib_col_get_meta 73 | 74 | ib_tuple_read_i8 75 | ib_tuple_read_u8 76 | ib_tuple_read_i16 77 | ib_tuple_read_u16 78 | ib_tuple_read_i32 79 | ib_tuple_read_u32 80 | ib_tuple_read_i64 81 | ib_tuple_read_u64 82 | ib_tuple_read_double 83 | ib_tuple_read_float 84 | ib_tuple_clear 85 | ib_tuple_get_cluster_key 86 | ib_tuple_get_n_user_cols 87 | ib_tuple_get_n_cols 88 | ib_tuple_copy 89 | ib_tuple_delete 90 | ib_tuple_write_i8 91 | ib_tuple_write_u8 92 | ib_tuple_write_i16 93 | ib_tuple_write_u16 94 | ib_tuple_write_i32 95 | ib_tuple_write_u32 96 | ib_tuple_write_i64 97 | ib_tuple_write_u64 98 | ib_tuple_write_double 99 | ib_tuple_write_float 100 | 101 | ib_table_create 102 | ib_table_rename 103 | ib_table_drop 104 | ib_table_truncate 105 | ib_table_get_id 106 | 107 | ib_index_create 108 | ib_index_drop 109 | ib_index_get_id 110 | 111 | ib_set_client_compare 112 | ib_sec_search_tuple_create 113 | ib_sec_read_tuple_create 114 | 115 | ib_clust_search_tuple_create 116 | ib_clust_read_tuple_create 117 | 118 | ib_cfg_var_get_type 119 | ib_cfg_set 120 | ib_cfg_get 121 | ib_cfg_get_all 122 | 123 | ib_savepoint_take 124 | ib_savepoint_release 125 | ib_savepoint_rollback 126 | 127 | ib_logger_set 128 | ib_strerror 129 | ib_status_get_i64 130 | --------------------------------------------------------------------------------