2001-02-17 14:19:19 +02:00
|
|
|
/******************************************************
|
|
|
|
Loads to the memory cache database object definitions
|
|
|
|
from dictionary tables
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 4/24/1996 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "dict0load.h"
|
|
|
|
|
|
|
|
#ifdef UNIV_NONINL
|
|
|
|
#include "dict0load.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "btr0pcur.h"
|
|
|
|
#include "btr0btr.h"
|
|
|
|
#include "page0page.h"
|
|
|
|
#include "mach0data.h"
|
|
|
|
#include "dict0dict.h"
|
|
|
|
#include "dict0boot.h"
|
2003-10-07 17:28:59 +03:00
|
|
|
#include "srv0start.h"
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/************************************************************************
|
|
|
|
Finds the first table name in the given database. */
|
|
|
|
|
|
|
|
char*
|
|
|
|
dict_get_first_table_name_in_db(
|
|
|
|
/*============================*/
|
2004-05-17 14:40:31 +03:00
|
|
|
/* out, own: table name, NULL if
|
|
|
|
does not exist; the caller must
|
|
|
|
free the memory in the string! */
|
|
|
|
const char* name) /* in: database name which ends to '/' */
|
2001-10-10 22:47:08 +03:00
|
|
|
{
|
|
|
|
dict_table_t* sys_tables;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-10-10 22:47:08 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
heap = mem_heap_create(1000);
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_tables = dict_table_get_low("SYS_TABLES");
|
2001-10-10 22:47:08 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, name, ut_strlen(name));
|
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
loop:
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
|
|
|
|
/* Not found */
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
|
|
|
|
if (len < strlen(name)
|
|
|
|
|| ut_memcmp(name, field, strlen(name)) != 0) {
|
|
|
|
/* Not found */
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!rec_get_deleted_flag(rec)) {
|
|
|
|
|
|
|
|
/* We found one */
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
char* table_name = mem_strdupl(field, len);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(table_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Prints to the standard output information on all tables found in the data
|
|
|
|
dictionary system table. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_print(void)
|
|
|
|
/*============*/
|
|
|
|
{
|
|
|
|
dict_table_t* sys_tables;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
dict_table_t* table;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
|
|
|
mutex_enter(&(dict_sys->mutex));
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_tables = dict_table_get_low("SYS_TABLES");
|
2001-10-10 22:47:08 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
|
|
|
|
|
|
|
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
|
|
|
|
TRUE, &mtr);
|
|
|
|
loop:
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
|
|
|
|
/* end of index */
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
mutex_exit(&(dict_sys->mutex));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
|
|
|
|
if (!rec_get_deleted_flag(rec)) {
|
|
|
|
|
|
|
|
/* We found one */
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
char* table_name = mem_strdupl(field, len);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
btr_pcur_store_position(&pcur, &mtr);
|
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
table = dict_table_get_low(table_name);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
mem_free(table_name);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
if (table == NULL) {
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
fputs("InnoDB: Failed to load table ", stderr);
|
|
|
|
ut_print_namel(stderr, field, len);
|
|
|
|
putc('\n', stderr);
|
2001-10-10 22:47:08 +03:00
|
|
|
} else {
|
2002-06-22 20:41:14 +03:00
|
|
|
/* The table definition was corrupt if there
|
|
|
|
is no index */
|
|
|
|
|
|
|
|
if (dict_table_get_first_index(table)) {
|
|
|
|
dict_update_statistics_low(table, TRUE);
|
|
|
|
}
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
dict_table_print_low(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
/************************************************************************
|
|
|
|
In a crash recovery we already have all the tablespace objects created.
|
|
|
|
This function compares the space id information in the InnoDB data dictionary
|
|
|
|
to what we already read with fil_load_single_table_tablespaces().
|
|
|
|
In a normal startup we just scan the biggest space id, and store it to
|
|
|
|
fil_system. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_check_tablespaces_or_store_max_id(
|
|
|
|
/*===================================*/
|
|
|
|
ibool in_crash_recovery) /* in: are we doing a crash recovery */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_tables;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
ulint space_id;
|
|
|
|
ulint max_space_id = 0;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
|
|
|
mutex_enter(&(dict_sys->mutex));
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_tables = dict_table_get_low("SYS_TABLES");
|
2003-10-07 17:28:59 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
|
|
|
|
|
|
|
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
|
|
|
|
TRUE, &mtr);
|
|
|
|
loop:
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
|
|
|
|
/* end of index */
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
/* We must make the tablespace cache aware of the biggest
|
|
|
|
known space id */
|
|
|
|
|
|
|
|
/* printf("Biggest space id in data dictionary %lu\n",
|
|
|
|
max_space_id); */
|
|
|
|
fil_set_max_space_id_if_bigger(max_space_id);
|
|
|
|
|
|
|
|
mutex_exit(&(dict_sys->mutex));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
|
|
|
|
if (!rec_get_deleted_flag(rec)) {
|
|
|
|
|
|
|
|
/* We found one */
|
|
|
|
|
2004-06-01 15:19:09 +03:00
|
|
|
char* name = mem_strdupl(field, len);
|
2003-10-07 17:28:59 +03:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 9, &len);
|
|
|
|
ut_a(len == 4);
|
|
|
|
|
|
|
|
space_id = mach_read_from_4(field);
|
|
|
|
|
|
|
|
btr_pcur_store_position(&pcur, &mtr);
|
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
if (space_id != 0 && in_crash_recovery) {
|
|
|
|
/* Check that the tablespace (the .ibd file) really
|
|
|
|
exists; print a warning to the .err log if not */
|
|
|
|
|
|
|
|
fil_space_for_table_exists_in_mem(space_id, name,
|
|
|
|
TRUE, TRUE);
|
|
|
|
}
|
2004-06-01 15:19:09 +03:00
|
|
|
|
|
|
|
mem_free(name);
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
if (space_id > max_space_id) {
|
|
|
|
max_space_id = space_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
/************************************************************************
|
2002-06-22 20:41:14 +03:00
|
|
|
Loads definitions for table columns. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
dict_load_columns(
|
|
|
|
/*==============*/
|
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
mem_heap_t* heap) /* in: memory heap for temporary storage */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_table_t* sys_columns;
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_index_t* sys_index;
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_t pcur;
|
2001-02-17 14:19:19 +02:00
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
2002-06-22 20:41:14 +03:00
|
|
|
byte* buf;
|
|
|
|
char* name;
|
|
|
|
ulint mtype;
|
|
|
|
ulint prtype;
|
|
|
|
ulint col_len;
|
|
|
|
ulint prec;
|
|
|
|
ulint i;
|
2001-10-10 22:47:08 +03:00
|
|
|
mtr_t mtr;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_columns = dict_table_get_low("SYS_COLUMNS");
|
2002-06-22 20:41:14 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
buf = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(buf, table->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, buf, 8);
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
2002-06-22 20:41:14 +03:00
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) {
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
ut_a(!rec_get_deleted_flag(rec));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
ut_ad(len == 8);
|
|
|
|
ut_a(ut_dulint_cmp(table->id, mach_read_from_8(field)) == 0);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
|
|
|
ut_ad(len == 4);
|
|
|
|
ut_a(i == mach_read_from_4(field));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("NAME",
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_columns), 4))->name));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 4, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
name = mem_heap_strdupl(heap, field, len);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 5, &len);
|
|
|
|
mtype = mach_read_from_4(field);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 6, &len);
|
2002-06-22 20:41:14 +03:00
|
|
|
prtype = mach_read_from_4(field);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-02-19 20:07:02 +02:00
|
|
|
if (dtype_is_non_binary_string_type(mtype, prtype)
|
|
|
|
&& dtype_get_charset_coll(prtype) == 0) {
|
|
|
|
/* This is a non-binary string type, and the table
|
|
|
|
was created with < 4.1.2. Use the default charset. */
|
|
|
|
|
|
|
|
prtype = dtype_form_prtype(prtype,
|
|
|
|
data_mysql_default_charset_coll);
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
field = rec_get_nth_field(rec, 7, &len);
|
2002-06-22 20:41:14 +03:00
|
|
|
col_len = mach_read_from_4(field);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("PREC",
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_columns), 8))->name));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 8, &len);
|
|
|
|
prec = mach_read_from_4(field);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_mem_table_add_col(table, name, mtype, prtype, col_len,
|
|
|
|
prec);
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
}
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
2001-10-10 22:47:08 +03:00
|
|
|
}
|
|
|
|
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
/************************************************************************
|
|
|
|
Report that an index field or index for a table has been delete marked. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
dict_load_report_deleted_index(
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* name, /* in: table name */
|
|
|
|
ulint field) /* in: index field, or ULINT_UNDEFINED */
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
{
|
|
|
|
fputs("InnoDB: Error: data dictionary entry"
|
|
|
|
" for table ", stderr);
|
|
|
|
ut_print_name(stderr, name);
|
|
|
|
fputs(" is corrupt!\n", stderr);
|
|
|
|
if (field != ULINT_UNDEFINED) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Index field %lu is delete marked.\n", field);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fputs("InnoDB: An index is delete marked.\n", stderr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
/************************************************************************
|
|
|
|
Loads definitions for index fields. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
dict_load_fields(
|
|
|
|
/*=============*/
|
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
dict_index_t* index, /* in: index whose fields to load */
|
|
|
|
mem_heap_t* heap) /* in: memory heap for temporary storage */
|
2001-10-10 22:47:08 +03:00
|
|
|
{
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_table_t* sys_fields;
|
|
|
|
dict_index_t* sys_index;
|
2001-10-10 22:47:08 +03:00
|
|
|
btr_pcur_t pcur;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
2003-06-15 01:04:28 +03:00
|
|
|
ulint pos_and_prefix_len;
|
|
|
|
ulint prefix_len;
|
2001-10-10 22:47:08 +03:00
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
2002-06-22 20:41:14 +03:00
|
|
|
ulint len;
|
|
|
|
byte* buf;
|
|
|
|
ulint i;
|
2001-10-10 22:47:08 +03:00
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-10-10 22:47:08 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
UT_NOT_USED(table);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
mtr_start(&mtr);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_fields = dict_table_get_low("SYS_FIELDS");
|
2002-06-22 20:41:14 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
2001-10-10 22:47:08 +03:00
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
buf = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(buf, index->id);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
dfield_set_data(dfield, buf, 8);
|
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
2001-10-10 22:47:08 +03:00
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
2002-06-22 20:41:14 +03:00
|
|
|
for (i = 0; i < index->n_fields; i++) {
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
|
2002-06-22 20:41:14 +03:00
|
|
|
if (rec_get_deleted_flag(rec)) {
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
dict_load_report_deleted_index(table->name, i);
|
2002-06-22 20:41:14 +03:00
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
ut_ad(len == 8);
|
2002-06-22 20:41:14 +03:00
|
|
|
ut_a(ut_memcmp(buf, field, len) == 0);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
2003-06-15 01:04:28 +03:00
|
|
|
ut_a(len == 4);
|
|
|
|
|
|
|
|
/* The next field stores the field position in the index
|
|
|
|
and a possible column prefix length if the index field
|
|
|
|
does not contain the whole column. The storage format is
|
|
|
|
like this: if there is at least one prefix field in the index,
|
|
|
|
then the HIGH 2 bytes contain the field number (== i) and the
|
|
|
|
low 2 bytes the prefix length for the field. Otherwise the
|
|
|
|
field number (== i) is contained in the 2 LOW bytes. */
|
|
|
|
|
|
|
|
pos_and_prefix_len = mach_read_from_4(field);
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
ut_a((pos_and_prefix_len & 0xFFFFUL) == i
|
|
|
|
|| (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
|
2003-06-15 01:04:28 +03:00
|
|
|
|
|
|
|
if ((i == 0 && pos_and_prefix_len > 0)
|
2003-10-07 17:28:59 +03:00
|
|
|
|| (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
|
2003-06-15 01:04:28 +03:00
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
prefix_len = pos_and_prefix_len & 0xFFFFUL;
|
2003-06-15 01:04:28 +03:00
|
|
|
} else {
|
|
|
|
prefix_len = 0;
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("COL_NAME",
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_table_get_first_index(sys_fields), 4))->name));
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 4, &len);
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
dict_mem_index_add_field(index,
|
|
|
|
mem_heap_strdupl(heap, field, len), 0, prefix_len);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2002-06-22 20:41:14 +03:00
|
|
|
Loads definitions for table indexes. Adds them to the data dictionary
|
|
|
|
cache. */
|
2001-02-17 14:19:19 +02:00
|
|
|
static
|
2002-06-22 20:41:14 +03:00
|
|
|
ibool
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_load_indexes(
|
|
|
|
/*==============*/
|
2002-06-22 20:41:14 +03:00
|
|
|
/* out: TRUE if ok, FALSE if corruption
|
|
|
|
of dictionary table */
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
mem_heap_t* heap) /* in: memory heap for temporary storage */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_indexes;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
dict_index_t* index;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
ulint name_len;
|
|
|
|
char* name_buf;
|
|
|
|
ulint type;
|
|
|
|
ulint space;
|
|
|
|
ulint page_no;
|
|
|
|
ulint n_fields;
|
|
|
|
byte* buf;
|
|
|
|
ibool is_sys_table;
|
|
|
|
dulint id;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
if ((ut_dulint_get_high(table->id) == 0)
|
|
|
|
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
|
|
|
|
is_sys_table = TRUE;
|
|
|
|
} else {
|
|
|
|
is_sys_table = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_indexes = dict_table_get_low("SYS_INDEXES");
|
2001-02-17 14:19:19 +02:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
|
|
|
buf = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(buf, table->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, buf, 8);
|
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
for (;;) {
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
ut_ad(len == 8);
|
|
|
|
|
|
|
|
if (ut_memcmp(buf, field, len) != 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
if (rec_get_deleted_flag(rec)) {
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
dict_load_report_deleted_index(table->name,
|
|
|
|
ULINT_UNDEFINED);
|
2002-06-22 20:41:14 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
|
|
|
ut_ad(len == 8);
|
|
|
|
id = mach_read_from_8(field);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("NAME",
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_indexes), 4))->name));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 4, &name_len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
name_buf = mem_heap_strdupl(heap, field, name_len);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 5, &len);
|
|
|
|
n_fields = mach_read_from_4(field);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 6, &len);
|
|
|
|
type = mach_read_from_4(field);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 7, &len);
|
|
|
|
space = mach_read_from_4(field);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("PAGE_NO",
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_indexes), 8))->name));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 8, &len);
|
|
|
|
page_no = mach_read_from_4(field);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
if (page_no == FIL_NULL) {
|
|
|
|
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
fputs("InnoDB: Error: trying to load index ", stderr);
|
|
|
|
ut_print_name(stderr, name_buf);
|
|
|
|
fputs(" for table ", stderr);
|
|
|
|
ut_print_name(stderr, table->name);
|
|
|
|
fputs("\n"
|
|
|
|
"InnoDB: but the index tree has been freed!\n", stderr);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((type & DICT_CLUSTERED) == 0
|
|
|
|
&& NULL == dict_table_get_first_index(table)) {
|
|
|
|
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
fputs("InnoDB: Error: trying to load index ", stderr);
|
|
|
|
ut_print_namel(stderr, name_buf, name_len);
|
|
|
|
fputs(" for table ", stderr);
|
|
|
|
ut_print_name(stderr, table->name);
|
|
|
|
fputs("\n"
|
|
|
|
"InnoDB: but the first index is not clustered!\n", stderr);
|
2002-06-22 20:41:14 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
if (is_sys_table
|
|
|
|
&& ((type & DICT_CLUSTERED)
|
|
|
|
|| ((table == dict_sys->sys_tables)
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
&& (name_len == (sizeof "ID_IND") - 1)
|
2004-05-27 15:27:43 +03:00
|
|
|
&& (0 == ut_memcmp(name_buf, "ID_IND",
|
2001-02-17 14:19:19 +02:00
|
|
|
name_len))))) {
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
/* The index was created in memory already at booting
|
|
|
|
of the database server */
|
2001-02-17 14:19:19 +02:00
|
|
|
} else {
|
|
|
|
index = dict_mem_index_create(table->name, name_buf,
|
|
|
|
space, type, n_fields);
|
|
|
|
index->page_no = page_no;
|
|
|
|
index->id = id;
|
|
|
|
|
|
|
|
dict_load_fields(table, index, heap);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_index_add_to_cache(table, index);
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
2002-06-22 20:41:14 +03:00
|
|
|
|
|
|
|
return(TRUE);
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2002-06-22 20:41:14 +03:00
|
|
|
Loads a table definition and also all its index definitions, and also
|
|
|
|
the cluster definition if the table is a member in a cluster. Also loads
|
|
|
|
all foreign key constraints where the foreign key is in the table or where
|
|
|
|
a foreign key references columns in this table. Adds all these to the data
|
|
|
|
dictionary cache. */
|
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_load_table(
|
|
|
|
/*============*/
|
2004-05-17 14:40:31 +03:00
|
|
|
/* out: table, NULL if does not exist;
|
|
|
|
if the table is stored in an .ibd file,
|
|
|
|
but the file does not exist,
|
|
|
|
then we set the ibd_file_missing flag TRUE
|
|
|
|
in the table object we return */
|
|
|
|
const char* name) /* in: table name in the
|
|
|
|
databasename/tablename format */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
2003-10-07 17:28:59 +03:00
|
|
|
ibool ibd_file_missing = FALSE;
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_table_t* table;
|
|
|
|
dict_table_t* sys_tables;
|
2001-02-17 14:19:19 +02:00
|
|
|
btr_pcur_t pcur;
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_index_t* sys_index;
|
2001-02-17 14:19:19 +02:00
|
|
|
dtuple_t* tuple;
|
2002-06-22 20:41:14 +03:00
|
|
|
mem_heap_t* heap;
|
2001-02-17 14:19:19 +02:00
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
2002-06-22 20:41:14 +03:00
|
|
|
ulint space;
|
|
|
|
ulint n_cols;
|
2003-04-16 16:45:01 +03:00
|
|
|
ulint err;
|
2001-10-10 22:47:08 +03:00
|
|
|
mtr_t mtr;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
heap = mem_heap_create(1000);
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_tables = dict_table_get_low("SYS_TABLES");
|
2002-06-22 20:41:14 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
dfield_set_data(dfield, name, ut_strlen(name));
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
2002-06-22 20:41:14 +03:00
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|
|
|
|
|| rec_get_deleted_flag(rec)) {
|
|
|
|
/* Not found */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
return(NULL);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
/* Check if the table name in record is the searched one */
|
|
|
|
if (len != ut_strlen(name) || ut_memcmp(name, field, len) != 0) {
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("SPACE",
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_tables), 9))->name));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 9, &len);
|
|
|
|
space = mach_read_from_4(field);
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
/* Check if the tablespace exists and has the right name */
|
|
|
|
if (space != 0) {
|
|
|
|
if (fil_space_for_table_exists_in_mem(space, name, FALSE,
|
|
|
|
FALSE)) {
|
|
|
|
/* Ok; (if we did a crash recovery then the tablespace
|
|
|
|
can already be in the memory cache) */
|
|
|
|
} else {
|
|
|
|
/* Try to open the tablespace */
|
|
|
|
if (!fil_open_single_table_tablespace(space, name)) {
|
|
|
|
/* We failed to find a sensible tablespace
|
|
|
|
file */
|
|
|
|
|
|
|
|
ibd_file_missing = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("N_COLS",
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_tables), 4))->name));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 4, &len);
|
|
|
|
n_cols = mach_read_from_4(field);
|
|
|
|
|
|
|
|
table = dict_mem_table_create(name, space, n_cols);
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
table->ibd_file_missing = ibd_file_missing;
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
ut_a(0 == ut_strcmp("ID",
|
2002-06-22 20:41:14 +03:00
|
|
|
dict_field_get_col(
|
|
|
|
dict_index_get_nth_field(
|
|
|
|
dict_table_get_first_index(sys_tables), 3))->name));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 3, &len);
|
|
|
|
table->id = mach_read_from_8(field);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 5, &len);
|
|
|
|
table->type = mach_read_from_4(field);
|
|
|
|
|
|
|
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
2004-03-13 22:48:00 +02:00
|
|
|
ut_error;
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
#if 0 /* clustered tables have not been implemented yet */
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 6, &len);
|
|
|
|
table->mix_id = mach_read_from_8(field);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 8, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
table->cluster_name = mem_heap_strdupl(heap, field, len);
|
|
|
|
#endif
|
2002-06-22 20:41:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((table->type == DICT_TABLE_CLUSTER)
|
|
|
|
|| (table->type == DICT_TABLE_CLUSTER_MEMBER)) {
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
field = rec_get_nth_field(rec, 7, &len);
|
|
|
|
table->mix_len = mach_read_from_4(field);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
|
|
|
/* Load the cluster table definition if not yet in
|
|
|
|
memory cache */
|
|
|
|
dict_table_get_low(table->cluster_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
dict_load_columns(table, heap);
|
|
|
|
|
|
|
|
dict_table_add_to_cache(table);
|
|
|
|
|
|
|
|
dict_load_indexes(table, heap);
|
|
|
|
|
2003-04-16 16:45:01 +03:00
|
|
|
err = dict_load_foreigns(table->name);
|
|
|
|
/*
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
mutex_enter(&dict_foreign_err_mutex);
|
2002-06-22 20:41:14 +03:00
|
|
|
|
2003-04-16 16:45:01 +03:00
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
" InnoDB: Error: could not make a foreign key definition to match\n"
|
|
|
|
"InnoDB: the foreign key table or the referenced table!\n"
|
|
|
|
"InnoDB: The data dictionary of InnoDB is corrupt. You may need to drop\n"
|
|
|
|
"InnoDB: and recreate the foreign key table or the referenced table.\n"
|
2004-05-11 11:05:02 +03:00
|
|
|
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
|
2003-04-16 16:45:01 +03:00
|
|
|
"InnoDB: Latest foreign key error printout:\n%s\n", dict_foreign_err_buf);
|
|
|
|
|
|
|
|
mutex_exit(&dict_foreign_err_mutex);
|
|
|
|
}
|
|
|
|
*/
|
2002-06-22 20:41:14 +03:00
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
Loads a table object based on the table id. */
|
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_load_table_on_id(
|
|
|
|
/*==================*/
|
|
|
|
/* out: table; NULL if table does not exist */
|
|
|
|
dulint table_id) /* in: table id */
|
|
|
|
{
|
|
|
|
byte id_buf[8];
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
|
|
|
dict_index_t* sys_table_ids;
|
|
|
|
dict_table_t* sys_tables;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
dict_table_t* table;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2002-06-22 20:41:14 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2002-06-22 20:41:14 +03:00
|
|
|
|
|
|
|
/* NOTE that the operation of this function is protected by
|
|
|
|
the dictionary mutex, and therefore no deadlocks can occur
|
|
|
|
with other dictionary operations. */
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
/*---------------------------------------------------*/
|
|
|
|
/* Get the secondary index based on ID for table SYS_TABLES */
|
|
|
|
sys_tables = dict_sys->sys_tables;
|
|
|
|
sys_table_ids = dict_table_get_next_index(
|
|
|
|
dict_table_get_first_index(sys_tables));
|
|
|
|
heap = mem_heap_create(256);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
|
|
|
/* Write the table id in byte format to id_buf */
|
|
|
|
mach_write_to_8(id_buf, table_id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, id_buf, 8);
|
|
|
|
dict_index_copy_types(tuple, sys_table_ids, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE,
|
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|
|
|
|
|| rec_get_deleted_flag(rec)) {
|
|
|
|
/* Not found */
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------*/
|
|
|
|
/* Now we have the record in the secondary index containing the
|
|
|
|
table ID and NAME */
|
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
ut_ad(len == 8);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
/* Check if the table id in record is the one searched for */
|
|
|
|
if (ut_dulint_cmp(table_id, mach_read_from_8(field)) != 0) {
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we get the table name from the record */
|
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
|
|
|
/* Load the table definition to memory */
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
table = dict_load_table(mem_heap_strdupl(heap, field, len));
|
2002-06-22 20:41:14 +03:00
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
2002-06-22 20:41:14 +03:00
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
This function is called when the database is booted. Loads system table
|
|
|
|
index definitions except for the clustered index which is added to the
|
|
|
|
dictionary cache at booting before calling this function. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_load_sys_table(
|
|
|
|
/*================*/
|
|
|
|
dict_table_t* table) /* in: system table */
|
|
|
|
{
|
|
|
|
mem_heap_t* heap;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2002-06-22 20:41:14 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2002-06-22 20:41:14 +03:00
|
|
|
|
|
|
|
heap = mem_heap_create(1000);
|
|
|
|
|
|
|
|
dict_load_indexes(table, heap);
|
|
|
|
|
|
|
|
mem_heap_free(heap);
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/************************************************************************
|
|
|
|
Loads foreign key constraint col names (also for the referenced table). */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
dict_load_foreign_cols(
|
|
|
|
/*===================*/
|
2004-05-27 15:27:43 +03:00
|
|
|
const char* id, /* in: foreign constraint id as a null-
|
2001-10-10 22:47:08 +03:00
|
|
|
terminated string */
|
|
|
|
dict_foreign_t* foreign)/* in: foreign constraint object */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_foreign_cols;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
ulint i;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-10-10 22:47:08 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
|
|
|
|
foreign->n_fields * sizeof(void*));
|
|
|
|
|
|
|
|
foreign->referenced_col_names = mem_heap_alloc(foreign->heap,
|
|
|
|
foreign->n_fields * sizeof(void*));
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
|
2001-10-10 22:47:08 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
|
|
|
|
|
|
|
|
tuple = dtuple_create(foreign->heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, id, ut_strlen(id));
|
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
for (i = 0; i < foreign->n_fields; i++) {
|
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
|
|
|
|
ut_a(!rec_get_deleted_flag(rec));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
ut_a(len == ut_strlen(id));
|
|
|
|
ut_a(ut_memcmp(id, field, len) == 0);
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
|
|
|
ut_a(len == 4);
|
|
|
|
ut_a(i == mach_read_from_4(field));
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 4, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->foreign_col_names[i] =
|
|
|
|
mem_heap_strdupl(foreign->heap, field, len);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 5, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->referenced_col_names[i] =
|
|
|
|
mem_heap_strdupl(foreign->heap, field, len);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
/***************************************************************************
|
2001-10-10 22:47:08 +03:00
|
|
|
Loads a foreign key constraint to the dictionary cache. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_load_foreign(
|
|
|
|
/*==============*/
|
2004-05-27 15:27:43 +03:00
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
const char* id) /* in: foreign constraint id as a
|
|
|
|
null-terminated string */
|
2001-10-10 22:47:08 +03:00
|
|
|
{
|
|
|
|
dict_foreign_t* foreign;
|
|
|
|
dict_table_t* sys_foreign;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
dict_index_t* sys_index;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
mem_heap_t* heap2;
|
|
|
|
dfield_t* dfield;
|
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
|
|
|
ulint err;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-10-10 22:47:08 +03:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
heap2 = mem_heap_create(1000);
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_foreign = dict_table_get_low("SYS_FOREIGN");
|
2001-10-10 22:47:08 +03:00
|
|
|
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap2, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, id, ut_strlen(id));
|
|
|
|
dict_index_copy_types(tuple, sys_index, 1);
|
|
|
|
|
|
|
|
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
|
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
|
|
|
|
|| rec_get_deleted_flag(rec)) {
|
|
|
|
/* Not found */
|
|
|
|
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
fputs("InnoDB: Error A: cannot load foreign constraint ",
|
|
|
|
stderr);
|
|
|
|
ut_print_name(stderr, id);
|
|
|
|
putc('\n', stderr);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap2);
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
|
|
|
|
/* Check if the id in record is the searched one */
|
|
|
|
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
|
|
|
|
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
fputs("InnoDB: Error B: cannot load foreign constraint ",
|
|
|
|
stderr);
|
|
|
|
ut_print_name(stderr, id);
|
|
|
|
putc('\n', stderr);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap2);
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the table names and the number of columns associated
|
|
|
|
with the constraint */
|
|
|
|
|
|
|
|
mem_heap_free(heap2);
|
|
|
|
|
|
|
|
foreign = dict_mem_foreign_create();
|
|
|
|
|
|
|
|
foreign->n_fields = mach_read_from_4(rec_get_nth_field(rec, 5, &len));
|
|
|
|
|
|
|
|
ut_a(len == 4);
|
2002-04-18 10:40:32 +03:00
|
|
|
|
|
|
|
/* We store the type to the bits 24-31 of n_fields */
|
|
|
|
|
|
|
|
foreign->type = foreign->n_fields >> 24;
|
2003-10-07 17:28:59 +03:00
|
|
|
foreign->n_fields = foreign->n_fields & 0xFFFFFFUL;
|
2001-10-10 22:47:08 +03:00
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->id = mem_heap_strdup(foreign->heap, id);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 3, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->foreign_table_name =
|
|
|
|
mem_heap_strdupl(foreign->heap, field, len);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
field = rec_get_nth_field(rec, 4, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->referenced_table_name =
|
|
|
|
mem_heap_strdupl(foreign->heap, field, len);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
dict_load_foreign_cols(id, foreign);
|
|
|
|
|
2003-04-16 16:45:01 +03:00
|
|
|
/* If the foreign table is not yet in the dictionary cache, we
|
|
|
|
have to load it so that we are able to make type comparisons
|
|
|
|
in the next function call. */
|
|
|
|
|
|
|
|
dict_table_get_low(foreign->foreign_table_name);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/* Note that there may already be a foreign constraint object in
|
|
|
|
the dictionary cache for this constraint: then the following
|
|
|
|
call only sets the pointers in it to point to the appropriate table
|
2003-04-16 16:45:01 +03:00
|
|
|
and index objects and frees the newly created object foreign.
|
|
|
|
Adding to the cache should always succeed since we are not creating
|
|
|
|
a new foreign key constraint but loading one from the data
|
|
|
|
dictionary. */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
err = dict_foreign_add_to_cache(foreign);
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
Loads foreign key constraints where the table is either the foreign key
|
|
|
|
holder or where the table is referenced by a foreign key. Adds these
|
|
|
|
constraints to the data dictionary. Note that we know that the dictionary
|
|
|
|
cache already contains all constraints where the other relevant table is
|
|
|
|
already in the dictionary cache. */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
dict_load_foreigns(
|
|
|
|
/*===============*/
|
2004-05-17 14:40:31 +03:00
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
const char* table_name) /* in: table name */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
dtuple_t* tuple;
|
|
|
|
dfield_t* dfield;
|
2001-10-10 22:47:08 +03:00
|
|
|
dict_index_t* sec_index;
|
|
|
|
dict_table_t* sys_foreign;
|
2001-02-17 14:19:19 +02:00
|
|
|
rec_t* rec;
|
|
|
|
byte* field;
|
|
|
|
ulint len;
|
2001-10-10 22:47:08 +03:00
|
|
|
char* id ;
|
|
|
|
ulint err;
|
|
|
|
mtr_t mtr;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
sys_foreign = dict_table_get_low("SYS_FOREIGN");
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
if (sys_foreign == NULL) {
|
|
|
|
/* No foreign keys defined yet in this database */
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Error: no foreign key system tables in the database\n");
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
mtr_start(&mtr);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
/* Get the secondary index based on FOR_NAME from table
|
|
|
|
SYS_FOREIGN */
|
|
|
|
|
|
|
|
sec_index = dict_table_get_next_index(
|
|
|
|
dict_table_get_first_index(sys_foreign));
|
|
|
|
start_load:
|
2001-02-17 14:19:19 +02:00
|
|
|
heap = mem_heap_create(256);
|
|
|
|
|
|
|
|
tuple = dtuple_create(heap, 1);
|
|
|
|
dfield = dtuple_get_nth_field(tuple, 0);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
dfield_set_data(dfield, table_name, ut_strlen(table_name));
|
|
|
|
dict_index_copy_types(tuple, sec_index, 1);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE,
|
2001-02-17 14:19:19 +02:00
|
|
|
BTR_SEARCH_LEAF, &pcur, &mtr);
|
2001-10-10 22:47:08 +03:00
|
|
|
loop:
|
2001-02-17 14:19:19 +02:00
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
|
|
|
|
/* End of index */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
goto load_next_index;
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/* Now we have the record in the secondary index containing a table
|
|
|
|
name and a foreign constraint ID */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
rec = btr_pcur_get_rec(&pcur);
|
|
|
|
field = rec_get_nth_field(rec, 0, &len);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/* Check if the table name in record is the one searched for */
|
|
|
|
if (len != ut_strlen(table_name)
|
|
|
|
|| 0 != ut_memcmp(field, table_name, len)) {
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
goto load_next_index;
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
if (rec_get_deleted_flag(rec)) {
|
|
|
|
|
|
|
|
goto next_rec;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we get a foreign key constraint id */
|
2001-02-17 14:19:19 +02:00
|
|
|
field = rec_get_nth_field(rec, 1, &len);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
id = mem_heap_strdupl(heap, field, len);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
btr_pcur_store_position(&pcur, &mtr);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
/* Load the foreign constraint definition to the dictionary cache */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
err = dict_load_foreign(id);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mem_heap_free(heap);
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr);
|
|
|
|
next_rec:
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
|
|
|
|
load_next_index:
|
2001-02-17 14:19:19 +02:00
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
mem_heap_free(heap);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
sec_index = dict_table_get_next_index(sec_index);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
if (sec_index != NULL) {
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
goto start_load;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|