2001-02-17 14:19:19 +02:00
|
|
|
/**********************************************************************
|
|
|
|
Data dictionary memory object creation
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 1/8/1996 Heikki Tuuri
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include "dict0mem.h"
|
|
|
|
|
|
|
|
#ifdef UNIV_NONINL
|
|
|
|
#include "dict0mem.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "rem0rec.h"
|
|
|
|
#include "data0type.h"
|
|
|
|
#include "mach0data.h"
|
|
|
|
#include "dict0dict.h"
|
|
|
|
#include "que0que.h"
|
|
|
|
#include "pars0pars.h"
|
2001-10-10 22:47:08 +03:00
|
|
|
#include "lock0lock.h"
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
#define DICT_HEAP_SIZE 100 /* initial memory heap size when
|
|
|
|
creating a table or index object */
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Creates a table memory object. */
|
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_mem_table_create(
|
|
|
|
/*==================*/
|
|
|
|
/* out, own: table object */
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* name, /* in: table name */
|
|
|
|
ulint space, /* in: space where the clustered index of
|
2001-02-17 14:19:19 +02:00
|
|
|
the table is placed; this parameter is
|
|
|
|
ignored if the table is made a member of
|
|
|
|
a cluster */
|
2004-05-17 14:40:31 +03:00
|
|
|
ulint n_cols) /* in: number of columns */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
|
|
|
dict_table_t* table;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
|
|
|
|
ut_ad(name);
|
|
|
|
|
|
|
|
heap = mem_heap_create(DICT_HEAP_SIZE);
|
|
|
|
|
|
|
|
table = mem_heap_alloc(heap, sizeof(dict_table_t));
|
|
|
|
|
|
|
|
table->heap = heap;
|
|
|
|
|
|
|
|
table->type = DICT_TABLE_ORDINARY;
|
2004-05-17 14:40:31 +03:00
|
|
|
table->name = mem_heap_strdup(heap, name);
|
Many files:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
sql/ha_innodb.cc:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/row/row0mysql.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/fil/fil0fil.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/dict/dict0crea.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/dict/dict0dict.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/dict/dict0load.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/dict/dict0mem.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/include/mem0mem.ic:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/include/dict0mem.h:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/include/fil0fil.h:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/include/mem0mem.h:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
innobase/mem/mem0mem.c:
Fix bug #5137: if innodb_file_per_table was specified, CREATE TEMPORARY TABLE ... TYPE=InnoDB said that cannot find path specified, and made mysqld to exit(1)
2004-10-07 20:53:20 +03:00
|
|
|
table->dir_path_of_temp_table = NULL;
|
2001-02-17 14:19:19 +02:00
|
|
|
table->space = space;
|
2003-10-07 17:28:59 +03:00
|
|
|
table->ibd_file_missing = FALSE;
|
|
|
|
table->tablespace_discarded = FALSE;
|
2001-02-17 14:19:19 +02:00
|
|
|
table->n_def = 0;
|
|
|
|
table->n_cols = n_cols + DATA_N_SYS_COLS;
|
|
|
|
table->mem_fix = 0;
|
2002-01-28 22:18:49 +02:00
|
|
|
|
|
|
|
table->n_mysql_handles_opened = 0;
|
2002-04-18 10:40:32 +03:00
|
|
|
table->n_foreign_key_checks_running = 0;
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
table->cached = FALSE;
|
|
|
|
|
2002-06-22 20:41:14 +03:00
|
|
|
table->mix_id = ut_dulint_zero;
|
|
|
|
table->mix_len = 0;
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
|
|
|
|
* sizeof(dict_col_t));
|
|
|
|
UT_LIST_INIT(table->indexes);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
|
|
|
|
|
2002-09-20 05:11:08 +03:00
|
|
|
table->query_cache_inv_trx_id = ut_dulint_zero;
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
UT_LIST_INIT(table->locks);
|
2001-10-10 22:47:08 +03:00
|
|
|
UT_LIST_INIT(table->foreign_list);
|
|
|
|
UT_LIST_INIT(table->referenced_list);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
table->does_not_fit_in_memory = FALSE;
|
|
|
|
|
2001-12-17 13:17:48 +02:00
|
|
|
table->stat_initialized = FALSE;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-12-17 13:17:48 +02:00
|
|
|
table->stat_modified_counter = 0;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2001-05-21 19:04:46 +03:00
|
|
|
mutex_create(&(table->autoinc_mutex));
|
|
|
|
mutex_set_level(&(table->autoinc_mutex), SYNC_DICT_AUTOINC_MUTEX);
|
|
|
|
|
|
|
|
table->autoinc_inited = FALSE;
|
2004-06-17 13:25:06 +03:00
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
table->magic_n = DICT_TABLE_MAGIC_N;
|
2004-06-17 13:25:06 +03:00
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
return(table);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Creates a cluster memory object. */
|
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_mem_cluster_create(
|
|
|
|
/*====================*/
|
|
|
|
/* out, own: cluster object */
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* name, /* in: cluster name */
|
|
|
|
ulint space, /* in: space where the clustered indexes
|
2001-02-17 14:19:19 +02:00
|
|
|
of the member tables are placed */
|
2004-05-17 14:40:31 +03:00
|
|
|
ulint n_cols, /* in: number of columns */
|
|
|
|
ulint mix_len)/* in: length of the common key prefix in the
|
2001-02-17 14:19:19 +02:00
|
|
|
cluster */
|
|
|
|
{
|
|
|
|
dict_table_t* cluster;
|
|
|
|
|
|
|
|
cluster = dict_mem_table_create(name, space, n_cols);
|
|
|
|
|
|
|
|
cluster->type = DICT_TABLE_CLUSTER;
|
|
|
|
cluster->mix_len = mix_len;
|
|
|
|
|
|
|
|
return(cluster);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Declares a non-published table as a member in a cluster. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_mem_table_make_cluster_member(
|
|
|
|
/*===============================*/
|
|
|
|
dict_table_t* table, /* in: non-published table */
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* cluster_name) /* in: cluster name */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
|
|
|
table->type = DICT_TABLE_CLUSTER_MEMBER;
|
|
|
|
table->cluster_name = cluster_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Adds a column definition to a table. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_mem_table_add_col(
|
|
|
|
/*===================*/
|
|
|
|
dict_table_t* table, /* in: table */
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* name, /* in: column name */
|
2001-02-17 14:19:19 +02:00
|
|
|
ulint mtype, /* in: main datatype */
|
|
|
|
ulint prtype, /* in: precise type */
|
|
|
|
ulint len, /* in: length */
|
|
|
|
ulint prec) /* in: precision */
|
|
|
|
{
|
|
|
|
dict_col_t* col;
|
|
|
|
dtype_t* type;
|
|
|
|
|
|
|
|
ut_ad(table && name);
|
|
|
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
|
|
|
|
|
|
|
table->n_def++;
|
|
|
|
|
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
|
|
|
col = dict_table_get_nth_col(table, table->n_def - 1);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
col->ind = table->n_def - 1;
|
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
|
|
|
col->name = mem_heap_strdup(table->heap, name);
|
2001-02-17 14:19:19 +02:00
|
|
|
col->table = table;
|
|
|
|
col->ord_part = 0;
|
|
|
|
|
|
|
|
col->clust_pos = ULINT_UNDEFINED;
|
|
|
|
|
|
|
|
type = dict_col_get_type(col);
|
|
|
|
|
|
|
|
dtype_set(type, mtype, prtype, len, prec);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Creates an index memory object. */
|
|
|
|
|
|
|
|
dict_index_t*
|
|
|
|
dict_mem_index_create(
|
|
|
|
/*==================*/
|
2004-05-17 14:40:31 +03:00
|
|
|
/* out, own: index object */
|
|
|
|
const char* table_name, /* in: table name */
|
|
|
|
const char* index_name, /* in: index name */
|
|
|
|
ulint space, /* in: space where the index tree is
|
|
|
|
placed, ignored if the index is of
|
|
|
|
the clustered type */
|
|
|
|
ulint type, /* in: DICT_UNIQUE,
|
|
|
|
DICT_CLUSTERED, ... ORed */
|
|
|
|
ulint n_fields) /* in: number of fields */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
|
|
|
dict_index_t* index;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
|
|
|
|
ut_ad(table_name && index_name);
|
|
|
|
|
|
|
|
heap = mem_heap_create(DICT_HEAP_SIZE);
|
|
|
|
index = mem_heap_alloc(heap, sizeof(dict_index_t));
|
|
|
|
|
|
|
|
index->heap = heap;
|
|
|
|
|
|
|
|
index->type = type;
|
|
|
|
index->space = space;
|
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
|
|
|
index->name = mem_heap_strdup(heap, index_name);
|
2001-02-17 14:19:19 +02:00
|
|
|
index->table_name = table_name;
|
|
|
|
index->table = NULL;
|
|
|
|
index->n_def = 0;
|
|
|
|
index->n_fields = n_fields;
|
|
|
|
index->fields = mem_heap_alloc(heap, 1 + n_fields
|
|
|
|
* sizeof(dict_field_t));
|
|
|
|
/* The '1 +' above prevents allocation
|
|
|
|
of an empty mem block */
|
2001-10-10 22:47:08 +03:00
|
|
|
index->stat_n_diff_key_vals = NULL;
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
index->cached = FALSE;
|
|
|
|
index->magic_n = DICT_INDEX_MAGIC_N;
|
|
|
|
|
|
|
|
return(index);
|
|
|
|
}
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
/**************************************************************************
|
|
|
|
Creates and initializes a foreign constraint memory object. */
|
|
|
|
|
|
|
|
dict_foreign_t*
|
|
|
|
dict_mem_foreign_create(void)
|
|
|
|
/*=========================*/
|
|
|
|
/* out, own: foreign constraint struct */
|
|
|
|
{
|
|
|
|
dict_foreign_t* foreign;
|
|
|
|
mem_heap_t* heap;
|
|
|
|
|
|
|
|
heap = mem_heap_create(100);
|
|
|
|
|
|
|
|
foreign = mem_heap_alloc(heap, sizeof(dict_foreign_t));
|
|
|
|
|
|
|
|
foreign->heap = heap;
|
|
|
|
|
|
|
|
foreign->id = NULL;
|
|
|
|
|
2002-04-18 10:40:32 +03:00
|
|
|
foreign->type = 0;
|
2001-10-10 22:47:08 +03:00
|
|
|
foreign->foreign_table_name = NULL;
|
|
|
|
foreign->foreign_table = NULL;
|
|
|
|
foreign->foreign_col_names = NULL;
|
|
|
|
|
|
|
|
foreign->referenced_table_name = NULL;
|
|
|
|
foreign->referenced_table = NULL;
|
|
|
|
foreign->referenced_col_names = NULL;
|
|
|
|
|
|
|
|
foreign->n_fields = 0;
|
|
|
|
|
|
|
|
foreign->foreign_index = NULL;
|
|
|
|
foreign->referenced_index = NULL;
|
|
|
|
|
|
|
|
return(foreign);
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
/**************************************************************************
|
|
|
|
Adds a field definition to an index. NOTE: does not take a copy
|
|
|
|
of the column name if the field is a column. The memory occupied
|
|
|
|
by the column name may be released only after publishing the index. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_mem_index_add_field(
|
|
|
|
/*=====================*/
|
2003-06-15 01:04:28 +03:00
|
|
|
dict_index_t* index, /* in: index */
|
2004-05-17 14:40:31 +03:00
|
|
|
const char* name, /* in: column name */
|
2003-06-15 01:04:28 +03:00
|
|
|
ulint order, /* in: order criterion; 0 means an
|
|
|
|
ascending order */
|
|
|
|
ulint prefix_len) /* in: 0 or the column prefix length
|
|
|
|
in a MySQL index like
|
|
|
|
INDEX (textcol(25)) */
|
2001-02-17 14:19:19 +02:00
|
|
|
{
|
|
|
|
dict_field_t* field;
|
|
|
|
|
|
|
|
ut_ad(index && name);
|
|
|
|
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
|
|
|
|
|
|
|
index->n_def++;
|
|
|
|
|
|
|
|
field = dict_index_get_nth_field(index, index->n_def - 1);
|
|
|
|
|
|
|
|
field->name = name;
|
|
|
|
field->order = order;
|
2003-06-15 01:04:28 +03:00
|
|
|
|
|
|
|
field->prefix_len = prefix_len;
|
2001-02-17 14:19:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Frees an index memory object. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_mem_index_free(
|
|
|
|
/*================*/
|
|
|
|
dict_index_t* index) /* in: index */
|
|
|
|
{
|
|
|
|
mem_heap_free(index->heap);
|
|
|
|
}
|